|
@@ -487,30 +487,39 @@ namespace PDF_Master.ViewModels.Tools
|
|
|
var defaultEdit = SettingHelper.GetPDFEditDefaultProperty(CPDFEditType.EditText);
|
|
|
if (defaultEdit == null)
|
|
|
{
|
|
|
- defaultEdit = new PDFSettings.DefaultEditProperty();
|
|
|
- defaultEdit.FontName = "Arial";
|
|
|
- defaultEdit.FontSize = 14;
|
|
|
- defaultEdit.TextAlign = TextAlignType.AlignLeft;
|
|
|
- defaultEdit.AutoBlock = true;
|
|
|
- defaultEdit.ClipImage = false;
|
|
|
- defaultEdit.EditType = ComPDFKit.PDFPage.CPDFEditType.EditText;
|
|
|
- defaultEdit.FontColor = System.Windows.Media.Color.FromArgb(255, 0, 0, 0);
|
|
|
- defaultEdit.HorizontalMirror = false;
|
|
|
- defaultEdit.VerticalMirror = false;
|
|
|
- defaultEdit.IsBold = false;
|
|
|
- defaultEdit.IsItalic = false;
|
|
|
- defaultEdit.ReplaceImagePath = null;
|
|
|
- defaultEdit.Rotate = 0;
|
|
|
- defaultEdit.Transparency = 255;
|
|
|
- SettingHelper.SetPDFEditProperty(defaultEdit);
|
|
|
- Settings.Default.Save();
|
|
|
+ defaultEdit = SetDefaultEdit();
|
|
|
}
|
|
|
dFEditEvent = GetPDFEditEvent(defaultEdit);
|
|
|
return dFEditEvent;
|
|
|
}
|
|
|
|
|
|
+ private DefaultEditProperty SetDefaultEdit()
|
|
|
+ {
|
|
|
+ DefaultEditProperty defaultEdit = new PDFSettings.DefaultEditProperty();
|
|
|
+ defaultEdit.FontName = "Arial";
|
|
|
+ defaultEdit.FontSize = 14;
|
|
|
+ defaultEdit.TextAlign = TextAlignType.AlignLeft;
|
|
|
+ defaultEdit.AutoBlock = true;
|
|
|
+ defaultEdit.ClipImage = false;
|
|
|
+ defaultEdit.EditType = ComPDFKit.PDFPage.CPDFEditType.EditText;
|
|
|
+ defaultEdit.FontColor = System.Windows.Media.Color.FromArgb(255, 0, 0, 0);
|
|
|
+ defaultEdit.HorizontalMirror = false;
|
|
|
+ defaultEdit.VerticalMirror = false;
|
|
|
+ defaultEdit.IsBold = false;
|
|
|
+ defaultEdit.IsItalic = false;
|
|
|
+ defaultEdit.ReplaceImagePath = null;
|
|
|
+ defaultEdit.Rotate = 0;
|
|
|
+ defaultEdit.Transparency = 255;
|
|
|
+ SettingHelper.SetPDFEditProperty(defaultEdit);
|
|
|
+ Settings.Default.Save();
|
|
|
+ return defaultEdit;
|
|
|
+ }
|
|
|
+
|
|
|
private PDFEditEvent GetPDFEditEvent(DefaultEditProperty defaultEdit)
|
|
|
{
|
|
|
+ if (defaultEdit == null)
|
|
|
+ {
|
|
|
+ }
|
|
|
PDFEditEvent dFEditEvent = new PDFEditEvent();
|
|
|
dFEditEvent.FontName = defaultEdit.FontName;
|
|
|
dFEditEvent.FontSize = defaultEdit.FontSize;
|
|
@@ -665,9 +674,9 @@ namespace PDF_Master.ViewModels.Tools
|
|
|
parameters.Add(ParameterNames.AnnotEvent, e);
|
|
|
parameters.Add(ParameterNames.TextEditToolContentViewModel, this);
|
|
|
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
|
|
- {
|
|
|
- regions.RequestNavigate(RegionNames.PropertyRegionName, btnToProperty[type], parameters);
|
|
|
- }));
|
|
|
+ {
|
|
|
+ regions.RequestNavigate(RegionNames.PropertyRegionName, btnToProperty[type], parameters);
|
|
|
+ }));
|
|
|
|
|
|
if (e != null)
|
|
|
{
|
|
@@ -735,26 +744,45 @@ namespace PDF_Master.ViewModels.Tools
|
|
|
|
|
|
KeyEventsHelper.KeyDown -= ShortCut_KeyDown;
|
|
|
KeyEventsHelper.KeyDown += ShortCut_KeyDown;
|
|
|
+
|
|
|
+ SetDefaultEdit();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void PDFViewer_PDFEditHandler(object sender, List<PDFEditSelectionData> e)
|
|
|
{
|
|
|
- PDFViewer.ClearSelectPDFEdit();
|
|
|
- PDFViewer.SelectPDFEdit(e, true);
|
|
|
+ if (e != null && e.Count > 0)
|
|
|
+ {
|
|
|
+ foreach (var item in e)
|
|
|
+ {
|
|
|
+ if (item is PDFEditSelectionData editSelectionData)
|
|
|
+ {
|
|
|
+ switch (editSelectionData.Action)
|
|
|
+ {
|
|
|
+ case ActionType.Add:
|
|
|
+ PDFViewer.ClearSelectPDFEdit();
|
|
|
+ PDFViewer.SelectPDFEdit(e, true);
|
|
|
+ break;
|
|
|
+
|
|
|
+ case ActionType.Modify:
|
|
|
+
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
protected PDFEditEvent TextEditEvent;
|
|
|
|
|
|
private DefaultEditProperty GetEditDefault(ComPDFKit.PDFPage.CPDFEditType editType)
|
|
|
{
|
|
|
- var edit = SettingHelper.GetPDFEditDefaultProperty(editType);
|
|
|
- if (edit == null)
|
|
|
+ var defaultEdit = SettingHelper.GetPDFEditDefaultProperty(editType);
|
|
|
+ if (defaultEdit == null)
|
|
|
{
|
|
|
- edit = new DefaultEditProperty();
|
|
|
- edit.EditType = editType;
|
|
|
+ defaultEdit = SetDefaultEdit();
|
|
|
}
|
|
|
- return edit;
|
|
|
+ return defaultEdit;
|
|
|
}
|
|
|
|
|
|
//左键激活逻辑
|