|
@@ -1,6 +1,7 @@
|
|
|
using ComPDFKit.PDFDocument;
|
|
|
using ComPDFKitViewer;
|
|
|
using ComPDFKitViewer.AnnotEvent;
|
|
|
+using PDF_Office.CustomControl.CompositeControl;
|
|
|
using PDF_Office.Helper;
|
|
|
using Prism.Mvvm;
|
|
|
using Prism.Regions;
|
|
@@ -30,7 +31,6 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
/// <param name="annotAttribsList">更改注释属性的键值对,更改值后会自动记录undoRedo容器里</param>
|
|
|
private void AddToPropertyPanel(string viewContent, string toolTag = null, List<AnnotHandlerEventArgs> annots = null, Dictionary<AnnotAttrib, object> annotAttribsList = null, AnnotAttribEvent annotAttribEvent = null)
|
|
|
{
|
|
|
-
|
|
|
if (annots != null)
|
|
|
{
|
|
|
propertyPanel.annotlists = annots;
|
|
@@ -82,6 +82,7 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
#endregion 属性面板
|
|
|
|
|
|
#region 阅读页 - 右键菜单
|
|
|
+
|
|
|
private ContextMenu ViewerContextMenu()
|
|
|
{
|
|
|
ContextMenu contextMenu = App.Current.FindResource("ViewerContextMenu") as ContextMenu;
|
|
@@ -90,7 +91,6 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
return contextMenu;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
private void ViewerContextMenu_Loaded(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
ContextMenu contextMenu = sender as ContextMenu;
|
|
@@ -158,8 +158,9 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
break;
|
|
|
|
|
|
case "AddBookMark":
|
|
|
- menuItem1.Click -= AddBookMark_Click;
|
|
|
- menuItem1.Click += AddBookMark_Click;
|
|
|
+ //menuItem1.Click -= AddBookMark_Click;
|
|
|
+ //menuItem1.Click += AddBookMark_Click;
|
|
|
+ menuItem1.Command = AddBookMarkCommand;
|
|
|
SetMenuItemVisibility(menuItem1, "DelBookMark", "AddBookMark", isAddBookMark);
|
|
|
break;
|
|
|
|
|
@@ -335,189 +336,476 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
|
|
|
#region 注释-右键菜单
|
|
|
|
|
|
- //高亮注释,右键菜单
|
|
|
- private ContextMenu SelectHightAnnotMenu(object sender)
|
|
|
+ /// <summary>
|
|
|
+ /// 高亮注释,右键菜单
|
|
|
+ /// </summary>
|
|
|
+ private void InitSelectHightAnnotMenu()
|
|
|
{
|
|
|
- var popMenu = App.Current.FindResource("HightAnnotContextMenu") as ContextMenu;
|
|
|
- CustomPopMenu customMenu = new CustomPopMenu(popMenu, sender);
|
|
|
- //颜色列表
|
|
|
- customMenu.SetMenuBinding(0, ApplicationCommands.Copy);
|
|
|
- //复制文本
|
|
|
- customMenu.SetMenuBinding(1, ApplicationCommands.Copy);
|
|
|
- //删除
|
|
|
- customMenu.SetMenuBinding(2, ApplicationCommands.Cut);
|
|
|
- //添加笔记
|
|
|
- customMenu.SetMenuBinding(3, ApplicationCommands.Paste);
|
|
|
- //设置当前属性为默认值
|
|
|
- customMenu.SetMenuBinding(4, ApplicationCommands.Delete);
|
|
|
- return popMenu;
|
|
|
+ var popMenu = new ContextMenu();
|
|
|
+ PopMenu pop = new PopMenu(popMenu);
|
|
|
+ ColorContent colorContent = new ColorContent();
|
|
|
+ colorContent.Name = "hightcolor";
|
|
|
+ colorContent.SelectedColorHandler -= colorContent_SelectedColorHandler;
|
|
|
+ colorContent.SelectedColorHandler += colorContent_SelectedColorHandler;
|
|
|
+ colorContent.VerticalAlignment = VerticalAlignment.Top;
|
|
|
+ colorContent.Height = 60;
|
|
|
+ var menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "hightColor";
|
|
|
+ menuItem.Height = colorContent.Height;
|
|
|
+ menuItem.Header = colorContent;
|
|
|
+ var hightColorStyle = App.Current.FindResource("UIElementMenuItem") as Style;
|
|
|
+ if (hightColorStyle != null)
|
|
|
+ menuItem.Style = hightColorStyle;
|
|
|
+
|
|
|
+ pop.AddItem(menuItem);
|
|
|
+
|
|
|
+ pop.AddItem(GetSeparator());
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "hightCopyText";
|
|
|
+ menuItem.Header = "复制文本";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), HightAnnotCopyText_MenuCommand);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "hightdelete";
|
|
|
+ menuItem.Header = "删除";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Delete);
|
|
|
+
|
|
|
+ pop.AddItem(GetSeparator());
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "hightAddNote";
|
|
|
+ menuItem.Header = "添加笔记";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), AnnotAddNoteText_MenuCommand);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "hightdefault";
|
|
|
+ menuItem.Header = "设置当前属性为默认值";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), AnnotDefaultValue_MenuCommand);
|
|
|
+ HightAnnotPopMenu = pop;
|
|
|
}
|
|
|
|
|
|
- //手绘
|
|
|
- private ContextMenu SelectFreeHandAnnotMenu(object sender)
|
|
|
+ private Separator GetSeparator()
|
|
|
{
|
|
|
- var popMenu = App.Current.FindResource("FreeHandAnnotContextMenu") as ContextMenu;
|
|
|
- CustomPopMenu customMenu = new CustomPopMenu(popMenu, sender);
|
|
|
- //复制
|
|
|
- customMenu.SetMenuBinding(0, ApplicationCommands.Copy);
|
|
|
- //剪切
|
|
|
- customMenu.SetMenuBinding(1, ApplicationCommands.Copy);
|
|
|
- //粘贴
|
|
|
- customMenu.SetMenuBinding(2, ApplicationCommands.Cut);
|
|
|
- //删除
|
|
|
- customMenu.SetMenuBinding(3, ApplicationCommands.Paste);
|
|
|
- //颜色
|
|
|
- customMenu.SetMenuBinding(4, ApplicationCommands.Delete);
|
|
|
- //线段样式
|
|
|
- customMenu.SetSubMenuBinding(5, 0, ApplicationCommands.Delete);
|
|
|
- customMenu.SetSubMenuBinding(5, 1, ApplicationCommands.Delete);
|
|
|
- //添加笔记
|
|
|
- customMenu.SetMenuBinding(6, ApplicationCommands.Delete);
|
|
|
- //设置当前属性为默认值
|
|
|
- customMenu.SetMenuBinding(7, ApplicationCommands.Delete);
|
|
|
- return popMenu;
|
|
|
+ Separator separator = new Separator();
|
|
|
+ separator.Height = 1;
|
|
|
+ separator.BorderBrush = new SolidColorBrush(Color.FromArgb(0x33, 0x00, 0x00, 0x00));
|
|
|
+ separator.BorderThickness = new Thickness(1);
|
|
|
+ return separator;
|
|
|
}
|
|
|
|
|
|
- //文本
|
|
|
- private ContextMenu SelectFreeTextAnnotMenu(object sender)
|
|
|
+ private void colorContent_SelectedColorHandler(object sender, Color e)
|
|
|
{
|
|
|
- var popMenu = App.Current.FindResource("FreeTextAnnotContextMenu") as ContextMenu;
|
|
|
- CustomPopMenu customMenu = new CustomPopMenu(popMenu, sender);
|
|
|
- //复制
|
|
|
- customMenu.SetMenuBinding(0, ApplicationCommands.Copy);
|
|
|
- //剪切
|
|
|
- customMenu.SetMenuBinding(1, ApplicationCommands.Copy);
|
|
|
- //粘贴
|
|
|
- customMenu.SetMenuBinding(2, ApplicationCommands.Cut);
|
|
|
- //删除
|
|
|
- customMenu.SetMenuBinding(3, ApplicationCommands.Paste);
|
|
|
- //文本颜色
|
|
|
- customMenu.SetMenuBinding(4, ApplicationCommands.Delete);
|
|
|
- //字体
|
|
|
- customMenu.SetSubMenuBinding(5, 0, ApplicationCommands.Delete);
|
|
|
- customMenu.SetSubMenuBinding(5, 1, ApplicationCommands.Delete);
|
|
|
- customMenu.SetSubMenuBinding(5, 2, ApplicationCommands.Delete);
|
|
|
- //文本对齐
|
|
|
- customMenu.SetSubMenuBinding(6, 0, ApplicationCommands.Delete);
|
|
|
- customMenu.SetSubMenuBinding(6, 1, ApplicationCommands.Delete);
|
|
|
- customMenu.SetSubMenuBinding(6, 2, ApplicationCommands.Delete);
|
|
|
- //设置当前属性为默认值
|
|
|
- customMenu.SetMenuBinding(7, ApplicationCommands.Delete);
|
|
|
- return popMenu;
|
|
|
+ if (e == null) return;
|
|
|
+
|
|
|
+ var annot =(sender as FrameworkElement).DataContext as AnnotHandlerEventArgs;
|
|
|
+ if(annot != null)
|
|
|
+ {
|
|
|
+ var test = annot as TextHighlightAnnotArgs;
|
|
|
+ if(test != null)
|
|
|
+ {
|
|
|
+ var anvent = AnnotAttribEvent.GetAnnotAttribEvent(test, test.GetAnnotAttrib());
|
|
|
+ anvent.UpdateAttrib(AnnotAttrib.Color, e);
|
|
|
+ anvent.UpdateAnnot();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- //便签
|
|
|
- private ContextMenu SelectStrickNoteAnnotMenu(object sender)
|
|
|
+ /// <summary>
|
|
|
+ /// 手绘
|
|
|
+ /// </summary>
|
|
|
+ private void InitSelectFreeHandAnnotMenu()
|
|
|
{
|
|
|
- var popMenu = App.Current.FindResource("StrickNoteAnnotContextMenu") as ContextMenu;
|
|
|
- CustomPopMenu customMenu = new CustomPopMenu(popMenu, sender);
|
|
|
- //复制
|
|
|
- customMenu.SetMenuBinding(0, ApplicationCommands.Copy);
|
|
|
- //剪切
|
|
|
- customMenu.SetMenuBinding(1, ApplicationCommands.Copy);
|
|
|
- //粘贴
|
|
|
- customMenu.SetMenuBinding(2, ApplicationCommands.Cut);
|
|
|
- //删除
|
|
|
- customMenu.SetMenuBinding(3, ApplicationCommands.Paste);
|
|
|
- //颜色
|
|
|
- customMenu.SetMenuBinding(4, ApplicationCommands.Delete);
|
|
|
- //编辑便签
|
|
|
- customMenu.SetMenuBinding(5, ApplicationCommands.Delete);
|
|
|
- //设置当前属性为默认值
|
|
|
- customMenu.SetMenuBinding(7, ApplicationCommands.Delete);
|
|
|
- return popMenu;
|
|
|
+ var popMenu = new ContextMenu();
|
|
|
+ PopMenu pop = new PopMenu(popMenu);
|
|
|
+ var menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "FreeHandCopy";
|
|
|
+ menuItem.Header = "复制";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Copy);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "FreeHandCut";
|
|
|
+ menuItem.Header = "剪切";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Cut);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "FreeHandPaste";
|
|
|
+ menuItem.Header = "粘贴";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Paste);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "FreeHandDelete";
|
|
|
+ menuItem.Header = "删除";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Delete);
|
|
|
+
|
|
|
+ pop.AddItem(GetSeparator());
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "FreeHandColor";
|
|
|
+ menuItem.Header = "颜色...";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), AnnotColorPalette_MenuCommand);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "FreeHandLineStyle";
|
|
|
+ menuItem.Header = "线段样式";
|
|
|
+ pop.AddItem(menuItem);
|
|
|
+
|
|
|
+ RadioButton radioButton = new RadioButton();
|
|
|
+ radioButton.Name = "FreeHandSolid";
|
|
|
+ radioButton.Content = "实线";
|
|
|
+ radioButton.GroupName = "LineStyle";
|
|
|
+ radioButton.Tag = "Solid";
|
|
|
+ pop.BindingEvent(pop.AddChild("FreeHandLineStyle",radioButton), FreeHandLineStyle_MenuCommand);
|
|
|
+
|
|
|
+ radioButton = new RadioButton();
|
|
|
+ radioButton.Name = "FreeHandDash";
|
|
|
+ radioButton.Content = "虚线";
|
|
|
+ radioButton.GroupName = "LineStyle";
|
|
|
+ radioButton.Tag = "Dash";
|
|
|
+ pop.BindingEvent(pop.AddChild("FreeHandLineStyle", radioButton), FreeHandLineStyle_MenuCommand);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "FreeHandAddNote";
|
|
|
+ menuItem.Header = "添加笔记";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), AnnotAddNoteText_MenuCommand);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "FreeHandDefault";
|
|
|
+ menuItem.Header = "设置当前属性为默认值";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), AnnotDefaultValue_MenuCommand);
|
|
|
+ FreeHandAnnotPopMenu = pop;
|
|
|
}
|
|
|
+ /// <summary>
|
|
|
+ /// 文本
|
|
|
+ /// </summary>
|
|
|
+ private void InitSelectFreeTextAnnotMenu()
|
|
|
+ {
|
|
|
+ var popMenu = new ContextMenu();
|
|
|
+ PopMenu pop = new PopMenu(popMenu);
|
|
|
+ var menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "FreeTextCopy";
|
|
|
+ menuItem.Header = "复制";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Copy);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "FreeTextCut";
|
|
|
+ menuItem.Header = "剪切";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Cut);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "FreeTextPaste";
|
|
|
+ menuItem.Header = "粘贴";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Paste);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "FreeTextDelete";
|
|
|
+ menuItem.Header = "删除";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Delete);
|
|
|
|
|
|
- //形状
|
|
|
- private ContextMenu SelectShapeAnnotMenu(object sender)
|
|
|
+ pop.AddItem(GetSeparator());
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "FreeTextColor";
|
|
|
+ menuItem.Header = "颜色...";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), AnnotColorPalette_MenuCommand);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "FreeTextFontFamily";
|
|
|
+ menuItem.Header = "字体";
|
|
|
+ pop.AddItem(menuItem);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "FreeTextArial";
|
|
|
+ menuItem.Header = "楷体";
|
|
|
+ menuItem.Tag = "Arial";
|
|
|
+ pop.BindingEvent(pop.AddChild("FreeTextFontFamily", menuItem), FreeTextFontFamily_MenuCommand);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "FreeTextCourier";
|
|
|
+ menuItem.Header = "Courier";
|
|
|
+ menuItem.Tag = "Courier";
|
|
|
+ pop.BindingEvent(pop.AddChild("FreeTextFontFamily", menuItem), FreeTextFontFamily_MenuCommand);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "FreeTextTimesRoman";
|
|
|
+ menuItem.Header = "Times New Roman";
|
|
|
+ menuItem.Tag = "Times New Roman";
|
|
|
+ pop.BindingEvent(pop.AddChild("FreeTextFontFamily", menuItem), FreeTextFontFamily_MenuCommand);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "FreeTextAglin";
|
|
|
+ menuItem.Header = "文本对齐";
|
|
|
+ pop.AddItem(menuItem);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "FreeTextAglinLeft";
|
|
|
+ menuItem.Header = "左对齐";
|
|
|
+ menuItem.Tag = "Left";
|
|
|
+ pop.BindingEvent(pop.AddChild("FreeTextAglin", menuItem), FreeTextAglin_MenuCommand);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "FreeTextAglinCenter";
|
|
|
+ menuItem.Header = "居中对齐";
|
|
|
+ menuItem.Tag = "Center";
|
|
|
+ pop.BindingEvent(pop.AddChild("FreeTextAglin", menuItem), FreeTextAglin_MenuCommand);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "FreeTextAglinRight";
|
|
|
+ menuItem.Header = "右对齐";
|
|
|
+ menuItem.Tag = "Right";
|
|
|
+ pop.BindingEvent(pop.AddChild("FreeTextAglin", menuItem), FreeTextAglin_MenuCommand);
|
|
|
+
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "FreeHandDefault";
|
|
|
+ menuItem.Header = "设置当前属性为默认值";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), AnnotDefaultValue_MenuCommand);
|
|
|
+ FreeTextAnnotPopMenu = pop;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 便签
|
|
|
+ /// </summary>
|
|
|
+ private void InitSelectStrickNoteAnnotMenu()
|
|
|
{
|
|
|
- var popMenu = App.Current.FindResource("ShapeAnnotContextMenu") as ContextMenu;
|
|
|
- CustomPopMenu customMenu = new CustomPopMenu(popMenu, sender);
|
|
|
- //复制
|
|
|
- customMenu.SetMenuBinding(0, ApplicationCommands.Copy);
|
|
|
- //剪切
|
|
|
- customMenu.SetMenuBinding(1, ApplicationCommands.Copy);
|
|
|
- //粘贴
|
|
|
- customMenu.SetMenuBinding(2, ApplicationCommands.Cut);
|
|
|
- //删除
|
|
|
- customMenu.SetMenuBinding(3, ApplicationCommands.Paste);
|
|
|
- //颜色
|
|
|
- customMenu.SetMenuBinding(4, ApplicationCommands.Delete);
|
|
|
- //线段样式
|
|
|
- customMenu.SetSubMenuBinding(6, 0, ApplicationCommands.Delete);
|
|
|
- customMenu.SetSubMenuBinding(6, 1, ApplicationCommands.Delete);
|
|
|
- //线段方向
|
|
|
- customMenu.SetSubMenuBinding(7, 0, ApplicationCommands.Delete);
|
|
|
- customMenu.SetSubMenuBinding(7, 1, ApplicationCommands.Delete);
|
|
|
- //添加笔记
|
|
|
- customMenu.SetMenuBinding(8, ApplicationCommands.Delete);
|
|
|
- //设置当前属性为默认值
|
|
|
- customMenu.SetMenuBinding(8, ApplicationCommands.Delete);
|
|
|
- return popMenu;
|
|
|
+ var popMenu = new ContextMenu();
|
|
|
+ PopMenu pop = new PopMenu(popMenu);
|
|
|
+ var menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "StrickNoteCopy";
|
|
|
+ menuItem.Header = "复制";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Copy);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "StrickNoteCut";
|
|
|
+ menuItem.Header = "剪切";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Cut);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "StrickNotePaste";
|
|
|
+ menuItem.Header = "粘贴";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Paste);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "StrickNoteDelete";
|
|
|
+ menuItem.Header = "删除";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Delete);
|
|
|
+
|
|
|
+ pop.AddItem(GetSeparator());
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "StrickNoteColor";
|
|
|
+ menuItem.Header = "颜色...";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), AnnotColorPalette_MenuCommand);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "StrickNoteEdit";
|
|
|
+ menuItem.Header = "编辑便签";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), StrikeNoteEditStrike_MenuCommand);
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "StrickNoteDefault";
|
|
|
+ menuItem.Header = "设置当前属性为默认值";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), AnnotDefaultValue_MenuCommand);
|
|
|
+ StrickNoteAnnotPopMenu = pop;
|
|
|
}
|
|
|
|
|
|
- //链接
|
|
|
- private ContextMenu SelectLinkAnnotMenu(object sender)
|
|
|
+ /// <summary>
|
|
|
+ /// 形状
|
|
|
+ /// </summary>
|
|
|
+ private void InitSelectShapeAnnotMenu()
|
|
|
{
|
|
|
- var popMenu = App.Current.FindResource("LinkAnnotContextMenu") as ContextMenu;
|
|
|
- CustomPopMenu customMenu = new CustomPopMenu(popMenu, sender);
|
|
|
- //复制
|
|
|
- customMenu.SetMenuBinding(0, ApplicationCommands.Copy);
|
|
|
- //剪切
|
|
|
- customMenu.SetMenuBinding(1, ApplicationCommands.Copy);
|
|
|
- //粘贴
|
|
|
- customMenu.SetMenuBinding(2, ApplicationCommands.Cut);
|
|
|
- //删除
|
|
|
- customMenu.SetMenuBinding(3, ApplicationCommands.Paste);
|
|
|
- return popMenu;
|
|
|
+ var popMenu = new ContextMenu();
|
|
|
+ PopMenu pop = new PopMenu(popMenu);
|
|
|
+ var menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "ShapeCopy";
|
|
|
+ menuItem.Header = "复制";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Copy);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "ShapeCut";
|
|
|
+ menuItem.Header = "剪切";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Cut);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "ShapePaste";
|
|
|
+ menuItem.Header = "粘贴";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Paste);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "ShapeDelete";
|
|
|
+ menuItem.Header = "删除";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Delete);
|
|
|
+
|
|
|
+ pop.AddItem(GetSeparator());
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "ShapeColor";
|
|
|
+ menuItem.Header = "颜色...";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), AnnotColorPalette_MenuCommand);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "ShapeLineStyle";
|
|
|
+ menuItem.Header = "线段样式";
|
|
|
+ pop.AddItem(menuItem);
|
|
|
+
|
|
|
+ RadioButton radioButton = new RadioButton();
|
|
|
+ radioButton.Name = "ShapeSolid";
|
|
|
+ radioButton.Content = "实线";
|
|
|
+ radioButton.GroupName = "LineStyle";
|
|
|
+ radioButton.Tag = "Solid";
|
|
|
+ pop.BindingEvent(pop.AddChild("ShapeLineStyle", radioButton), ShapeLineStyle_MenuCommand);
|
|
|
+
|
|
|
+ radioButton = new RadioButton();
|
|
|
+ radioButton.Name = "ShapeDash";
|
|
|
+ radioButton.Content = "虚线";
|
|
|
+ radioButton.GroupName = "LineStyle";
|
|
|
+ radioButton.Tag = "Dash";
|
|
|
+ pop.BindingEvent(pop.AddChild("ShapeLineStyle", radioButton), ShapeLineStyle_MenuCommand);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "ShapeDirect";
|
|
|
+ menuItem.Header = "线段方向";
|
|
|
+ pop.AddItem(menuItem);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "ShapeVer";
|
|
|
+ menuItem.Header = "垂直";
|
|
|
+ menuItem.Tag = "Ver";
|
|
|
+ pop.BindingEvent(pop.AddChild("ShapeDirect", menuItem), ShapeLineDirect_MenuCommand);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "ShapeHor";
|
|
|
+ menuItem.Header = "横向";
|
|
|
+ menuItem.Tag = "Hor";
|
|
|
+ pop.BindingEvent(pop.AddChild("ShapeDirect", menuItem), ShapeLineDirect_MenuCommand);
|
|
|
+
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "ShapeNoteText";
|
|
|
+ menuItem.Header = "添加笔记";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), AnnotAddNoteText_MenuCommand);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "ShapeDefault";
|
|
|
+ menuItem.Header = "设置当前属性为默认值";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), AnnotDefaultValue_MenuCommand);
|
|
|
+ ShapeAnnotPopMenu = pop;
|
|
|
}
|
|
|
|
|
|
- //图章、签名
|
|
|
- private ContextMenu SelectStampAnnotMenu(object sender)
|
|
|
+ /// <summary>
|
|
|
+ /// 链接
|
|
|
+ /// </summary>
|
|
|
+ private void InitSelectLinkAnnotMenu()
|
|
|
{
|
|
|
- var popMenu = App.Current.FindResource("StampAnnotContextMenu") as ContextMenu;
|
|
|
- CustomPopMenu customMenu = new CustomPopMenu(popMenu, sender);
|
|
|
- //复制
|
|
|
- customMenu.SetMenuBinding(0, ApplicationCommands.Copy);
|
|
|
- //剪切
|
|
|
- customMenu.SetMenuBinding(1, ApplicationCommands.Copy);
|
|
|
- //粘贴
|
|
|
- customMenu.SetMenuBinding(2, ApplicationCommands.Cut);
|
|
|
- //删除
|
|
|
- customMenu.SetMenuBinding(3, ApplicationCommands.Paste);
|
|
|
- //导出
|
|
|
- customMenu.SetSubMenuBinding(4, 0, ApplicationCommands.Paste);
|
|
|
- customMenu.SetSubMenuBinding(4, 1, ApplicationCommands.Paste);
|
|
|
- customMenu.SetSubMenuBinding(4, 2, ApplicationCommands.Paste);
|
|
|
- //添加笔记
|
|
|
- customMenu.SetMenuBinding(5, ApplicationCommands.Paste);
|
|
|
- return popMenu;
|
|
|
+ var popMenu = new ContextMenu();
|
|
|
+ PopMenu pop = new PopMenu(popMenu);
|
|
|
+ var menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "LinkCopy";
|
|
|
+ menuItem.Header = "复制";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Copy);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "LinkCut";
|
|
|
+ menuItem.Header = "剪切";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Cut);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "LinkPaste";
|
|
|
+ menuItem.Header = "粘贴";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Paste);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "LinkDelete";
|
|
|
+ menuItem.Header = "删除";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Delete);
|
|
|
+ LinkAnnotPopMenu = pop;
|
|
|
}
|
|
|
|
|
|
- //多选
|
|
|
- private ContextMenu SelectMultiAnnotMenu(object sender, bool isHightAnnot)
|
|
|
+ /// <summary>
|
|
|
+ /// 图章、签名
|
|
|
+ /// </summary>
|
|
|
+ private void InitSelectStampAnnotMenu()
|
|
|
{
|
|
|
- var popMenu = App.Current.FindResource("MultiSelectAnnotContextMenu") as ContextMenu;
|
|
|
- CustomPopMenu customMenu = new CustomPopMenu(popMenu, sender);
|
|
|
- if (isHightAnnot)
|
|
|
- {
|
|
|
- customMenu.SetVisibilityProperty(0, false);
|
|
|
- customMenu.SetVisibilityProperty(2, false);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- //复制
|
|
|
- customMenu.SetMenuBinding(0, ApplicationCommands.Copy);
|
|
|
- //剪切
|
|
|
- customMenu.SetMenuBinding(1, ApplicationCommands.Copy);
|
|
|
- }
|
|
|
- //删除
|
|
|
- customMenu.SetMenuBinding(2, ApplicationCommands.Paste);
|
|
|
- return popMenu;
|
|
|
+ var popMenu = new ContextMenu();
|
|
|
+ PopMenu pop = new PopMenu(popMenu);
|
|
|
+ var menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "StampCopy";
|
|
|
+ menuItem.Header = "复制";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Copy);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "StampCut";
|
|
|
+ menuItem.Header = "剪切";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Cut);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "StampPaste";
|
|
|
+ menuItem.Header = "粘贴";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Paste);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "StampDelete";
|
|
|
+ menuItem.Header = "删除";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Delete);
|
|
|
+
|
|
|
+ pop.AddItem(GetSeparator());
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "StampExportPicture";
|
|
|
+ menuItem.Header = "导出";
|
|
|
+ pop.AddItem(menuItem);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "StampExportPNG";
|
|
|
+ menuItem.Header = "PNG";
|
|
|
+ menuItem.Tag = "PNG";
|
|
|
+ pop.BindingEvent(pop.AddChild("StampExportPicture",menuItem), StampExportPicture_MenuCommand);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "StampExportPNG";
|
|
|
+ menuItem.Header = "JPG";
|
|
|
+ menuItem.Tag = "JPG";
|
|
|
+ pop.BindingEvent(pop.AddChild("StampExportPicture", menuItem), StampExportPicture_MenuCommand);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "StampExportPNG";
|
|
|
+ menuItem.Header = "PDF";
|
|
|
+ menuItem.Tag = "PDF";
|
|
|
+ pop.BindingEvent(pop.AddChild("StampExportPicture", menuItem), StampExportPicture_MenuCommand);
|
|
|
+
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "StampAddNote";
|
|
|
+ menuItem.Header = "添加笔记";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), AnnotAddNoteText_MenuCommand);
|
|
|
+
|
|
|
+ StampAnnotPopMenu = pop;
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 多选注释
|
|
|
+ /// </summary>
|
|
|
+ private void InitSelectMultiAnnotMenu()
|
|
|
+ {
|
|
|
+ var popMenu = new ContextMenu();
|
|
|
+ PopMenu pop = new PopMenu(popMenu);
|
|
|
+ var menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "MultiCopy";
|
|
|
+ menuItem.Header = "复制";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Copy);
|
|
|
|
|
|
- #endregion 注释-右键菜单
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "MultiCut";
|
|
|
+ menuItem.Header = "剪切";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Cut);
|
|
|
|
|
|
+ menuItem = new MenuItem();
|
|
|
+ menuItem.Name = "MultiDelete";
|
|
|
+ menuItem.Header = "删除";
|
|
|
+ pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Delete);
|
|
|
+ MultiAnnotPopMenu = pop;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ #endregion 注释-右键菜单
|
|
|
}
|
|
|
-}
|
|
|
+}
|