|
@@ -1,5 +1,6 @@
|
|
using ComPDFKit.PDFDocument;
|
|
using ComPDFKit.PDFDocument;
|
|
using ComPDFKit.PDFPage;
|
|
using ComPDFKit.PDFPage;
|
|
|
|
+using ComPDFKit.PDFPage.Edit;
|
|
using Compdfkit_Tools.Edit;
|
|
using Compdfkit_Tools.Edit;
|
|
using Compdfkit_Tools.Helper;
|
|
using Compdfkit_Tools.Helper;
|
|
using Compdfkit_Tools.PDFControl;
|
|
using Compdfkit_Tools.PDFControl;
|
|
@@ -18,6 +19,7 @@ using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Controls.Primitives;
|
|
using System.Windows.Controls.Primitives;
|
|
using System.Windows.Input;
|
|
using System.Windows.Input;
|
|
|
|
+using System.Windows.Media;
|
|
using System.Windows.Media.Imaging;
|
|
using System.Windows.Media.Imaging;
|
|
|
|
|
|
namespace ContentEditor
|
|
namespace ContentEditor
|
|
@@ -83,6 +85,8 @@ namespace ContentEditor
|
|
|
|
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|
|
|
|
|
|
|
+ private PDFEditEvent pdfTextCreateParam;
|
|
|
|
+
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
public MainWindow()
|
|
public MainWindow()
|
|
@@ -190,7 +194,7 @@ namespace ContentEditor
|
|
}
|
|
}
|
|
|
|
|
|
#endregion
|
|
#endregion
|
|
-
|
|
|
|
|
|
+
|
|
#region Expand and collapse Panel
|
|
#region Expand and collapse Panel
|
|
|
|
|
|
private void ExpandLeftPanel(bool isExpand)
|
|
private void ExpandLeftPanel(bool isExpand)
|
|
@@ -212,7 +216,7 @@ namespace ContentEditor
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
#region Context menu
|
|
#region Context menu
|
|
-
|
|
|
|
|
|
+
|
|
private void PDFView_AnnotCommandHandler(object sender, AnnotCommandArgs e)
|
|
private void PDFView_AnnotCommandHandler(object sender, AnnotCommandArgs e)
|
|
{
|
|
{
|
|
if (e != null && e.CommandType == CommandType.Context)
|
|
if (e != null && e.CommandType == CommandType.Context)
|
|
@@ -557,6 +561,7 @@ namespace ContentEditor
|
|
editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Copy", Command = ApplicationCommands.Copy, CommandTarget = (UIElement)sender });
|
|
editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Copy", Command = ApplicationCommands.Copy, CommandTarget = (UIElement)sender });
|
|
editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Cut", Command = ApplicationCommands.Cut, CommandTarget = (UIElement)sender });
|
|
editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Cut", Command = ApplicationCommands.Cut, CommandTarget = (UIElement)sender });
|
|
editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Delete", Command = ApplicationCommands.Delete, CommandTarget = (UIElement)sender });
|
|
editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Delete", Command = ApplicationCommands.Delete, CommandTarget = (UIElement)sender });
|
|
|
|
+ editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Paste", Command = ApplicationCommands.Paste, CommandTarget = (UIElement)sender });
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
@@ -588,7 +593,7 @@ namespace ContentEditor
|
|
parentMenu.Items.Add(opacityMenu);
|
|
parentMenu.Items.Add(opacityMenu);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
private void PDFEditTextContextMenu(object sender, PDFEditCommand editCommand)
|
|
private void PDFEditTextContextMenu(object sender, PDFEditCommand editCommand)
|
|
{
|
|
{
|
|
editCommand.PopupMenu = new ContextMenu();
|
|
editCommand.PopupMenu = new ContextMenu();
|
|
@@ -812,6 +817,25 @@ namespace ContentEditor
|
|
pdfViewControl.PDFView?.SetPDFEditCreateType(CPDFEditType.EditText);
|
|
pdfViewControl.PDFView?.SetPDFEditCreateType(CPDFEditType.EditText);
|
|
pdfViewControl.PDFView?.SetMouseMode(MouseModes.PDFEdit);
|
|
pdfViewControl.PDFView?.SetMouseMode(MouseModes.PDFEdit);
|
|
pdfViewControl.PDFView?.ReloadDocument();
|
|
pdfViewControl.PDFView?.ReloadDocument();
|
|
|
|
+ PDFEditEvent createParam = new PDFEditEvent();
|
|
|
|
+ createParam.EditType = CPDFEditType.EditText;
|
|
|
|
+ createParam.IsBold = true;
|
|
|
|
+ createParam.IsItalic = true;
|
|
|
|
+ createParam.FontSize = 14;
|
|
|
|
+ createParam.FontName = "Courier New";
|
|
|
|
+ createParam.FontColor = Colors.Red;
|
|
|
|
+ createParam.TextAlign = TextAlignType.AlignRight;
|
|
|
|
+ createParam.Transparency = 100;
|
|
|
|
+ pdfViewControl.PDFView?.SetPDFEditParam(createParam);
|
|
|
|
+ if (textEditControl == null)
|
|
|
|
+ {
|
|
|
|
+ textEditControl = new PDFTextEditControl();
|
|
|
|
+ }
|
|
|
|
+ textEditControl.SetPDFTextEditData(createParam);
|
|
|
|
+ PropertyContainer.Child = textEditControl;
|
|
|
|
+ PropertyContainer.Visibility = Visibility.Visible;
|
|
|
|
+ RightPanelBtn.IsChecked = true;
|
|
|
|
+ pdfTextCreateParam = createParam;
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
@@ -888,7 +912,7 @@ namespace ContentEditor
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
#region Property changed
|
|
#region Property changed
|
|
-
|
|
|
|
|
|
+
|
|
protected void OnPropertyChanged([CallerMemberName] string name = null)
|
|
protected void OnPropertyChanged([CallerMemberName] string name = null)
|
|
{
|
|
{
|
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
|
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
|
|
@@ -902,7 +926,7 @@ namespace ContentEditor
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
#region Event handle
|
|
#region Event handle
|
|
-
|
|
|
|
|
|
+
|
|
private void PDFView_PDFEditCommandHandler(object sender, PDFEditCommand e)
|
|
private void PDFView_PDFEditCommandHandler(object sender, PDFEditCommand e)
|
|
{
|
|
{
|
|
if (e == null)
|
|
if (e == null)
|
|
@@ -930,9 +954,21 @@ namespace ContentEditor
|
|
ViewSettingBtn.IsChecked = false;
|
|
ViewSettingBtn.IsChecked = false;
|
|
if (e == null)
|
|
if (e == null)
|
|
{
|
|
{
|
|
- PropertyContainer.Child = null;
|
|
|
|
- RightPanelBtn.IsChecked = false;
|
|
|
|
- PropertyContainer.Visibility = Visibility.Collapsed;
|
|
|
|
|
|
+ PropertyContainer.Child = empytPanel;
|
|
|
|
+ if (pdfTextCreateParam != null && pdfViewControl != null && pdfViewControl.PDFView != null)
|
|
|
|
+ {
|
|
|
|
+ if (pdfViewControl.PDFView.GetPDFEditCreateType() == CPDFEditType.EditText)
|
|
|
|
+ {
|
|
|
|
+ if (textEditControl == null)
|
|
|
|
+ {
|
|
|
|
+ textEditControl = new PDFTextEditControl();
|
|
|
|
+ }
|
|
|
|
+ textEditControl.SetPDFTextEditData(pdfTextCreateParam);
|
|
|
|
+ PropertyContainer.Child = textEditControl;
|
|
|
|
+ PropertyContainer.Visibility = Visibility.Visible;
|
|
|
|
+ RightPanelBtn.IsChecked = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|