|
@@ -335,8 +335,7 @@ namespace PDF_Master.ViewModels.Tools
|
|
|
viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
|
|
|
|
|
|
|
|
|
- }
|
|
|
-
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -374,29 +373,26 @@ namespace PDF_Master.ViewModels.Tools
|
|
|
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
- if (!string.IsNullOrWhiteSpace(StrAnnotToolChecked))
|
|
|
+ PropertyPanel.annot = null;
|
|
|
+ PropertyPanel.AnnotEvents = null;
|
|
|
+ PropertyPanel.AnnotEvent = null;
|
|
|
+ PropertyPanel.annotlists = null;
|
|
|
+
|
|
|
+
|
|
|
+ if (string.IsNullOrWhiteSpace(StrAnnotToolChecked))
|
|
|
+ {
|
|
|
+ viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
- PropertyPanel.annot = null;
|
|
|
- PropertyPanel.AnnotEvents = null;
|
|
|
- PropertyPanel.AnnotEvent = null;
|
|
|
- PropertyPanel.annotlists = null;
|
|
|
if (StrAnnotToolChecked != "Stamp" && StrAnnotToolChecked != "Freetext")
|
|
|
{
|
|
|
AnnotHandlerEventArgs annotArgs = null;
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
return;
|
|
|
}
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- PropertyPanel.annot = null;
|
|
|
- PropertyPanel.AnnotEvents = null;
|
|
|
- PropertyPanel.AnnotEvent = null;
|
|
|
- PropertyPanel.annotlists = null;
|
|
|
- viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
@@ -405,7 +401,8 @@ namespace PDF_Master.ViewModels.Tools
|
|
|
{
|
|
|
if (e.IsMouseRightActive)
|
|
|
{
|
|
|
- ShowPropertyPanel(false);
|
|
|
+ if (string.IsNullOrEmpty(StrAnnotToolChecked))
|
|
|
+ ShowPropertyPanel(false);
|
|
|
return;
|
|
|
}
|
|
|
CurrentSelectedAnnot = null;
|
|
@@ -441,8 +438,21 @@ namespace PDF_Master.ViewModels.Tools
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- GetSelectedAnnots(e);
|
|
|
- PDFViewer.SetToolParam(annot);
|
|
|
+ if (!string.IsNullOrEmpty(StrAnnotToolChecked))
|
|
|
+ {
|
|
|
+ GetSelectedAnnots(e);
|
|
|
+ PDFViewer.SetToolParam(annot);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ PropertyPanel.annot = null;
|
|
|
+ PropertyPanel.AnnotEvents = null;
|
|
|
+ PropertyPanel.AnnotEvent = null;
|
|
|
+ PropertyPanel.annotlists = null;
|
|
|
+ PDFViewer.SetMouseMode(MouseModes.PanTool);
|
|
|
+ HandToolIsCheckedEvent(false);
|
|
|
+ viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
@@ -944,45 +954,53 @@ namespace PDF_Master.ViewModels.Tools
|
|
|
private void PDFViewer_AnnotEditHandler(object sender, List<AnnotEditEvent> e)
|
|
|
{
|
|
|
bool isTabItemAnnotation = IsBOTATabItemShow(out BOTAContentViewModel bOTAContentViewModel, out BOTAContent bOTAContent, "TabItemAnnotation");
|
|
|
-
|
|
|
+ AnnotationContentViewModel viewModel = null;
|
|
|
+ AnnotationContent annotation = null;
|
|
|
+ if (viewContentViewModel.OpenBOTA == true && bOTAContent.TabItemAnnotation.IsSelected)
|
|
|
+ {
|
|
|
+ viewModel = GetAnnotationContentViewModel(bOTAContentViewModel, out annotation);
|
|
|
+ }
|
|
|
+ bool isMultiple = false;
|
|
|
+ Dictionary<int, List<int>> selectAnnotDicts = new Dictionary<int, List<int>>();
|
|
|
if (e != null && e.Count > 0)
|
|
|
{
|
|
|
- MultipleSelectionAnnot(e);
|
|
|
-
|
|
|
for (int i = 0; i < e.Count; i++)
|
|
|
{
|
|
|
AnnotEditEvent editEvent = e[i];
|
|
|
+
|
|
|
bool isVisible = PDFViewer.CheckAnnotVisible(editEvent.PageIndex, editEvent.AnnotIndex);
|
|
|
+
|
|
|
+ var annot = editEvent.EditAnnotArgs;
|
|
|
switch (editEvent.EditAction)
|
|
|
{
|
|
|
case ActionType.Add:
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- if (viewContentViewModel.OpenBOTA == true && bOTAContent.TabItemAnnotation.IsSelected)
|
|
|
+ if (annot.EventType == AnnotArgsType.AnnotSquare || annot.EventType == AnnotArgsType.AnnotCircle ||
|
|
|
+ annot.EventType == AnnotArgsType.AnnotLine || annot.EventType == AnnotArgsType.AnnotStamp || annot.EventType == AnnotArgsType.AnnotFreeText )
|
|
|
{
|
|
|
- AnnotationContentViewModel viewModel = GetAnnotationContentViewModel(bOTAContentViewModel, out AnnotationContent annotation);
|
|
|
-
|
|
|
- if (viewModel != null)
|
|
|
+ if (selectAnnotDicts.ContainsKey(editEvent.PageIndex) == false)
|
|
|
+ {
|
|
|
+ selectAnnotDicts.Add(editEvent.PageIndex, new List<int>());
|
|
|
+ selectAnnotDicts[editEvent.PageIndex].Add(editEvent.AnnotIndex);
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
- int pageindex = editEvent.PageIndex;
|
|
|
- int annotindex = editEvent.AnnotIndex;
|
|
|
- viewModel.UpdateAddedAnnot(pageindex, annotindex);
|
|
|
+ selectAnnotDicts[editEvent.PageIndex].Add(editEvent.AnnotIndex);
|
|
|
}
|
|
|
+ isMultiple = true;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if (viewModel != null)
|
|
|
+ {
|
|
|
+ int pageindex = editEvent.PageIndex;
|
|
|
+ int annotindex = editEvent.AnnotIndex;
|
|
|
+ viewModel.UpdateAddedAnnot(pageindex, annotindex);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
if (StrAnnotToolChecked == "Signature")
|
|
|
{
|
|
@@ -996,44 +1014,74 @@ namespace PDF_Master.ViewModels.Tools
|
|
|
|
|
|
break;
|
|
|
|
|
|
- case ActionType.Del:
|
|
|
-
|
|
|
- if (bOTAContent.TabItemAnnotation.IsSelected)
|
|
|
- {
|
|
|
- AnnotationContentViewModel viewModel = GetAnnotationContentViewModel(bOTAContentViewModel, out AnnotationContent annotation);
|
|
|
+ case ActionType.Modify:
|
|
|
|
|
|
- if (viewModel != null)
|
|
|
- {
|
|
|
- int pageindex = editEvent.PageIndex;
|
|
|
- int annotindex = editEvent.AnnotIndex;
|
|
|
- viewModel.UpdateModifiedAnnot(pageindex, annotindex, true);
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if (viewModel != null)
|
|
|
+ {
|
|
|
+ int pageindex = editEvent.PageIndex;
|
|
|
+ int annotindex = editEvent.AnnotIndex;
|
|
|
+ viewModel.UpdateModifiedAnnot(pageindex, annotindex);
|
|
|
}
|
|
|
+
|
|
|
break;
|
|
|
|
|
|
- case ActionType.Modify:
|
|
|
+ case ActionType.Del:
|
|
|
|
|
|
- if (bOTAContent.TabItemAnnotation.IsSelected)
|
|
|
- {
|
|
|
- AnnotationContentViewModel viewModel = GetAnnotationContentViewModel(bOTAContentViewModel, out AnnotationContent annotation);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- if (viewModel != null)
|
|
|
- {
|
|
|
- int pageindex = editEvent.PageIndex;
|
|
|
- int annotindex = editEvent.AnnotIndex;
|
|
|
- viewModel.UpdateModifiedAnnot(pageindex, annotindex, false);
|
|
|
- }
|
|
|
+ if (viewModel != null)
|
|
|
+ {
|
|
|
+ int pageindex = editEvent.PageIndex;
|
|
|
+ int annotindex = editEvent.AnnotIndex;
|
|
|
+ viewModel.DeleteModifiedAnnot(pageindex, annotindex);
|
|
|
}
|
|
|
+
|
|
|
+ ExitAnnotationTool();
|
|
|
+ viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
|
|
|
break;
|
|
|
|
|
|
case ActionType.TextEdit:
|
|
|
break;
|
|
|
-
|
|
|
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
+ if (isMultiple && selectAnnotDicts.Count >= 1)
|
|
|
+ {
|
|
|
+ PDFViewer.ClearSelectAnnots();
|
|
|
+
|
|
|
+ if (StrAnnotToolChecked != "Signature")
|
|
|
+ {
|
|
|
+ PDFViewer.SelectAnnotation(selectAnnotDicts);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
if (IsNoSelectMenu)
|
|
|
{
|
|
@@ -1051,11 +1099,11 @@ namespace PDF_Master.ViewModels.Tools
|
|
|
|
|
|
foreach (var item in e)
|
|
|
{
|
|
|
- if (item.EditAction == ActionType.Add )
|
|
|
+ if (item.EditAction == ActionType.Add || item.EditAction == ActionType.Modify)
|
|
|
{
|
|
|
var annot = item.EditAnnotArgs;
|
|
|
if (annot.EventType == AnnotArgsType.AnnotSquare || annot.EventType == AnnotArgsType.AnnotCircle ||
|
|
|
- annot.EventType == AnnotArgsType.AnnotLine || annot.EventType == AnnotArgsType.AnnotStamp || annot.EventType == AnnotArgsType.AnnotFreeText)
|
|
|
+ annot.EventType == AnnotArgsType.AnnotLine || annot.EventType == AnnotArgsType.AnnotStamp || annot.EventType == AnnotArgsType.AnnotFreeText || annot.EventType == AnnotArgsType.AnnotFreehand)
|
|
|
{
|
|
|
if (selectAnnotDicts.ContainsKey(item.PageIndex) == false)
|
|
|
{
|
|
@@ -1077,7 +1125,9 @@ namespace PDF_Master.ViewModels.Tools
|
|
|
PDFViewer.ClearSelectAnnots();
|
|
|
|
|
|
if (StrAnnotToolChecked != "Signature")
|
|
|
+ {
|
|
|
PDFViewer.SelectAnnotation(selectAnnotDicts);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1190,9 +1240,12 @@ namespace PDF_Master.ViewModels.Tools
|
|
|
|
|
|
foreach (AnnotArgsType argsType in e.Keys)
|
|
|
{
|
|
|
- if (PropertyPanel.annot.EventType != argsType)
|
|
|
+ if (PropertyPanel.annot != null)
|
|
|
{
|
|
|
- PDFViewer.SetMouseMode(MouseModes.PanTool);
|
|
|
+ if (PropertyPanel.annot.EventType != argsType)
|
|
|
+ {
|
|
|
+ PDFViewer.SetMouseMode(MouseModes.PanTool);
|
|
|
+ }
|
|
|
}
|
|
|
switch (argsType)
|
|
|
{
|