|
@@ -323,6 +323,8 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
|
navigationContext.Parameters.TryGetValue<List<PDFEditEvent>>(ParameterNames.AnnotEvent, out TextEditEventList);
|
|
|
if (PDFViewer != null)
|
|
|
{
|
|
|
+ PDFViewer.PDFEditActiveHandler -= PDFViewer_PDFEditActiveHandler;
|
|
|
+ PDFViewer.PDFEditActiveHandler += PDFViewer_PDFEditActiveHandler;
|
|
|
PDFViewer.PDFEditCommandHandler -= PDFViewer_PDFEditCommandHandler;
|
|
|
PDFViewer.PDFEditCommandHandler += PDFViewer_PDFEditCommandHandler;
|
|
|
LoadedPDFEdit();
|
|
@@ -404,26 +406,47 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
|
customMenu.SetMenuBinding(6, ExportImgCommand);
|
|
|
return popMenu;
|
|
|
}
|
|
|
- //选中文字的框(暂时暂时)
|
|
|
- private ContextMenu SelectTextBorder(object sender)
|
|
|
+
|
|
|
+ //选中裁剪图像时
|
|
|
+ private ContextMenu CropImgPDFEdit(object sender)
|
|
|
+ {
|
|
|
+ var popMenu = App.Current.FindResource("CropImgMenu") as ContextMenu;
|
|
|
+ CustomPopMenu customMenu = new CustomPopMenu(popMenu, sender);
|
|
|
+
|
|
|
+ //确认裁剪
|
|
|
+ customMenu.SetMenuBinding(0, CropImgCommand);
|
|
|
+ //取消裁剪
|
|
|
+ customMenu.SetMenuBinding(1, CancelCropCommand);
|
|
|
+ //还原裁剪
|
|
|
+ customMenu.SetMenuBinding(2, CancelCropCommand);
|
|
|
+ return popMenu;
|
|
|
+ }
|
|
|
+ //多选图片右键
|
|
|
+ private ContextMenu SelectMoreImage(object sender)
|
|
|
{
|
|
|
- var popMenu = App.Current.FindResource("SelectTextMenu") as ContextMenu;
|
|
|
+ var popMenu = App.Current.FindResource("SelectMoreImageMenu") as ContextMenu;
|
|
|
CustomPopMenu customMenu = new CustomPopMenu(popMenu, sender);
|
|
|
- //编辑
|
|
|
- customMenu.SetMenuBinding(0, EditImgModeCommand);
|
|
|
//复制
|
|
|
- customMenu.SetMenuBinding(1, ApplicationCommands.Copy);
|
|
|
+ customMenu.SetMenuBinding(0, ApplicationCommands.Copy);
|
|
|
//剪切
|
|
|
- customMenu.SetMenuBinding(2, ApplicationCommands.Cut);
|
|
|
+ customMenu.SetMenuBinding(1, ApplicationCommands.Cut);
|
|
|
//粘贴
|
|
|
- customMenu.SetMenuBinding(3, ApplicationCommands.Paste);
|
|
|
+ customMenu.SetMenuBinding(2, ApplicationCommands.Paste);
|
|
|
//删除
|
|
|
- customMenu.SetMenuBinding(4, ApplicationCommands.Delete);
|
|
|
+ customMenu.SetMenuBinding(3, ApplicationCommands.Delete);
|
|
|
+ //导出
|
|
|
+ customMenu.SetMenuBinding(4, ExportImgCommand);
|
|
|
|
|
|
- customMenu.SetVisibilityProperty(4, false);
|
|
|
|
|
|
return popMenu;
|
|
|
}
|
|
|
+
|
|
|
+ private void PDFViewer_PDFEditActiveHandler(object sender, List<PDFEditEvent> e)
|
|
|
+ {
|
|
|
+ IsCrop = false;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
private void PDFViewer_PDFEditCommandHandler(object sender, PDFEditCommand e)
|
|
|
{
|
|
|
|
|
@@ -435,11 +458,19 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
|
case CommandType.Context:
|
|
|
if (e.EditType == ComPDFKit.PDFPage.CPDFEditType.EditImage)
|
|
|
{
|
|
|
- e.PopupMenu = SelectImgPDFEdit(sender);
|
|
|
+ if (IsCrop == true)
|
|
|
+ {
|
|
|
+ e.PopupMenu =CropImgPDFEdit(sender);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ e.PopupMenu = SelectImgPDFEdit(sender);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
else if (e.EditType == ComPDFKit.PDFPage.CPDFEditType.None)
|
|
|
{
|
|
|
- e.PopupMenu = SelectTextBorder(sender);
|
|
|
+ e.PopupMenu = SelectMoreImage(sender);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -456,6 +487,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
private void GetImagePreView()
|
|
|
{
|
|
|
try
|
|
@@ -502,6 +534,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
|
TextEditEvent = null;
|
|
|
ClearCheckedAglin?.Invoke(null, null);
|
|
|
PDFViewer.PDFEditCommandHandler -= PDFViewer_PDFEditCommandHandler;
|
|
|
+ PDFViewer.PDFEditActiveHandler -= PDFViewer_PDFEditActiveHandler;
|
|
|
}
|
|
|
}
|
|
|
}
|