|
@@ -335,8 +335,7 @@ namespace PDF_Master.ViewModels.Tools
|
|
|
viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
|
|
|
//GetSignature();
|
|
|
//StrAnnotToolChecked = "Signature";
|
|
|
- }
|
|
|
-
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -374,29 +373,26 @@ namespace PDF_Master.ViewModels.Tools
|
|
|
//viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
- if (!string.IsNullOrWhiteSpace(StrAnnotToolChecked))
|
|
|
+ PropertyPanel.annot = null;
|
|
|
+ PropertyPanel.AnnotEvents = null;
|
|
|
+ PropertyPanel.AnnotEvent = null;
|
|
|
+ PropertyPanel.annotlists = null;
|
|
|
+ //PDFViewer.SetMouseMode(MouseModes.PanTool);
|
|
|
+ //HandToolIsCheckedEvent(false);
|
|
|
+ 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;
|
|
|
//此处不能用这个方法更新创建注释的属性 会导致死循环
|
|
|
- // FindAnnotTypeKey(StrAnnotToolChecked, ref annotArgs);
|
|
|
+ // FindAnnotTypeKey(StrAnnotToolChecked, ref annotArgs);
|
|
|
|
|
|
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);
|
|
|
+ }
|
|
|
|
|
|
//switch (annot.EventType)
|
|
|
//{
|
|
@@ -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 == false || isTabItemAnnotation == false || bOTAContent.TabItemAnnotation.IsSelected == false)
|
|
|
- //{
|
|
|
- // viewContentViewModel.OpenBOTA = true;
|
|
|
- // bOTAContent.TabItemAnnotation.IsSelected = true;
|
|
|
- //}
|
|
|
- //if (editEvent.EditAnnotArgs is StickyAnnotArgs stickyAnnotArgs)
|
|
|
- //{
|
|
|
- // PDFViewer.SelectAnnotation(stickyAnnotArgs.PageIndex, stickyAnnotArgs.AnnotIndex);
|
|
|
- //}
|
|
|
- //if (editEvent.EditAnnotArgs is FreeTextAnnotArgs freeTextAnnotArgs)
|
|
|
- //{
|
|
|
- // PDFViewer.SelectAnnotation(freeTextAnnotArgs.PageIndex, freeTextAnnotArgs.AnnotIndex);
|
|
|
- //}
|
|
|
- //BOTA
|
|
|
-
|
|
|
- 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 /*|| annot.EventType == AnnotArgsType.AnnotFreehand*/)
|
|
|
{
|
|
|
- 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 (viewContentViewModel.OpenBOTA == true && bOTAContent.TabItemAnnotation.IsSelected)
|
|
|
+ //{
|
|
|
+ // AnnotationContentViewModel viewModel = GetAnnotationContentViewModel(bOTAContentViewModel, out AnnotationContent annotation);
|
|
|
+
|
|
|
+ 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:
|
|
|
- //isTabItemAnnotation = IsBOTATabItemShow(out bOTAContentViewModel, out bOTAContent, "TabItemAnnotation");
|
|
|
- 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 (annot.EventType == AnnotArgsType.AnnotSquare || annot.EventType == AnnotArgsType.AnnotCircle ||
|
|
|
+ //annot.EventType == AnnotArgsType.AnnotLine || annot.EventType == AnnotArgsType.AnnotStamp || annot.EventType == AnnotArgsType.AnnotFreeText || annot.EventType == AnnotArgsType.AnnotFreehand)
|
|
|
+ // {
|
|
|
+ // if (selectAnnotDicts.ContainsKey(editEvent.PageIndex) == false)
|
|
|
+ // {
|
|
|
+ // selectAnnotDicts.Add(editEvent.PageIndex, new List<int>());
|
|
|
+ // selectAnnotDicts[editEvent.PageIndex].Add(editEvent.AnnotIndex);
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // selectAnnotDicts[editEvent.PageIndex].Add(editEvent.AnnotIndex);
|
|
|
+ // }
|
|
|
+ // isMultiple = true;
|
|
|
+ // }
|
|
|
+
|
|
|
+ if (viewModel != null)
|
|
|
+ {
|
|
|
+ int pageindex = editEvent.PageIndex;
|
|
|
+ int annotindex = editEvent.AnnotIndex;
|
|
|
+ viewModel.UpdateModifiedAnnot(pageindex, annotindex);
|
|
|
}
|
|
|
+ //}
|
|
|
break;
|
|
|
|
|
|
- case ActionType.Modify:
|
|
|
+ case ActionType.Del:
|
|
|
//isTabItemAnnotation = IsBOTATabItemShow(out bOTAContentViewModel, out bOTAContent, "TabItemAnnotation");
|
|
|
- if (bOTAContent.TabItemAnnotation.IsSelected)
|
|
|
- {
|
|
|
- AnnotationContentViewModel viewModel = GetAnnotationContentViewModel(bOTAContentViewModel, out AnnotationContent annotation);
|
|
|
+ //if (viewContentViewModel.OpenBOTA == true && 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);
|
|
|
+
|
|
|
+ //foreach (var item in selectAnnotDicts.Keys)
|
|
|
+ //{
|
|
|
+ // List<int> value = selectAnnotDicts[item];
|
|
|
+ // foreach (var item1 in value)
|
|
|
+ // {
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //MultipleSelectionAnnot(e);
|
|
|
//空白处 右键菜单 添加注释 为单次添加,不连续添加
|
|
|
if (IsNoSelectMenu)
|
|
|
{
|
|
@@ -1051,11 +1099,11 @@ namespace PDF_Master.ViewModels.Tools
|
|
|
|
|
|
foreach (var item in e)
|
|
|
{
|
|
|
- if (item.EditAction == ActionType.Add /*|| item.EditAction == ActionType.Modify*/)
|
|
|
+ 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)
|
|
|
{
|