|
@@ -275,12 +275,13 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
if (defaultAnnot == null)
|
|
|
{
|
|
|
defaultAnnot = new DefaultAnnotProperty();
|
|
|
+ defaultAnnot.AnnotToolType = highlightArgs.EventType;
|
|
|
defaultAnnot.ForgoundColor = (highLightColor as SolidColorBrush).Color;
|
|
|
defaultAnnot.Opacity = 1;
|
|
|
Settings.Default.Save();
|
|
|
}
|
|
|
|
|
|
- highlightArgs.Transparency = defaultAnnot.Opacity;
|
|
|
+ highLightOpacity = highlightArgs.Transparency = defaultAnnot.Opacity;
|
|
|
|
|
|
selectedArgs = new List<AnnotHandlerEventArgs>();
|
|
|
selectedArgs.Add(highlightArgs);
|
|
@@ -340,12 +341,13 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
if (defaultAnnot == null)
|
|
|
{
|
|
|
defaultAnnot = new DefaultAnnotProperty();
|
|
|
+ defaultAnnot.AnnotToolType = underlineArgs.EventType;
|
|
|
defaultAnnot.ForgoundColor = (UnderLineColor as SolidColorBrush).Color;
|
|
|
defaultAnnot.Opacity = 1;
|
|
|
Settings.Default.Save();
|
|
|
}
|
|
|
|
|
|
- underlineArgs.Transparency = defaultAnnot.Opacity;
|
|
|
+ UnderLineOpacity = underlineArgs.Transparency = defaultAnnot.Opacity;
|
|
|
|
|
|
selectedArgs = new List<AnnotHandlerEventArgs>();
|
|
|
selectedArgs.Add(underlineArgs);
|
|
@@ -378,12 +380,14 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
if (defaultAnnot == null)
|
|
|
{
|
|
|
defaultAnnot = new DefaultAnnotProperty();
|
|
|
+ defaultAnnot.AnnotToolType = squigglyArgs.EventType;
|
|
|
defaultAnnot.ForgoundColor = (squigglyColor as SolidColorBrush).Color;
|
|
|
defaultAnnot.Opacity = 1;
|
|
|
Settings.Default.Save();
|
|
|
}
|
|
|
|
|
|
- squigglyArgs.Transparency = defaultAnnot.Opacity;
|
|
|
+ SquigglyOpacity = squigglyArgs.Transparency = defaultAnnot.Opacity;
|
|
|
+
|
|
|
|
|
|
selectedArgs = new List<AnnotHandlerEventArgs>();
|
|
|
selectedArgs.Add(squigglyArgs);
|
|
@@ -416,6 +420,7 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
if (defaultAnnot == null)
|
|
|
{
|
|
|
defaultAnnot = new DefaultAnnotProperty();
|
|
|
+ defaultAnnot.AnnotToolType = strikeoutArgs.EventType;
|
|
|
defaultAnnot.ForgoundColor = (strikeoutColor as SolidColorBrush).Color;
|
|
|
defaultAnnot.Opacity = 1;
|
|
|
Settings.Default.Save();
|
|
@@ -461,6 +466,7 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
if (defaultAnnot == null)
|
|
|
{
|
|
|
defaultAnnot = new DefaultAnnotProperty();
|
|
|
+ defaultAnnot.AnnotToolType = freehandArgs.EventType;
|
|
|
defaultAnnot.ForgoundColor = annotate.FreeHandColor;
|
|
|
defaultAnnot.Opacity = 1;
|
|
|
Settings.Default.Save();
|
|
@@ -469,6 +475,20 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
freehandArgs.Transparency = defaultAnnot.Opacity;
|
|
|
freehandArgs.LineWidth = defaultAnnot.Thickness;
|
|
|
|
|
|
+ if (defaultAnnot.DashArray == null || defaultAnnot.DashArray.Count == 0)
|
|
|
+ {
|
|
|
+ freehandArgs.LineDash = DashStyles.Solid;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var collect = new DoubleCollection();
|
|
|
+ foreach (var item in defaultAnnot.DashArray)
|
|
|
+ {
|
|
|
+ collect.Add(item);
|
|
|
+ }
|
|
|
+ freehandArgs.LineDash.Dashes = collect;
|
|
|
+ }
|
|
|
+
|
|
|
selectedArgs = new List<AnnotHandlerEventArgs>();
|
|
|
selectedArgs.Add(freehandArgs);
|
|
|
}
|
|
@@ -509,6 +529,7 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
if (defaultAnnot == null)
|
|
|
{
|
|
|
defaultAnnot = new DefaultAnnotProperty();
|
|
|
+ defaultAnnot.AnnotToolType = freetextArgs.EventType;
|
|
|
defaultAnnot.ForgoundColor = freetextArgs.FontColor;
|
|
|
defaultAnnot.BorderColor = Colors.Transparent;
|
|
|
defaultAnnot.BackgroundColor = Colors.Transparent;
|
|
@@ -585,6 +606,7 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
if (defaultAnnot == null)
|
|
|
{
|
|
|
defaultAnnot = new DefaultAnnotProperty();
|
|
|
+ defaultAnnot.AnnotToolType = stickyAnnotArgs.EventType;
|
|
|
defaultAnnot.NoteText = string.Empty;
|
|
|
defaultAnnot.Opacity = 1;
|
|
|
Settings.Default.Save();
|
|
@@ -639,6 +661,7 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
if (defaultAnnot == null)
|
|
|
{
|
|
|
defaultAnnot = new DefaultAnnotProperty();
|
|
|
+ defaultAnnot.AnnotToolType = squareArgs.EventType;
|
|
|
defaultAnnot.Thickness = 1;
|
|
|
defaultAnnot.Opacity = 1;
|
|
|
Settings.Default.Save();
|
|
@@ -646,7 +669,20 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
|
|
|
squareArgs.LineWidth = defaultAnnot.Thickness;
|
|
|
squareArgs.Transparency = defaultAnnot.Opacity;
|
|
|
- squareArgs.LineDash = DashStyles.Solid;
|
|
|
+
|
|
|
+ if (defaultAnnot.DashArray == null || defaultAnnot.DashArray.Count == 0)
|
|
|
+ {
|
|
|
+ squareArgs.LineDash = DashStyles.Solid;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var collect = new DoubleCollection();
|
|
|
+ foreach (var item in defaultAnnot.DashArray)
|
|
|
+ {
|
|
|
+ collect.Add(item);
|
|
|
+ }
|
|
|
+ squareArgs.LineDash.Dashes = collect;
|
|
|
+ }
|
|
|
|
|
|
if (squareArgs != null)
|
|
|
{
|
|
@@ -691,15 +727,31 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
if (defaultAnnot == null)
|
|
|
{
|
|
|
defaultAnnot = new DefaultAnnotProperty();
|
|
|
+ defaultAnnot.AnnotToolType = circleAnnotArgs.EventType;
|
|
|
defaultAnnot.Thickness = 1;
|
|
|
defaultAnnot.Opacity = 1;
|
|
|
defaultAnnot.NoteText = string.Empty;
|
|
|
+ defaultAnnot.DashArray = null;
|
|
|
Settings.Default.Save();
|
|
|
}
|
|
|
|
|
|
circleAnnotArgs.LineWidth = defaultAnnot.Thickness;
|
|
|
circleAnnotArgs.Transparency = defaultAnnot.Opacity;
|
|
|
- circleAnnotArgs.LineDash = DashStyles.Solid;
|
|
|
+
|
|
|
+ if(defaultAnnot.DashArray == null || defaultAnnot.DashArray.Count == 0)
|
|
|
+ {
|
|
|
+ circleAnnotArgs.LineDash = DashStyles.Solid;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var collect = new DoubleCollection();
|
|
|
+ foreach(var item in defaultAnnot.DashArray)
|
|
|
+ {
|
|
|
+ collect.Add(item);
|
|
|
+ }
|
|
|
+ circleAnnotArgs.LineDash.Dashes = collect;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
if (circleAnnotArgs != null)
|
|
|
{
|
|
@@ -747,10 +799,37 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
{
|
|
|
lineArgs.TailLineType = C_LINE_TYPE.LINETYPE_ARROW;
|
|
|
}
|
|
|
+
|
|
|
+ var defaultAnnot = SettingHelper.GetAnnotDefaultProperty(lineArgs.EventType);
|
|
|
+ if (defaultAnnot == null)
|
|
|
+ {
|
|
|
+ defaultAnnot = new DefaultAnnotProperty();
|
|
|
+ defaultAnnot.AnnotToolType = lineArgs.EventType;
|
|
|
+ defaultAnnot.Thickness = 1;
|
|
|
+ defaultAnnot.Opacity = 1;
|
|
|
+ defaultAnnot.NoteText = string.Empty;
|
|
|
+ defaultAnnot.DashArray = null;
|
|
|
+ Settings.Default.Save();
|
|
|
+ }
|
|
|
+
|
|
|
lineArgs.LineDash = DashStyles.Solid;
|
|
|
- lineArgs.LineWidth = 1;
|
|
|
- lineArgs.Transparency = 1;
|
|
|
- lineArgs.Content = string.Empty;
|
|
|
+ lineArgs.LineWidth = defaultAnnot.Thickness;
|
|
|
+ lineArgs.Transparency = defaultAnnot.Opacity;
|
|
|
+
|
|
|
+ if (defaultAnnot.DashArray == null || defaultAnnot.DashArray.Count == 0)
|
|
|
+ {
|
|
|
+ lineArgs.LineDash = DashStyles.Solid;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var collect = new DoubleCollection();
|
|
|
+ foreach (var item in defaultAnnot.DashArray)
|
|
|
+ {
|
|
|
+ collect.Add(item);
|
|
|
+ }
|
|
|
+ lineArgs.LineDash.Dashes = collect;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
if (lineArgs != null)
|
|
|
{
|
|
@@ -1131,16 +1210,31 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
}
|
|
|
else if (annot is FreehandAnnotArgs)
|
|
|
{
|
|
|
- var color = (annot as FreehandAnnotArgs).InkColor;
|
|
|
+ var freeHand = annot as FreehandAnnotArgs;
|
|
|
+ var color = freeHand.InkColor;
|
|
|
|
|
|
Settings.Default.AppProperties.Annotate.FreeHandColor = color;
|
|
|
|
|
|
- var Freehand = GetAnnotDefault(AnnotArgsType.AnnotFreehand);
|
|
|
- Freehand.ForgoundColor = color;
|
|
|
- Freehand.Opacity = (annot as FreehandAnnotArgs).Transparency;
|
|
|
- Freehand.Thickness = (annot as FreehandAnnotArgs).LineWidth;
|
|
|
+ var FreehandDefault = GetAnnotDefault(AnnotArgsType.AnnotFreehand);
|
|
|
+ FreehandDefault.ForgoundColor = color;
|
|
|
+ FreehandDefault.Opacity = freeHand.Transparency;
|
|
|
+ FreehandDefault.Thickness = freeHand.LineWidth;
|
|
|
+
|
|
|
+ var isSolid = AnnotPropertyPanel.IsSolidStyle(freeHand.LineDash);
|
|
|
+ if (isSolid)
|
|
|
+ {
|
|
|
+ FreehandDefault.DashArray = null;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ FreehandDefault.DashArray = new List<double>();
|
|
|
+ foreach (var item in freeHand.LineDash.Dashes)
|
|
|
+ {
|
|
|
+ FreehandDefault.DashArray.Add(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- SettingHelper.SetAnnotDefaultProperty(Freehand);
|
|
|
+ SettingHelper.SetAnnotDefaultProperty(FreehandDefault);
|
|
|
}
|
|
|
else if (annot is FreeTextAnnotArgs)
|
|
|
{
|
|
@@ -1166,42 +1260,94 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
Settings.Default.AppProperties.Annotate.NoteAnnoteColor = color;
|
|
|
var StickyDefalut = GetAnnotDefault(AnnotArgsType.AnnotSticky);
|
|
|
StickyDefalut.ForgoundColor = color;
|
|
|
+
|
|
|
SettingHelper.SetAnnotDefaultProperty(StickyDefalut);
|
|
|
}
|
|
|
else if (annot is SquareAnnotArgs)
|
|
|
{
|
|
|
- var bgColor = (annot as SquareAnnotArgs).BgColor;
|
|
|
+ var square = annot as SquareAnnotArgs;
|
|
|
+ var bgColor = square.BgColor;
|
|
|
Settings.Default.AppProperties.Annotate.RectangleFillColor = bgColor;
|
|
|
- var borderColor = (annot as SquareAnnotArgs).LineColor;
|
|
|
+ var borderColor = square.LineColor;
|
|
|
Settings.Default.AppProperties.Annotate.RectangleBorderColor = borderColor;
|
|
|
|
|
|
var SquareDefalut = GetAnnotDefault(AnnotArgsType.AnnotSquare);
|
|
|
SquareDefalut.BorderColor = borderColor;
|
|
|
SquareDefalut.BackgroundColor = bgColor;
|
|
|
- SquareDefalut.Opacity = (annot as SquareAnnotArgs).Transparency;
|
|
|
+ SquareDefalut.Opacity = square.Transparency;
|
|
|
+ SquareDefalut.Thickness = square.LineWidth;
|
|
|
+
|
|
|
+ var isSolid = AnnotPropertyPanel.IsSolidStyle(square.LineDash);
|
|
|
+ if (isSolid)
|
|
|
+ {
|
|
|
+ SquareDefalut.DashArray = null;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ SquareDefalut.DashArray = new List<double>();
|
|
|
+ foreach (var item in square.LineDash.Dashes)
|
|
|
+ {
|
|
|
+ SquareDefalut.DashArray.Add(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
SettingHelper.SetAnnotDefaultProperty(SquareDefalut);
|
|
|
}
|
|
|
else if (annot is CircleAnnotArgs)
|
|
|
{
|
|
|
- var bgColor = (annot as CircleAnnotArgs).BgColor;
|
|
|
+ var circle = annot as CircleAnnotArgs;
|
|
|
+ var bgColor = circle.BgColor;
|
|
|
Settings.Default.AppProperties.Annotate.CircleFillColor = bgColor;
|
|
|
- var borderColor = (annot as CircleAnnotArgs).LineColor;
|
|
|
+ var borderColor = circle.LineColor;
|
|
|
Settings.Default.AppProperties.Annotate.CircleBorderColor = borderColor;
|
|
|
|
|
|
var CircleDefalut = GetAnnotDefault(AnnotArgsType.AnnotCircle);
|
|
|
CircleDefalut.BorderColor = borderColor;
|
|
|
CircleDefalut.BackgroundColor = bgColor;
|
|
|
- CircleDefalut.Opacity = (annot as CircleAnnotArgs).Transparency;
|
|
|
+ CircleDefalut.Opacity = circle.Transparency;
|
|
|
+ CircleDefalut.Thickness = circle.LineWidth;
|
|
|
+
|
|
|
+ var isSolid = AnnotPropertyPanel.IsSolidStyle(circle.LineDash);
|
|
|
+ if (isSolid)
|
|
|
+ {
|
|
|
+ CircleDefalut.DashArray = null;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CircleDefalut.DashArray = new List<double>();
|
|
|
+ foreach (var item in circle.LineDash.Dashes)
|
|
|
+ {
|
|
|
+ CircleDefalut.DashArray.Add(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
SettingHelper.SetAnnotDefaultProperty(CircleDefalut);
|
|
|
}
|
|
|
else if (annot is LineAnnotArgs)
|
|
|
{
|
|
|
+ var line = (annot as LineAnnotArgs);
|
|
|
var color = (annot as LineAnnotArgs).LineColor;
|
|
|
Settings.Default.AppProperties.Annotate.LineColor = color;
|
|
|
|
|
|
var lineDefalut = GetAnnotDefault(AnnotArgsType.AnnotLine);
|
|
|
lineDefalut.BorderColor = color;
|
|
|
lineDefalut.Opacity = (annot as LineAnnotArgs).Transparency;
|
|
|
+ lineDefalut.Thickness = (annot as LineAnnotArgs).LineWidth;
|
|
|
+
|
|
|
+ var isSolid = AnnotPropertyPanel.IsSolidStyle(line.LineDash);
|
|
|
+ if (isSolid)
|
|
|
+ {
|
|
|
+ lineDefalut.DashArray = null;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ lineDefalut.DashArray = new List<double>();
|
|
|
+ foreach (var item in line.LineDash.Dashes)
|
|
|
+ {
|
|
|
+ lineDefalut.DashArray.Add(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
SettingHelper.SetAnnotDefaultProperty(lineDefalut);
|
|
|
}
|
|
|
|
|
@@ -1216,6 +1362,7 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
if (Annot == null)
|
|
|
{
|
|
|
Annot = new DefaultAnnotProperty();
|
|
|
+ Annot.AnnotToolType = annotArgsType;
|
|
|
}
|
|
|
return Annot;
|
|
|
}
|
|
@@ -1232,7 +1379,7 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
if (annot != null)
|
|
|
{
|
|
|
var item = new ColorDropBoxPop();
|
|
|
- item.DataContext = annot;
|
|
|
+ item.DataContext = menu;
|
|
|
item.ColorSelected -= AnnotMenu_ColorSelected;
|
|
|
item.ColorSelected += AnnotMenu_ColorSelected;
|
|
|
|
|
@@ -1283,7 +1430,10 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
{
|
|
|
if (sender != null)
|
|
|
{
|
|
|
- var annot = (sender as FrameworkElement).DataContext as AnnotHandlerEventArgs;
|
|
|
+ var menu = (sender as FrameworkElement).DataContext as CusMenuItem;
|
|
|
+ if (menu == null) return;
|
|
|
+
|
|
|
+ var annot = menu.Parameter as AnnotHandlerEventArgs;
|
|
|
if (annot != null)
|
|
|
{
|
|
|
if (annot is FreehandAnnotArgs || annot is StickyAnnotArgs || annot is LineAnnotArgs)
|
|
@@ -1295,13 +1445,21 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
else if (annot is FreeTextAnnotArgs)
|
|
|
{
|
|
|
var AnnotEvent = AnnotAttribEvent.GetAnnotAttribEvent(annot, annot.GetAnnotAttrib());
|
|
|
- AnnotEvent?.UpdateAttrib(AnnotAttrib.FontColor, e);
|
|
|
+ if (menu.tag.ToString() == "FontColor")
|
|
|
+ AnnotEvent?.UpdateAttrib(AnnotAttrib.FontColor, e);
|
|
|
+ else
|
|
|
+ AnnotEvent?.UpdateAttrib(AnnotAttrib.FillColor, e);
|
|
|
+
|
|
|
AnnotEvent?.UpdateAnnot();
|
|
|
}
|
|
|
else if (annot is SquareAnnotArgs || annot is CircleAnnotArgs)
|
|
|
{
|
|
|
var AnnotEvent = AnnotAttribEvent.GetAnnotAttribEvent(annot, annot.GetAnnotAttrib());
|
|
|
- AnnotEvent?.UpdateAttrib(AnnotAttrib.FillColor, e);
|
|
|
+ if (menu.tag.ToString() == "FillColor")
|
|
|
+ AnnotEvent?.UpdateAttrib(AnnotAttrib.FillColor, e);
|
|
|
+ else
|
|
|
+ AnnotEvent?.UpdateAttrib(AnnotAttrib.Color, e);
|
|
|
+
|
|
|
AnnotEvent?.UpdateAnnot();
|
|
|
}
|
|
|
else if (annot is TextHighlightAnnotArgs || annot is TextUnderlineAnnotArgs || annot is TextStrikeoutAnnotArgs)
|
|
@@ -1311,6 +1469,7 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
AnnotEvent?.UpdateAnnot();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1421,6 +1580,11 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
{
|
|
|
AnnotEvent?.UpdateAttrib(AnnotAttrib.TextAlign, TextAlignment.Right);
|
|
|
}
|
|
|
+ else if (strTag == "Justify")
|
|
|
+ {
|
|
|
+ AnnotEvent?.UpdateAttrib(AnnotAttrib.TextAlign, TextAlignment.Justify);
|
|
|
+ }
|
|
|
+
|
|
|
AnnotEvent?.UpdateAnnot();
|
|
|
}
|
|
|
}
|