|
@@ -1098,45 +1098,75 @@ namespace PDF_Master.ViewModels.Tools
|
|
|
var annot = menu.Parameter as AnnotHandlerEventArgs;
|
|
|
if (annot != null)
|
|
|
{
|
|
|
- if (annot is TextHighlightAnnotArgs)
|
|
|
+ if (annot is TextHighlightAnnotArgs textHighlight)
|
|
|
{
|
|
|
- var color = (annot as TextHighlightAnnotArgs).Color;
|
|
|
+ var color = textHighlight.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;
|
|
|
+ hightlight.Opacity = textHighlight.Transparency;
|
|
|
SettingHelper.SetAnnotDefaultProperty(hightlight);
|
|
|
+
|
|
|
+ if (StrAnnotToolChecked == "HighLight")
|
|
|
+ {
|
|
|
+ TextHighlightAnnotArgs annotArgs = new TextHighlightAnnotArgs()
|
|
|
+ {
|
|
|
+ Color = textHighlight.Color,
|
|
|
+ Transparency = textHighlight.Transparency
|
|
|
+ };
|
|
|
+ PDFViewer.SetToolParam(annotArgs);
|
|
|
+ }
|
|
|
}
|
|
|
- else if (annot is TextUnderlineAnnotArgs)
|
|
|
+ else if (annot is TextUnderlineAnnotArgs textUnderline)
|
|
|
{
|
|
|
- var color = (annot as TextUnderlineAnnotArgs).Color;
|
|
|
+ var color = textUnderline.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;
|
|
|
+ Underline.Opacity = textUnderline.Transparency;
|
|
|
SettingHelper.SetAnnotDefaultProperty(Underline);
|
|
|
+
|
|
|
+ if (StrAnnotToolChecked == "UnderLine")
|
|
|
+ {
|
|
|
+ TextUnderlineAnnotArgs annotArgs = new TextUnderlineAnnotArgs()
|
|
|
+ {
|
|
|
+ Color = textUnderline.Color,
|
|
|
+ Transparency = textUnderline.Transparency
|
|
|
+ };
|
|
|
+ PDFViewer.SetToolParam(annotArgs);
|
|
|
+ }
|
|
|
}
|
|
|
- else if (annot is TextStrikeoutAnnotArgs)
|
|
|
+ else if (annot is TextStrikeoutAnnotArgs textStrikeout)
|
|
|
{
|
|
|
- var color = (annot as TextStrikeoutAnnotArgs).Color;
|
|
|
+ var color = textStrikeout.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);
|
|
|
+ Strikeout.Opacity = textStrikeout.Transparency;
|
|
|
+ SettingHelper.SetAnnotDefaultProperty(Strikeout);
|
|
|
+
|
|
|
+ if (StrAnnotToolChecked == "Strikeout")
|
|
|
+ {
|
|
|
+ TextStrikeoutAnnotArgs annotArgs = new TextStrikeoutAnnotArgs()
|
|
|
+ {
|
|
|
+ Color = textStrikeout.Color,
|
|
|
+ Transparency = textStrikeout.Transparency
|
|
|
+ };
|
|
|
+ PDFViewer.SetToolParam(annotArgs);
|
|
|
+ }
|
|
|
}
|
|
|
- else if (annot is FreehandAnnotArgs)
|
|
|
+ else if (annot is FreehandAnnotArgs freeHand)
|
|
|
{
|
|
|
- var freeHand = annot as FreehandAnnotArgs;
|
|
|
+ //var freeHand = annot as FreehandAnnotArgs;
|
|
|
var color = freeHand.InkColor;
|
|
|
|
|
|
Settings.Default.AppProperties.Annotate.FreeHandColor = color;
|
|
@@ -1162,15 +1192,18 @@ namespace PDF_Master.ViewModels.Tools
|
|
|
|
|
|
SettingHelper.SetAnnotDefaultProperty(FreehandDefault);
|
|
|
|
|
|
- FreehandAnnotArgs annotArgs = new FreehandAnnotArgs()
|
|
|
- {
|
|
|
- InkColor = freeHand.InkColor,
|
|
|
- Transparency = freeHand.Transparency,
|
|
|
- LineWidth = freeHand.LineWidth,
|
|
|
- LineDash = freeHand.LineDash
|
|
|
- };
|
|
|
-
|
|
|
- PDFViewer.SetToolParam(annotArgs);
|
|
|
+ if (StrAnnotToolChecked == "Freehand")
|
|
|
+ {
|
|
|
+ FreehandAnnotArgs annotArgs = new FreehandAnnotArgs()
|
|
|
+ {
|
|
|
+ InkColor = freeHand.InkColor,
|
|
|
+ Transparency = freeHand.Transparency,
|
|
|
+ LineWidth = freeHand.LineWidth,
|
|
|
+ LineDash = freeHand.LineDash
|
|
|
+ };
|
|
|
+
|
|
|
+ PDFViewer.SetToolParam(annotArgs);
|
|
|
+ }
|
|
|
}
|
|
|
else if (annot is FreeTextAnnotArgs freeText)
|
|
|
{
|
|
@@ -1189,44 +1222,58 @@ namespace PDF_Master.ViewModels.Tools
|
|
|
FreeTextDefalut.BackgroundColor = freeText.BgColor;
|
|
|
FreeTextDefalut.Opacity = (annot as FreeTextAnnotArgs).Transparency;
|
|
|
SettingHelper.SetAnnotDefaultProperty(FreeTextDefalut);
|
|
|
- //FreeTextAnnotArgs freeTextAnnotArgs = new FreeTextAnnotArgs()
|
|
|
- //{
|
|
|
- // FontColor = freeText.FontColor,
|
|
|
- // FontFamily = freeText.FontFamily,
|
|
|
- // Align = freeText.Align,
|
|
|
- // FontSize = freeText.FontSize,
|
|
|
- // FontWeight = freeText.FontWeight,
|
|
|
- // FontStyle = freeText.FontStyle,
|
|
|
- // BgColor = freeText.BgColor,
|
|
|
- // Transparency = (annot as FreeTextAnnotArgs).Transparency
|
|
|
- //};
|
|
|
-
|
|
|
- //PDFViewer.SetToolParam(freeTextAnnotArgs);
|
|
|
+
|
|
|
+ if (StrAnnotToolChecked == "Freetext")
|
|
|
+ {
|
|
|
+ FreeTextAnnotArgs freeTextAnnotArgs = new FreeTextAnnotArgs()
|
|
|
+ {
|
|
|
+ FontColor = freeText.FontColor,
|
|
|
+ FontFamily = freeText.FontFamily,
|
|
|
+ Align = freeText.Align,
|
|
|
+ FontSize = freeText.FontSize,
|
|
|
+ FontWeight = freeText.FontWeight,
|
|
|
+ FontStyle = freeText.FontStyle,
|
|
|
+ BgColor = freeText.BgColor,
|
|
|
+ Transparency = (annot as FreeTextAnnotArgs).Transparency
|
|
|
+ };
|
|
|
+
|
|
|
+ PDFViewer.SetToolParam(freeTextAnnotArgs);
|
|
|
+ }
|
|
|
}
|
|
|
- else if (annot is StickyAnnotArgs)
|
|
|
+ else if (annot is StickyAnnotArgs stickyAnnotArgs)
|
|
|
{
|
|
|
- var color = (annot as StickyAnnotArgs).Color;
|
|
|
+ var color = stickyAnnotArgs.Color;
|
|
|
Settings.Default.AppProperties.Annotate.NoteAnnoteColor = color;
|
|
|
var StickyDefalut = GetAnnotDefault(AnnotArgsType.AnnotSticky);
|
|
|
StickyDefalut.ForgoundColor = color;
|
|
|
|
|
|
SettingHelper.SetAnnotDefaultProperty(StickyDefalut);
|
|
|
+
|
|
|
+ if (StrAnnotToolChecked == "StickyNote")
|
|
|
+ {
|
|
|
+ StickyAnnotArgs annotArgs = new StickyAnnotArgs()
|
|
|
+ {
|
|
|
+ Color = stickyAnnotArgs.Color
|
|
|
+ };
|
|
|
+
|
|
|
+ PDFViewer.SetToolParam(annotArgs);
|
|
|
+ }
|
|
|
}
|
|
|
- else if (annot is SquareAnnotArgs)
|
|
|
+ else if (annot is SquareAnnotArgs squareAnnot)
|
|
|
{
|
|
|
- var square = annot as SquareAnnotArgs;
|
|
|
- var bgColor = square.BgColor;
|
|
|
+ //var square = annot as SquareAnnotArgs;
|
|
|
+ var bgColor = squareAnnot.BgColor;
|
|
|
Settings.Default.AppProperties.Annotate.RectangleFillColor = bgColor;
|
|
|
- var borderColor = square.LineColor;
|
|
|
+ var borderColor = squareAnnot.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;
|
|
|
+ SquareDefalut.Opacity = squareAnnot.Transparency;
|
|
|
+ SquareDefalut.Thickness = squareAnnot.LineWidth;
|
|
|
|
|
|
- var isSolid = AnnotTransfer.IsSolidStyle(square.LineDash);
|
|
|
+ var isSolid = AnnotTransfer.IsSolidStyle(squareAnnot.LineDash);
|
|
|
if (isSolid)
|
|
|
{
|
|
|
SquareDefalut.DashArray = null;
|
|
@@ -1234,29 +1281,42 @@ namespace PDF_Master.ViewModels.Tools
|
|
|
else
|
|
|
{
|
|
|
SquareDefalut.DashArray = new List<double>();
|
|
|
- foreach (var item in square.LineDash.Dashes)
|
|
|
+ foreach (var item in squareAnnot.LineDash.Dashes)
|
|
|
{
|
|
|
SquareDefalut.DashArray.Add(item);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
SettingHelper.SetAnnotDefaultProperty(SquareDefalut);
|
|
|
+
|
|
|
+ if (PropertyPanel.SharpsAnnot == "Rect" && StrAnnotToolChecked == "Rect")
|
|
|
+ {
|
|
|
+ SquareAnnotArgs annotArgs = new SquareAnnotArgs()
|
|
|
+ {
|
|
|
+ BgColor = squareAnnot.BgColor,
|
|
|
+ LineColor = squareAnnot.LineColor,
|
|
|
+ Transparency = squareAnnot.Transparency,
|
|
|
+ LineWidth = squareAnnot.LineWidth,
|
|
|
+ LineDash = squareAnnot.LineDash
|
|
|
+ };
|
|
|
+ PDFViewer.SetToolParam(annotArgs);
|
|
|
+ }
|
|
|
}
|
|
|
- else if (annot is CircleAnnotArgs)
|
|
|
+ else if (annot is CircleAnnotArgs circleAnnot)
|
|
|
{
|
|
|
- var circle = annot as CircleAnnotArgs;
|
|
|
- var bgColor = circle.BgColor;
|
|
|
+ //var circle = annot as CircleAnnotArgs;
|
|
|
+ var bgColor = circleAnnot.BgColor;
|
|
|
Settings.Default.AppProperties.Annotate.CircleFillColor = bgColor;
|
|
|
- var borderColor = circle.LineColor;
|
|
|
+ var borderColor = circleAnnot.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;
|
|
|
+ CircleDefalut.Opacity = circleAnnot.Transparency;
|
|
|
+ CircleDefalut.Thickness = circleAnnot.LineWidth;
|
|
|
|
|
|
- var isSolid = AnnotTransfer.IsSolidStyle(circle.LineDash);
|
|
|
+ var isSolid = AnnotTransfer.IsSolidStyle(circleAnnot.LineDash);
|
|
|
if (isSolid)
|
|
|
{
|
|
|
CircleDefalut.DashArray = null;
|
|
@@ -1264,13 +1324,26 @@ namespace PDF_Master.ViewModels.Tools
|
|
|
else
|
|
|
{
|
|
|
CircleDefalut.DashArray = new List<double>();
|
|
|
- foreach (var item in circle.LineDash.Dashes)
|
|
|
+ foreach (var item in circleAnnot.LineDash.Dashes)
|
|
|
{
|
|
|
CircleDefalut.DashArray.Add(item);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- SettingHelper.SetAnnotDefaultProperty(CircleDefalut);
|
|
|
+ SettingHelper.SetAnnotDefaultProperty(CircleDefalut);
|
|
|
+
|
|
|
+ if (PropertyPanel.SharpsAnnot == "Circle" && StrAnnotToolChecked == "Rect")
|
|
|
+ {
|
|
|
+ CircleAnnotArgs annotArgs = new CircleAnnotArgs()
|
|
|
+ {
|
|
|
+ BgColor = circleAnnot.BgColor,
|
|
|
+ LineColor = circleAnnot.LineColor,
|
|
|
+ Transparency = circleAnnot.Transparency,
|
|
|
+ LineWidth = circleAnnot.LineWidth,
|
|
|
+ LineDash = circleAnnot.LineDash
|
|
|
+ };
|
|
|
+ PDFViewer.SetToolParam(annotArgs);
|
|
|
+ }
|
|
|
}
|
|
|
else if (annot is LineAnnotArgs lineAnnotArgs)
|
|
|
{
|
|
@@ -1281,11 +1354,38 @@ namespace PDF_Master.ViewModels.Tools
|
|
|
{
|
|
|
Settings.Default.AppProperties.Annotate.ArrowColor = color;
|
|
|
lineDefalut.HeadLineType = lineAnnotArgs.HeadLineType;
|
|
|
- lineDefalut.TailLineType = lineAnnotArgs.TailLineType;
|
|
|
+ lineDefalut.TailLineType = lineAnnotArgs.TailLineType;
|
|
|
+
|
|
|
+ if (PropertyPanel.SharpsAnnot == "Arrow" && StrAnnotToolChecked == "Rect")
|
|
|
+ {
|
|
|
+ LineAnnotArgs annotArgs = new LineAnnotArgs()
|
|
|
+ {
|
|
|
+ LineColor = lineAnnotArgs.LineColor,
|
|
|
+ Transparency = lineAnnotArgs.Transparency,
|
|
|
+ LineWidth = lineAnnotArgs.LineWidth,
|
|
|
+ LineDash = lineAnnotArgs.LineDash,
|
|
|
+ HeadLineType = lineAnnotArgs.HeadLineType,
|
|
|
+ TailLineType = lineAnnotArgs.TailLineType
|
|
|
+ };
|
|
|
+ PDFViewer.SetToolParam(annotArgs);
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- Settings.Default.AppProperties.Annotate.LineColor = color;
|
|
|
+ Settings.Default.AppProperties.Annotate.LineColor = color;
|
|
|
+ if (PropertyPanel.SharpsAnnot == "Line" && StrAnnotToolChecked == "Rect")
|
|
|
+ {
|
|
|
+ LineAnnotArgs annotArgs = new LineAnnotArgs()
|
|
|
+ {
|
|
|
+ LineColor = lineAnnotArgs.LineColor,
|
|
|
+ Transparency = lineAnnotArgs.Transparency,
|
|
|
+ LineWidth = lineAnnotArgs.LineWidth,
|
|
|
+ LineDash = lineAnnotArgs.LineDash,
|
|
|
+ HeadLineType = lineAnnotArgs.HeadLineType,
|
|
|
+ TailLineType = lineAnnotArgs.TailLineType
|
|
|
+ };
|
|
|
+ PDFViewer.SetToolParam(annotArgs);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
lineDefalut.BorderColor = color;
|
|
@@ -1307,6 +1407,20 @@ namespace PDF_Master.ViewModels.Tools
|
|
|
}
|
|
|
|
|
|
SettingHelper.SetAnnotDefaultProperty(lineDefalut);
|
|
|
+
|
|
|
+ //if ((PropertyPanel.SharpsAnnot == "Arrow" || PropertyPanel.SharpsAnnot == "Line") && StrAnnotToolChecked == "Rect")
|
|
|
+ //{
|
|
|
+ // LineAnnotArgs annotArgs = new LineAnnotArgs()
|
|
|
+ // {
|
|
|
+ // LineColor = lineAnnotArgs.LineColor,
|
|
|
+ // Transparency = lineAnnotArgs.Transparency,
|
|
|
+ // LineWidth = lineAnnotArgs.LineWidth,
|
|
|
+ // LineDash = lineAnnotArgs.LineDash,
|
|
|
+ // HeadLineType = lineAnnotArgs.HeadLineType,
|
|
|
+ // TailLineType = lineAnnotArgs.TailLineType
|
|
|
+ // };
|
|
|
+ // PDFViewer.SetToolParam(annotArgs);
|
|
|
+ //}
|
|
|
}
|
|
|
|
|
|
Settings.Default.Save();
|