|
@@ -271,11 +271,20 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
highlightArgs.Transparency = highLightOpacity;
|
|
|
highlightArgs.Color = (highLightColor as SolidColorBrush).Color;
|
|
|
|
|
|
- if (highlightArgs != null)
|
|
|
+ var defaultAnnot = SettingHelper.GetAnnotDefaultProperty(highlightArgs.EventType);
|
|
|
+ if (defaultAnnot == null)
|
|
|
{
|
|
|
- selectedArgs = new List<AnnotHandlerEventArgs>();
|
|
|
- selectedArgs.Add(highlightArgs);
|
|
|
+ defaultAnnot = new DefaultAnnotProperty();
|
|
|
+ defaultAnnot.AnnotToolType = highlightArgs.EventType;
|
|
|
+ defaultAnnot.ForgoundColor = (highLightColor as SolidColorBrush).Color;
|
|
|
+ defaultAnnot.Opacity = 1;
|
|
|
+ Settings.Default.Save();
|
|
|
}
|
|
|
+
|
|
|
+ highLightOpacity = highlightArgs.Transparency = defaultAnnot.Opacity;
|
|
|
+
|
|
|
+ selectedArgs = new List<AnnotHandlerEventArgs>();
|
|
|
+ selectedArgs.Add(highlightArgs);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -328,11 +337,20 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
underlineArgs.Transparency = UnderLineOpacity;
|
|
|
underlineArgs.Color = (UnderLineColor as SolidColorBrush).Color;
|
|
|
|
|
|
- if (underlineArgs != null)
|
|
|
+ var defaultAnnot = SettingHelper.GetAnnotDefaultProperty(underlineArgs.EventType);
|
|
|
+ if (defaultAnnot == null)
|
|
|
{
|
|
|
- selectedArgs = new List<AnnotHandlerEventArgs>();
|
|
|
- selectedArgs.Add(underlineArgs);
|
|
|
+ defaultAnnot = new DefaultAnnotProperty();
|
|
|
+ defaultAnnot.AnnotToolType = underlineArgs.EventType;
|
|
|
+ defaultAnnot.ForgoundColor = (UnderLineColor as SolidColorBrush).Color;
|
|
|
+ defaultAnnot.Opacity = 1;
|
|
|
+ Settings.Default.Save();
|
|
|
}
|
|
|
+
|
|
|
+ UnderLineOpacity = underlineArgs.Transparency = defaultAnnot.Opacity;
|
|
|
+
|
|
|
+ selectedArgs = new List<AnnotHandlerEventArgs>();
|
|
|
+ selectedArgs.Add(underlineArgs);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -358,11 +376,21 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
squigglyArgs.Transparency = SquigglyOpacity;
|
|
|
squigglyArgs.Color = (squigglyColor as SolidColorBrush).Color;
|
|
|
|
|
|
- if (squigglyArgs != null)
|
|
|
+ var defaultAnnot = SettingHelper.GetAnnotDefaultProperty(squigglyArgs.EventType);
|
|
|
+ if (defaultAnnot == null)
|
|
|
{
|
|
|
- selectedArgs = new List<AnnotHandlerEventArgs>();
|
|
|
- selectedArgs.Add(squigglyArgs);
|
|
|
+ defaultAnnot = new DefaultAnnotProperty();
|
|
|
+ defaultAnnot.AnnotToolType = squigglyArgs.EventType;
|
|
|
+ defaultAnnot.ForgoundColor = (squigglyColor as SolidColorBrush).Color;
|
|
|
+ defaultAnnot.Opacity = 1;
|
|
|
+ Settings.Default.Save();
|
|
|
}
|
|
|
+
|
|
|
+ SquigglyOpacity = squigglyArgs.Transparency = defaultAnnot.Opacity;
|
|
|
+
|
|
|
+
|
|
|
+ selectedArgs = new List<AnnotHandlerEventArgs>();
|
|
|
+ selectedArgs.Add(squigglyArgs);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -388,11 +416,20 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
strikeoutArgs.Transparency = strikeoutOpacity;
|
|
|
strikeoutArgs.Color = (strikeoutColor as SolidColorBrush).Color;
|
|
|
|
|
|
- if (strikeoutArgs != null)
|
|
|
+ var defaultAnnot = SettingHelper.GetAnnotDefaultProperty(strikeoutArgs.EventType);
|
|
|
+ if (defaultAnnot == null)
|
|
|
{
|
|
|
- selectedArgs = new List<AnnotHandlerEventArgs>();
|
|
|
- selectedArgs.Add(strikeoutArgs);
|
|
|
+ defaultAnnot = new DefaultAnnotProperty();
|
|
|
+ defaultAnnot.AnnotToolType = strikeoutArgs.EventType;
|
|
|
+ defaultAnnot.ForgoundColor = (strikeoutColor as SolidColorBrush).Color;
|
|
|
+ defaultAnnot.Opacity = 1;
|
|
|
+ Settings.Default.Save();
|
|
|
}
|
|
|
+
|
|
|
+ strikeoutArgs.Transparency = defaultAnnot.Opacity;
|
|
|
+
|
|
|
+ selectedArgs = new List<AnnotHandlerEventArgs>();
|
|
|
+ selectedArgs.Add(strikeoutArgs);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -425,14 +462,35 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
freehandArgs.InkColor = Color.FromRgb(0x38, 0xE0, 0x2E);
|
|
|
}
|
|
|
|
|
|
- freehandArgs.Transparency = 1;
|
|
|
- freehandArgs.LineWidth = 2;
|
|
|
+ var defaultAnnot = SettingHelper.GetAnnotDefaultProperty(freehandArgs.EventType);
|
|
|
+ if (defaultAnnot == null)
|
|
|
+ {
|
|
|
+ defaultAnnot = new DefaultAnnotProperty();
|
|
|
+ defaultAnnot.AnnotToolType = freehandArgs.EventType;
|
|
|
+ defaultAnnot.ForgoundColor = annotate.FreeHandColor;
|
|
|
+ defaultAnnot.Opacity = 1;
|
|
|
+ Settings.Default.Save();
|
|
|
+ }
|
|
|
+
|
|
|
+ freehandArgs.Transparency = defaultAnnot.Opacity;
|
|
|
+ freehandArgs.LineWidth = defaultAnnot.Thickness;
|
|
|
|
|
|
- if (freehandArgs != null)
|
|
|
+ if (defaultAnnot.DashArray == null || defaultAnnot.DashArray.Count == 0)
|
|
|
{
|
|
|
- selectedArgs = new List<AnnotHandlerEventArgs>();
|
|
|
- selectedArgs.Add(freehandArgs);
|
|
|
+ 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);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -467,15 +525,34 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
freetextArgs.FontColor = Colors.Black;
|
|
|
}
|
|
|
|
|
|
- freetextArgs.Align = TextAlignment.Left;
|
|
|
- freetextArgs.BgColor = Colors.Transparent;
|
|
|
- freetextArgs.FontFamily = new FontFamily(Settings.Default.AppProperties.Annotate.TextFontFamaily);
|
|
|
- freetextArgs.FontColor = Colors.Black;
|
|
|
- freetextArgs.FontSize = 14;
|
|
|
- freetextArgs.Transparency = 1;
|
|
|
- freetextArgs.LineColor = Colors.Black;
|
|
|
- freetextArgs.LineWidth = 0;
|
|
|
- freetextArgs.TextContent = string.Empty;
|
|
|
+ var defaultAnnot = SettingHelper.GetAnnotDefaultProperty(freetextArgs.EventType);
|
|
|
+ if (defaultAnnot == null)
|
|
|
+ {
|
|
|
+ defaultAnnot = new DefaultAnnotProperty();
|
|
|
+ defaultAnnot.AnnotToolType = freetextArgs.EventType;
|
|
|
+ defaultAnnot.ForgoundColor = freetextArgs.FontColor;
|
|
|
+ defaultAnnot.BorderColor = Colors.Transparent;
|
|
|
+ defaultAnnot.BackgroundColor = Colors.Transparent;
|
|
|
+ defaultAnnot.Opacity = 1;
|
|
|
+ defaultAnnot.FontFamily = Settings.Default.AppProperties.Annotate.TextFontFamaily;
|
|
|
+ defaultAnnot.FontSize = 14;
|
|
|
+ defaultAnnot.TextAlign = TextAlignment.Left;
|
|
|
+ defaultAnnot.Thickness = 0;
|
|
|
+ defaultAnnot.NoteText = string.Empty;
|
|
|
+
|
|
|
+ Settings.Default.Save();
|
|
|
+ }
|
|
|
+
|
|
|
+ freetextArgs.FontColor = defaultAnnot.ForgoundColor;
|
|
|
+ freetextArgs.LineColor = defaultAnnot.BorderColor;
|
|
|
+ freetextArgs.BgColor = defaultAnnot.BackgroundColor;
|
|
|
+ freetextArgs.Transparency = defaultAnnot.Opacity;
|
|
|
+ freetextArgs.FontFamily = new FontFamily(defaultAnnot.FontFamily);
|
|
|
+ freetextArgs.FontSize = defaultAnnot.FontSize;
|
|
|
+ freetextArgs.FontWeight = defaultAnnot.FontWeight;
|
|
|
+ freetextArgs.FontStyle = defaultAnnot.FontStyle;
|
|
|
+ freetextArgs.LineWidth = defaultAnnot.Thickness;
|
|
|
+
|
|
|
|
|
|
int align = (int)Settings.Default.AppProperties.Annotate.TextAlign;
|
|
|
|
|
@@ -486,6 +563,8 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
else
|
|
|
textAlignment = TextAlignment.Right;
|
|
|
|
|
|
+ freetextArgs.Align = textAlignment;
|
|
|
+
|
|
|
if (freetextArgs != null)
|
|
|
{
|
|
|
selectedArgs = new List<AnnotHandlerEventArgs>();
|
|
@@ -522,8 +601,18 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
{
|
|
|
stickyAnnotArgs.Color = Color.FromRgb(0xFF, 0x81, 0x33);
|
|
|
}
|
|
|
- stickyAnnotArgs.StickyNote = string.Empty;
|
|
|
- stickyAnnotArgs.Transparency = 1;
|
|
|
+
|
|
|
+ var defaultAnnot = SettingHelper.GetAnnotDefaultProperty(stickyAnnotArgs.EventType);
|
|
|
+ if (defaultAnnot == null)
|
|
|
+ {
|
|
|
+ defaultAnnot = new DefaultAnnotProperty();
|
|
|
+ defaultAnnot.AnnotToolType = stickyAnnotArgs.EventType;
|
|
|
+ defaultAnnot.NoteText = string.Empty;
|
|
|
+ defaultAnnot.Opacity = 1;
|
|
|
+ Settings.Default.Save();
|
|
|
+ }
|
|
|
+
|
|
|
+ stickyAnnotArgs.Transparency = defaultAnnot.Opacity;
|
|
|
|
|
|
if (stickyAnnotArgs != null)
|
|
|
{
|
|
@@ -568,10 +657,33 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
squareArgs.BgColor = Colors.Red;
|
|
|
}
|
|
|
|
|
|
- squareArgs.LineWidth = 1;
|
|
|
- squareArgs.Transparency = 1;
|
|
|
- squareArgs.LineDash = DashStyles.Solid;
|
|
|
- squareArgs.Content = string.Empty;
|
|
|
+ var defaultAnnot = SettingHelper.GetAnnotDefaultProperty(squareArgs.EventType);
|
|
|
+ if (defaultAnnot == null)
|
|
|
+ {
|
|
|
+ defaultAnnot = new DefaultAnnotProperty();
|
|
|
+ defaultAnnot.AnnotToolType = squareArgs.EventType;
|
|
|
+ defaultAnnot.Thickness = 1;
|
|
|
+ defaultAnnot.Opacity = 1;
|
|
|
+ Settings.Default.Save();
|
|
|
+ }
|
|
|
+
|
|
|
+ squareArgs.LineWidth = defaultAnnot.Thickness;
|
|
|
+ squareArgs.Transparency = defaultAnnot.Opacity;
|
|
|
+
|
|
|
+ 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)
|
|
|
{
|
|
|
selectedArgs = new List<AnnotHandlerEventArgs>();
|
|
@@ -611,10 +723,35 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
circleAnnotArgs.BgColor = Colors.Red;
|
|
|
}
|
|
|
|
|
|
- circleAnnotArgs.LineWidth = 1;
|
|
|
- circleAnnotArgs.Transparency = 1;
|
|
|
- circleAnnotArgs.LineDash = DashStyles.Solid;
|
|
|
- circleAnnotArgs.Content = string.Empty;
|
|
|
+ var defaultAnnot = SettingHelper.GetAnnotDefaultProperty(circleAnnotArgs.EventType);
|
|
|
+ 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;
|
|
|
+
|
|
|
+ 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)
|
|
|
{
|
|
@@ -662,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)
|
|
|
{
|
|
@@ -1011,25 +1175,66 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
if (annot is TextHighlightAnnotArgs)
|
|
|
{
|
|
|
var color = (annot as TextHighlightAnnotArgs).Color;
|
|
|
- Settings.Default.AppProperties.Annotate.HighLightColor = color;
|
|
|
HighLightColor = new SolidColorBrush(color);
|
|
|
+
|
|
|
+ Settings.Default.AppProperties.Annotate.HighLightColor = color;
|
|
|
+
|
|
|
+ var hightlight = GetAnnotDefault(AnnotArgsType.AnnotHighlight);
|
|
|
+ hightlight.ForgoundColor = color;
|
|
|
+ hightlight.Opacity = (annot as TextHighlightAnnotArgs).Transparency;
|
|
|
+ SettingHelper.SetAnnotDefaultProperty(hightlight);
|
|
|
}
|
|
|
else if (annot is TextUnderlineAnnotArgs)
|
|
|
{
|
|
|
- var color = (annot as TextHighlightAnnotArgs).Color;
|
|
|
- Settings.Default.AppProperties.Annotate.UnderLineColor = color;
|
|
|
+ var color = (annot as TextUnderlineAnnotArgs).Color;
|
|
|
UnderLineColor = new SolidColorBrush(color);
|
|
|
+
|
|
|
+ Settings.Default.AppProperties.Annotate.UnderLineColor = color;
|
|
|
+
|
|
|
+ var Underline = GetAnnotDefault(AnnotArgsType.AnnotUnderline);
|
|
|
+ Underline.ForgoundColor = color;
|
|
|
+ Underline.Opacity = (annot as TextUnderlineAnnotArgs).Transparency;
|
|
|
+ SettingHelper.SetAnnotDefaultProperty(Underline);
|
|
|
}
|
|
|
else if (annot is TextStrikeoutAnnotArgs)
|
|
|
{
|
|
|
- var color = (annot as TextHighlightAnnotArgs).Color;
|
|
|
- Settings.Default.AppProperties.Annotate.StrikethroughColor = color;
|
|
|
+ var color = (annot as TextStrikeoutAnnotArgs).Color;
|
|
|
StrikeoutColor = new SolidColorBrush(color);
|
|
|
+
|
|
|
+ Settings.Default.AppProperties.Annotate.StrikethroughColor = color;
|
|
|
+
|
|
|
+ var Strikeout = GetAnnotDefault(AnnotArgsType.AnnotStrikeout);
|
|
|
+ Strikeout.ForgoundColor = color;
|
|
|
+ Strikeout.Opacity = (annot as TextStrikeoutAnnotArgs).Transparency;
|
|
|
+ SettingHelper.SetAnnotDefaultProperty(Strikeout);
|
|
|
}
|
|
|
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 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(FreehandDefault);
|
|
|
}
|
|
|
else if (annot is FreeTextAnnotArgs)
|
|
|
{
|
|
@@ -1037,30 +1242,113 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
Settings.Default.AppProperties.Annotate.TextAnnoteColor = freeText.FontColor;
|
|
|
Settings.Default.AppProperties.Annotate.TextFontFamaily = freeText.FontFamily.ToString();
|
|
|
Settings.Default.AppProperties.Annotate.TextAlign = freeText.Align;
|
|
|
+
|
|
|
+ var FreeTextDefalut = GetAnnotDefault(AnnotArgsType.AnnotFreeText);
|
|
|
+ FreeTextDefalut.ForgoundColor = freeText.FontColor;
|
|
|
+ FreeTextDefalut.FontFamily = freeText.FontFamily.ToString();
|
|
|
+ FreeTextDefalut.TextAlign = freeText.Align;
|
|
|
+ FreeTextDefalut.FontSize = freeText.FontSize;
|
|
|
+ FreeTextDefalut.FontWeight = freeText.FontWeight;
|
|
|
+ FreeTextDefalut.FontStyle = freeText.FontStyle;
|
|
|
+ FreeTextDefalut.BackgroundColor = freeText.BgColor;
|
|
|
+ FreeTextDefalut.Opacity = (annot as FreeTextAnnotArgs).Transparency;
|
|
|
+ SettingHelper.SetAnnotDefaultProperty(FreeTextDefalut);
|
|
|
}
|
|
|
else if (annot is StickyAnnotArgs)
|
|
|
{
|
|
|
var color = (annot as StickyAnnotArgs).Color;
|
|
|
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 = 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 = 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);
|
|
|
}
|
|
|
|
|
|
Settings.Default.Save();
|
|
@@ -1068,6 +1356,17 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private DefaultAnnotProperty GetAnnotDefault(AnnotArgsType annotArgsType)
|
|
|
+ {
|
|
|
+ var Annot = SettingHelper.GetAnnotDefaultProperty(annotArgsType);
|
|
|
+ if (Annot == null)
|
|
|
+ {
|
|
|
+ Annot = new DefaultAnnotProperty();
|
|
|
+ Annot.AnnotToolType = annotArgsType;
|
|
|
+ }
|
|
|
+ return Annot;
|
|
|
+ }
|
|
|
+
|
|
|
private System.Windows.Controls.Primitives.Popup popup = null;
|
|
|
|
|
|
//更改颜色
|
|
@@ -1080,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;
|
|
|
|
|
@@ -1131,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)
|
|
@@ -1143,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)
|
|
@@ -1159,6 +1469,7 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
AnnotEvent?.UpdateAnnot();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1269,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();
|
|
|
}
|
|
|
}
|