|
@@ -1,18 +1,23 @@
|
|
|
using ComPDFKit.PDFAnnotation;
|
|
|
using ComPDFKitViewer;
|
|
|
using ComPDFKitViewer.AnnotEvent;
|
|
|
+using ComPDFKitViewer.PdfViewer;
|
|
|
+using ImTools;
|
|
|
using PDF_Master.CustomControl.CompositeControl;
|
|
|
using PDF_Master.Helper;
|
|
|
using PDF_Master.Model;
|
|
|
using PDF_Master.Model.AnnotPanel;
|
|
|
+using PDF_Master.Properties;
|
|
|
using PDF_Master.ViewModels.Tools;
|
|
|
using PDF_Master.ViewModels.Tools.AnnotManager;
|
|
|
+using PDF_Master.Views.Tools;
|
|
|
using PDFSettings;
|
|
|
using Prism.Commands;
|
|
|
using Prism.Mvvm;
|
|
|
using Prism.Regions;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
+using System.Drawing;
|
|
|
using System.Globalization;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
@@ -21,6 +26,8 @@ using System.Windows;
|
|
|
using System.Windows.Controls;
|
|
|
using System.Windows.Data;
|
|
|
using System.Windows.Media;
|
|
|
+using Color = System.Windows.Media.Color;
|
|
|
+using Point = System.Windows.Point;
|
|
|
|
|
|
namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
{
|
|
@@ -158,8 +165,11 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
|
|
|
public event EventHandler<object> LoadPropertyHandler;
|
|
|
|
|
|
- public SharpsAnnotPropertyViewModel()
|
|
|
+ public IRegionManager region;
|
|
|
+
|
|
|
+ public SharpsAnnotPropertyViewModel(IRegionManager regionManager)
|
|
|
{
|
|
|
+ region = regionManager;
|
|
|
InitColorItems();
|
|
|
InitFillColorItems();
|
|
|
InitThicknessItems();
|
|
@@ -221,41 +231,20 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
{
|
|
|
var tag = (string)obj;
|
|
|
SharpsType(tag, true);
|
|
|
- Dictionary<AnnotArgsType, object> changeData = new Dictionary<AnnotArgsType, object>();
|
|
|
- switch (tag)
|
|
|
- {
|
|
|
- case "Rect":
|
|
|
- changeData[AnnotArgsType.AnnotSquare] = tag;
|
|
|
- break;
|
|
|
-
|
|
|
- case "Circle":
|
|
|
- changeData[AnnotArgsType.AnnotCircle] = tag;
|
|
|
- break;
|
|
|
-
|
|
|
- case "Arrow":
|
|
|
- changeData[AnnotArgsType.AnnotLine] = tag;
|
|
|
- break;
|
|
|
-
|
|
|
- case "Line":
|
|
|
- changeData[AnnotArgsType.AnnotLine] = tag;
|
|
|
- break;
|
|
|
- }
|
|
|
- PropertyPanel.AnnotTypeChangedInvoke(this, changeData);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void SharpsType(string tag, bool isFromToolsBtn = false)
|
|
|
{
|
|
|
+ Dictionary<AnnotArgsType, object> changeData = new Dictionary<AnnotArgsType, object>();
|
|
|
switch (tag)
|
|
|
{
|
|
|
case "Rect":
|
|
|
RectangleGeometry rectPath = new RectangleGeometry();
|
|
|
rectPath.Rect = new Rect(0, 5, 28, 22);
|
|
|
DataPath = rectPath;
|
|
|
-
|
|
|
+ changeData[AnnotArgsType.AnnotSquare] = tag;
|
|
|
IsLineAnnot = false;
|
|
|
- //if (IsRect == false)
|
|
|
- // IsRect = true;
|
|
|
break;
|
|
|
|
|
|
case "Circle":
|
|
@@ -264,10 +253,8 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
circlePath.RadiusY = 14;
|
|
|
circlePath.Center = new Point(14, 14);
|
|
|
DataPath = circlePath;
|
|
|
-
|
|
|
+ changeData[AnnotArgsType.AnnotCircle] = tag;
|
|
|
IsLineAnnot = false;
|
|
|
- //if (IsCircle == false)
|
|
|
- // IsCircle = true;
|
|
|
break;
|
|
|
|
|
|
case "Arrow":
|
|
@@ -279,12 +266,9 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
arrowLine.StartSharp = C_LINE_TYPE.LINETYPE_NONE;
|
|
|
arrowLine.EndSharp = C_LINE_TYPE.LINETYPE_ARROW;
|
|
|
DataPath = arrowLine.BuildArrowBody();
|
|
|
-
|
|
|
+ changeData[AnnotArgsType.AnnotLine] = tag;
|
|
|
if (IsLineAnnot == false)
|
|
|
IsLineAnnot = true;
|
|
|
- //if (isArrow == false)
|
|
|
- // isArrow = true;
|
|
|
- // changeData[AnnotArgsType.AnnotLine] = tag;
|
|
|
}
|
|
|
|
|
|
break;
|
|
@@ -295,18 +279,16 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
arrowLine.LineStart = new Point(0, 32);
|
|
|
arrowLine.LineEnd = new Point(32, 0);
|
|
|
DataPath = arrowLine.BuildArrowBody();
|
|
|
-
|
|
|
+ changeData[AnnotArgsType.AnnotLine] = tag;
|
|
|
if (IsLineAnnot == false)
|
|
|
IsLineAnnot = true;
|
|
|
- //if (IsLine == false)
|
|
|
- // IsLine = true;
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
- //if (isFromToolsBtn)
|
|
|
- // PropertyPanel.AnnotTypeChangedInvoke(this, changeData);
|
|
|
+ if (isFromToolsBtn)
|
|
|
+ PropertyPanel.AnnotTypeChangedInvoke(this, changeData);
|
|
|
|
|
|
StrShapeChecked = tag;
|
|
|
PropertyPanel.SharpsAnnot = tag;
|
|
@@ -403,9 +385,34 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
if (obj is double)
|
|
|
{
|
|
|
var tran = (double)obj;
|
|
|
+ AnnotArgsType argsType = AnnotArgsType.AnnotSquare;
|
|
|
+ bool isLine = false;
|
|
|
+ switch (BasicVm.strOtherTag)
|
|
|
+ {
|
|
|
+ case "Rect":
|
|
|
+ argsType = AnnotArgsType.AnnotSquare;
|
|
|
+ break;
|
|
|
|
|
|
- //BasicVm.AnnotThickness = tran;
|
|
|
- PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, tran);
|
|
|
+ case "Circle":
|
|
|
+ argsType = AnnotArgsType.AnnotCircle;
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "Line":
|
|
|
+ argsType = AnnotArgsType.AnnotLine;
|
|
|
+ isLine = true;
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "Arrow":
|
|
|
+ argsType = AnnotArgsType.AnnotLine;
|
|
|
+ isLine = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (argsType == BasicVm.AnnotType)
|
|
|
+ {
|
|
|
+ //if(argsType== AnnotArgsType.AnnotLine && isLine)
|
|
|
+ BasicVm.AnnotThickness = tran;
|
|
|
+ PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, tran);
|
|
|
+ }
|
|
|
|
|
|
if (BasicVm.IsMultiSelected == false)
|
|
|
PropertyPanel.InvokeToMyTools(BasicVm.AnnotType, Annot);
|
|
@@ -457,10 +464,12 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
public AnnotAttribEvent AnnotEvent { get; set; }
|
|
|
public AnnotHandlerEventArgs Annot;
|
|
|
public AnnotTransfer PropertyPanel;
|
|
|
+ public ViewContentViewModel ViewContentViewModel;
|
|
|
|
|
|
public void OnNavigatedTo(NavigationContext navigationContext)
|
|
|
{
|
|
|
navigationContext.Parameters.TryGetValue<AnnotTransfer>(ParameterNames.PropertyPanelContentViewModel, out PropertyPanel);
|
|
|
+ navigationContext.Parameters.TryGetValue<ViewContentViewModel>(ParameterNames.ViewContentViewModel, out ViewContentViewModel);
|
|
|
if (PropertyPanel != null)
|
|
|
{
|
|
|
AnnotEvent = PropertyPanel.AnnotEvent;
|
|
@@ -623,13 +632,10 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
BasicVm.FillOpacity = Square.Transparency;
|
|
|
BasicVm.AnnotThickness = Square.LineWidth;
|
|
|
Dash = Square.LineDash;
|
|
|
- //SharpsType("Rect", false);
|
|
|
+ SharpsType("Rect", false);
|
|
|
BasicVm.AnnotTypeTitle = "矩形";
|
|
|
IsLineAnnot = false;
|
|
|
IsRect = true;
|
|
|
- //IsCircle = false;
|
|
|
- //IsArrow=false;
|
|
|
- //IsLine= false;
|
|
|
}
|
|
|
break;
|
|
|
|
|
@@ -643,13 +649,10 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
BasicVm.FillOpacity = Circle.Transparency;
|
|
|
BasicVm.AnnotThickness = Circle.LineWidth;
|
|
|
Dash = Circle.LineDash;
|
|
|
- //SharpsType("Circle", false);
|
|
|
+ SharpsType("Circle", false);
|
|
|
BasicVm.AnnotTypeTitle = "圆";
|
|
|
IsLineAnnot = false;
|
|
|
IsCircle = true;
|
|
|
- //IsRect = false;
|
|
|
- //IsArrow = false;
|
|
|
- //IsLine = false;
|
|
|
}
|
|
|
break;
|
|
|
|
|
@@ -666,21 +669,15 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
|
|
|
if (line.TailLineType == C_LINE_TYPE.LINETYPE_ARROW && line.HeadLineType == C_LINE_TYPE.LINETYPE_NONE)
|
|
|
{
|
|
|
- //SharpsType("Arrow", false);
|
|
|
+ SharpsType("Arrow", false);
|
|
|
BasicVm.AnnotTypeTitle = "箭头";
|
|
|
IsArrow = true;
|
|
|
- //IsCircle = false;
|
|
|
- //IsRect = false;
|
|
|
- //IsLine = false;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- //SharpsType("Line", false);
|
|
|
+ SharpsType("Line", false);
|
|
|
BasicVm.AnnotTypeTitle = "线条";
|
|
|
IsLine = true;
|
|
|
- //IsCircle = false;
|
|
|
- //IsRect = false;
|
|
|
- //IsArrow = false;
|
|
|
}
|
|
|
|
|
|
IsLineAnnot = true;
|