|
@@ -24,7 +24,6 @@ using System.Windows.Media;
|
|
|
|
|
|
namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
{
|
|
|
-
|
|
|
public class DashStyleConverter : IValueConverter
|
|
|
{
|
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
@@ -52,10 +51,13 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
throw new NotImplementedException();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
public class SharpsAnnotPropertyViewModel : BindableBase, INavigationAware
|
|
|
{
|
|
|
#region 属性
|
|
|
+
|
|
|
private bool isRect = false;
|
|
|
+
|
|
|
public bool IsRect
|
|
|
{
|
|
|
get { return isRect; }
|
|
@@ -63,6 +65,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
}
|
|
|
|
|
|
private bool isCircle = false;
|
|
|
+
|
|
|
public bool IsCircle
|
|
|
{
|
|
|
get { return isCircle; }
|
|
@@ -70,6 +73,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
}
|
|
|
|
|
|
private bool isArrow = false;
|
|
|
+
|
|
|
public bool IsArrow
|
|
|
{
|
|
|
get { return isArrow; }
|
|
@@ -77,6 +81,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
}
|
|
|
|
|
|
private bool isLine = false;
|
|
|
+
|
|
|
public bool IsLine
|
|
|
{
|
|
|
get { return isLine; }
|
|
@@ -93,9 +98,11 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
SetProperty(ref _strShapeChecked, value);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
public List<ComboDataItem> ThicknessItems { get; protected set; }
|
|
|
|
|
|
private AnnotCommon _basicVm = new AnnotCommon();
|
|
|
+
|
|
|
public AnnotCommon BasicVm
|
|
|
{
|
|
|
get { return _basicVm; }
|
|
@@ -103,6 +110,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
}
|
|
|
|
|
|
private Geometry dataPath = null;
|
|
|
+
|
|
|
public Geometry DataPath
|
|
|
{
|
|
|
get { return dataPath; }
|
|
@@ -113,6 +121,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
}
|
|
|
|
|
|
private DashStyle dash = new DashStyle();
|
|
|
+
|
|
|
public DashStyle Dash
|
|
|
{
|
|
|
get { return dash; }
|
|
@@ -123,6 +132,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
}
|
|
|
|
|
|
private bool _isLineAnnot = false;
|
|
|
+
|
|
|
public bool IsLineAnnot
|
|
|
{
|
|
|
get { return _isLineAnnot; }
|
|
@@ -132,7 +142,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- #endregion
|
|
|
+ #endregion 属性
|
|
|
|
|
|
public DelegateCommand<object> SelectedThickCommand { get; set; }
|
|
|
public DelegateCommand<object> SelectedBorderColorCommand { get; set; }
|
|
@@ -146,8 +156,8 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
public DelegateCommand<object> ThicknessChangedCommand { get; set; }
|
|
|
public DelegateCommand<object> SelectedOpacityValueCommand { get; set; }
|
|
|
|
|
|
-
|
|
|
public event EventHandler<object> LoadPropertyHandler;
|
|
|
+
|
|
|
public SharpsAnnotPropertyViewModel()
|
|
|
{
|
|
|
InitColorItems();
|
|
@@ -210,21 +220,42 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
if (obj != null)
|
|
|
{
|
|
|
var tag = (string)obj;
|
|
|
- SharpsType(tag);
|
|
|
+ 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":
|
|
@@ -233,13 +264,14 @@ 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":
|
|
|
{
|
|
|
-
|
|
|
ArrowHelper arrowLine = new ArrowHelper();
|
|
|
arrowLine.ArrowLength = 8;
|
|
|
arrowLine.LineStart = new Point(8, 24);
|
|
@@ -247,8 +279,11 @@ 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;
|
|
|
- IsLineAnnot = true;
|
|
|
+
|
|
|
+ if (IsLineAnnot == false)
|
|
|
+ IsLineAnnot = true;
|
|
|
+ //if (isArrow == false)
|
|
|
+ // isArrow = true;
|
|
|
// changeData[AnnotArgsType.AnnotLine] = tag;
|
|
|
}
|
|
|
|
|
@@ -260,17 +295,21 @@ 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;
|
|
|
- IsLineAnnot = true;
|
|
|
+
|
|
|
+ if (IsLineAnnot == false)
|
|
|
+ IsLineAnnot = true;
|
|
|
+ //if (IsLine == false)
|
|
|
+ // IsLine = true;
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
- if (isFromToolsBtn == false)
|
|
|
- PropertyPanel.AnnotTypeChangedInvoke(this, changeData);
|
|
|
+ //if (isFromToolsBtn)
|
|
|
+ // PropertyPanel.AnnotTypeChangedInvoke(this, changeData);
|
|
|
|
|
|
StrShapeChecked = tag;
|
|
|
+ PropertyPanel.SharpsAnnot = tag;
|
|
|
BasicVm.SetOtherTag(tag);
|
|
|
}
|
|
|
|
|
@@ -301,8 +340,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
private void SelectedFillColor_Command(object obj)
|
|
|
{
|
|
|
if (obj != null && PropertyPanel != null)
|
|
@@ -318,8 +355,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
PropertyPanel.InvokeToMyTools(BasicVm.AnnotType, Annot);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
private void SelectedFillOpacity_Command(object obj)
|
|
@@ -331,9 +366,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
|
|
|
PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Transparency, BasicVm.FillOpacity);
|
|
|
PropertyPanel.InvokeToMyTools(BasicVm.AnnotType, BasicVm.FillOpacity);
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
private void SelectedOpacityValue(object obj)
|
|
@@ -346,14 +379,10 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Transparency, BasicVm.FillOpacity);
|
|
|
PropertyPanel.InvokeToMyTools(BasicVm.AnnotType, BasicVm.FillOpacity);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
private void SelectedBorderColor(object obj)
|
|
|
{
|
|
|
-
|
|
|
if (obj != null && PropertyPanel != null)
|
|
|
{
|
|
|
var colorValue = (Color)obj;
|
|
@@ -367,7 +396,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
PropertyPanel.InvokeToMyTools(BasicVm.AnnotType, Annot);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
private void SelectedThick_Command(object obj)
|
|
@@ -375,7 +403,8 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
if (obj is double)
|
|
|
{
|
|
|
var tran = (double)obj;
|
|
|
- BasicVm.AnnotThickness = tran;
|
|
|
+
|
|
|
+ //BasicVm.AnnotThickness = tran;
|
|
|
PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, tran);
|
|
|
|
|
|
if (BasicVm.IsMultiSelected == false)
|
|
@@ -391,6 +420,12 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
public void OnNavigatedFrom(NavigationContext navigationContext)
|
|
|
{
|
|
|
BasicVm.IsMultiSelected = false;
|
|
|
+ //PropertyPanel.annot = null;
|
|
|
+ //PropertyPanel.AnnotEvents = null;
|
|
|
+ //PropertyPanel.AnnotEvent = null;
|
|
|
+ //PropertyPanel.annotlists = null;
|
|
|
+ //AnnotEvent = null;
|
|
|
+ //Annot = null;
|
|
|
}
|
|
|
|
|
|
private void SetAnnotType()
|
|
@@ -400,9 +435,11 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
case AnnotArgsType.AnnotCircle:
|
|
|
BasicVm.AnnotTypeTitle = "圆";
|
|
|
break;
|
|
|
+
|
|
|
case AnnotArgsType.AnnotSquare:
|
|
|
BasicVm.AnnotTypeTitle = "矩形";
|
|
|
break;
|
|
|
+
|
|
|
case AnnotArgsType.AnnotLine:
|
|
|
|
|
|
var annotLine = Annot as LineAnnotArgs;
|
|
@@ -415,12 +452,12 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
public AnnotAttribEvent AnnotEvent { get; set; }
|
|
|
- private AnnotHandlerEventArgs Annot;
|
|
|
- private AnnotTransfer PropertyPanel;
|
|
|
+ public AnnotHandlerEventArgs Annot;
|
|
|
+ public AnnotTransfer PropertyPanel;
|
|
|
+
|
|
|
public void OnNavigatedTo(NavigationContext navigationContext)
|
|
|
{
|
|
|
navigationContext.Parameters.TryGetValue<AnnotTransfer>(ParameterNames.PropertyPanelContentViewModel, out PropertyPanel);
|
|
@@ -441,7 +478,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
|
|
|
LoadPropertyHandler?.Invoke(null, Annot);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
private List<SquareAnnotArgs> ConvertLists()
|
|
@@ -461,6 +497,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
else
|
|
|
return FreeTextLists;
|
|
|
}
|
|
|
+
|
|
|
private void IsAttributeEquals()
|
|
|
{
|
|
|
var list = ConvertLists();
|
|
@@ -491,12 +528,11 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
{
|
|
|
if (temp.LineColor.A != item.LineColor.A || temp.LineColor.R != item.LineColor.R || temp.LineColor.G != item.LineColor.G || temp.LineColor.B != item.LineColor.B)
|
|
|
{
|
|
|
- BasicVm.BorderColor = new SolidColorBrush(Color.FromArgb(0x01,0xff,0xff,0xff));
|
|
|
+ BasicVm.BorderColor = new SolidColorBrush(Color.FromArgb(0x01, 0xff, 0xff, 0xff));
|
|
|
isNoEqualsDir["LineColor"] = true;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
if (isNoEqualsDir["Thickness"] == false)
|
|
|
{
|
|
|
isNoEqualsDir["Thickness"] = true;
|
|
@@ -523,13 +559,11 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
if (isNoEqualsDir["FillColor"] == false)
|
|
|
{
|
|
|
BasicVm.FillColor = new SolidColorBrush(temp.BgColor);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
if (isNoEqualsDir["LineColor"] == false)
|
|
|
{
|
|
|
BasicVm.BorderColor = new SolidColorBrush(temp.LineColor);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
if (isNoEqualsDir["Thickness"] == false)
|
|
@@ -547,11 +581,9 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
BasicVm.IsSolidLine = isSolid;
|
|
|
BasicVm.IsDashLine = !isSolid;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
private bool IsSolidStyle(AnnotHandlerEventArgs annot)
|
|
|
{
|
|
|
bool isSolid = true;
|
|
@@ -591,10 +623,13 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
BasicVm.FillOpacity = Square.Transparency;
|
|
|
BasicVm.AnnotThickness = Square.LineWidth;
|
|
|
Dash = Square.LineDash;
|
|
|
- SharpsType("Rect", true);
|
|
|
+ //SharpsType("Rect", false);
|
|
|
BasicVm.AnnotTypeTitle = "矩形";
|
|
|
IsLineAnnot = false;
|
|
|
IsRect = true;
|
|
|
+ //IsCircle = false;
|
|
|
+ //IsArrow=false;
|
|
|
+ //IsLine= false;
|
|
|
}
|
|
|
break;
|
|
|
|
|
@@ -608,10 +643,13 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
BasicVm.FillOpacity = Circle.Transparency;
|
|
|
BasicVm.AnnotThickness = Circle.LineWidth;
|
|
|
Dash = Circle.LineDash;
|
|
|
- SharpsType("Circle", true);
|
|
|
+ //SharpsType("Circle", false);
|
|
|
BasicVm.AnnotTypeTitle = "圆";
|
|
|
IsLineAnnot = false;
|
|
|
IsCircle = true;
|
|
|
+ //IsRect = false;
|
|
|
+ //IsArrow = false;
|
|
|
+ //IsLine = false;
|
|
|
}
|
|
|
break;
|
|
|
|
|
@@ -628,19 +666,24 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
|
|
|
if (line.TailLineType == C_LINE_TYPE.LINETYPE_ARROW && line.HeadLineType == C_LINE_TYPE.LINETYPE_NONE)
|
|
|
{
|
|
|
- SharpsType("Arrow", true);
|
|
|
+ //SharpsType("Arrow", false);
|
|
|
BasicVm.AnnotTypeTitle = "箭头";
|
|
|
IsArrow = true;
|
|
|
+ //IsCircle = false;
|
|
|
+ //IsRect = false;
|
|
|
+ //IsLine = false;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- SharpsType("Line", true);
|
|
|
+ //SharpsType("Line", false);
|
|
|
BasicVm.AnnotTypeTitle = "线条";
|
|
|
IsLine = true;
|
|
|
+ //IsCircle = false;
|
|
|
+ //IsRect = false;
|
|
|
+ //IsArrow = false;
|
|
|
}
|
|
|
|
|
|
IsLineAnnot = true;
|
|
|
-
|
|
|
}
|
|
|
|
|
|
break;
|
|
@@ -650,9 +693,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
BasicVm.IsSolidLine = isSolid;
|
|
|
BasicVm.IsDashLine = !isSolid;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
-}
|
|
|
+}
|