|
@@ -83,65 +83,7 @@ namespace Compdfkit_Tools.PDFControl
|
|
InitializeComponent();
|
|
InitializeComponent();
|
|
DataContext = this;
|
|
DataContext = this;
|
|
}
|
|
}
|
|
-
|
|
|
|
- private void PanelState_PropertyChanged(object sender, PropertyChangedEventArgs e)
|
|
|
|
- {
|
|
|
|
- if (e.PropertyName == nameof(PanelState.IsLeftPanelExpand))
|
|
|
|
- {
|
|
|
|
- ExpandLeftPanel(panelState.IsLeftPanelExpand);
|
|
|
|
- }
|
|
|
|
- else if (e.PropertyName == nameof(PanelState.RightPanel))
|
|
|
|
- {
|
|
|
|
- if (panelState.RightPanel == PanelState.RightPanelState.PropertyPanel)
|
|
|
|
- {
|
|
|
|
- ExpandRightPropertyPanel(FromPropertyControl, Visibility.Visible);
|
|
|
|
- }
|
|
|
|
- else if (panelState.RightPanel == PanelState.RightPanelState.ViewSettings)
|
|
|
|
- {
|
|
|
|
- ExpandRightPropertyPanel(displaySettingsControl, Visibility.Visible);
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- ExpandRightPropertyPanel(null, Visibility.Collapsed);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- #region Init PDFViewer
|
|
|
|
-
|
|
|
|
- public void InitWithPDFViewer(CPDFViewer pdfViewer)
|
|
|
|
- {
|
|
|
|
- PdfViewControl.PDFView = pdfViewer;
|
|
|
|
- PDFFormTool.InitWithPDFViewer(pdfViewer, FromPropertyControl);
|
|
|
|
- FloatPageTool.InitWithPDFViewer(pdfViewer);
|
|
|
|
- PDFGrid.Child = PdfViewControl;
|
|
|
|
-
|
|
|
|
- panelState.PropertyChanged -= PanelState_PropertyChanged;
|
|
|
|
- panelState.PropertyChanged += PanelState_PropertyChanged;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public void SetBOTAContainer(CPDFBOTABarControl botaControl)
|
|
|
|
- {
|
|
|
|
- this.BotaContainer.Child = botaControl;
|
|
|
|
- }
|
|
|
|
|
|
|
|
- public void SetDisplaySettingsControl(CPDFDisplaySettingsControl displaySettingsControl)
|
|
|
|
- {
|
|
|
|
- this.displaySettingsControl = displaySettingsControl;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public void ClearAllToolState()
|
|
|
|
- {
|
|
|
|
- this.PDFFormTool.ClearAllToolState();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public void SetToolBarContainerVisibility(Visibility visibility)
|
|
|
|
- {
|
|
|
|
- this.ToolBarContainer.Visibility = visibility;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- #endregion
|
|
|
|
-
|
|
|
|
#region Load Unload custom control
|
|
#region Load Unload custom control
|
|
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
|
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
|
{
|
|
{
|
|
@@ -156,16 +98,6 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
|
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
- #region Form
|
|
|
|
-
|
|
|
|
- public void SetViewSettings(Visibility visibility, CPDFDisplaySettingsControl displaySettingsControl = null)
|
|
|
|
- {
|
|
|
|
- this.PropertyContainer.Child = displaySettingsControl;
|
|
|
|
- this.PropertyContainer.Visibility = visibility;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- #endregion
|
|
|
|
-
|
|
|
|
#region Expand and collapse Panel
|
|
#region Expand and collapse Panel
|
|
|
|
|
|
public void ExpandRightPropertyPanel(UIElement propertytPanel, Visibility visible)
|
|
public void ExpandRightPropertyPanel(UIElement propertytPanel, Visibility visible)
|
|
@@ -193,7 +125,7 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
|
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
- #region Event handle
|
|
|
|
|
|
+ #region Private Command Method
|
|
private void PDFView_WidgetClickHandler(object sender, WidgetArgs e)
|
|
private void PDFView_WidgetClickHandler(object sender, WidgetArgs e)
|
|
{
|
|
{
|
|
if (e is WidgetSignArgs)
|
|
if (e is WidgetSignArgs)
|
|
@@ -290,58 +222,7 @@ namespace Compdfkit_Tools.PDFControl
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- #endregion
|
|
|
|
-
|
|
|
|
- public void InitialPDFViewControl(PDFViewControl newPDFViewer)
|
|
|
|
- {
|
|
|
|
- PDFFormTool.InitWithPDFViewer(newPDFViewer.PDFView, FromPropertyControl);
|
|
|
|
- FromPropertyControl.SetPDFViewer(newPDFViewer.PDFView);
|
|
|
|
- PDFFormTool.ClearAllToolState();
|
|
|
|
- newPDFViewer.PDFView.AnnotEditHandler -= PDFView_AnnotEditHandler;
|
|
|
|
- newPDFViewer.PDFView.AnnotActiveHandler -= PDFView_AnnotActiveHandler;
|
|
|
|
- newPDFViewer.PDFView.WidgetClickHandler -= PDFView_WidgetClickHandler;
|
|
|
|
- PdfViewControl.PDFView.UndoManager.PropertyChanged -= UndoManager_PropertyChanged;
|
|
|
|
- PdfViewControl.PDFView.UndoManager.PropertyChanged += UndoManager_PropertyChanged;
|
|
|
|
- newPDFViewer.PDFView.AnnotEditHandler += PDFView_AnnotEditHandler;
|
|
|
|
- newPDFViewer.PDFView.AnnotActiveHandler += PDFView_AnnotActiveHandler;
|
|
|
|
- newPDFViewer.PDFView.WidgetClickHandler += PDFView_WidgetClickHandler;
|
|
|
|
- newPDFViewer.CustomSignHandle = true;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public void UnloadEvent()
|
|
|
|
- {
|
|
|
|
- PdfViewControl.PDFView.AnnotEditHandler -= PDFView_AnnotEditHandler;
|
|
|
|
- PdfViewControl.PDFView.AnnotActiveHandler -= PDFView_AnnotActiveHandler;
|
|
|
|
- PdfViewControl.PDFView.WidgetClickHandler -= PDFView_WidgetClickHandler;
|
|
|
|
- //panelState.PropertyChanged -= PanelState_PropertyChanged;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public void ClearViewerControl()
|
|
|
|
- {
|
|
|
|
- PDFGrid.Child = null;
|
|
|
|
- BotaContainer.Child = null;
|
|
|
|
- PropertyContainer.Child = null;
|
|
|
|
- displaySettingsControl = null;
|
|
|
|
- }
|
|
|
|
|
|
|
|
- #region Property changed
|
|
|
|
- protected void OnPropertyChanged([CallerMemberName] string name = null)
|
|
|
|
- {
|
|
|
|
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- public void UndoManager_PropertyChanged(object sender, PropertyChangedEventArgs e)
|
|
|
|
- {
|
|
|
|
- OnPropertyChanged(e.PropertyName);
|
|
|
|
- if (e.PropertyName == "CanSave")
|
|
|
|
- {
|
|
|
|
- OnCanSaveChanged?.Invoke(this, CanSave);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- #endregion
|
|
|
|
-
|
|
|
|
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)
|
|
@@ -548,5 +429,112 @@ namespace Compdfkit_Tools.PDFControl
|
|
PdfViewControl.PDFView.UndoManager?.Redo();
|
|
PdfViewControl.PDFView.UndoManager?.Redo();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ protected void OnPropertyChanged([CallerMemberName] string name = null)
|
|
|
|
+ {
|
|
|
|
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void PanelState_PropertyChanged(object sender, PropertyChangedEventArgs e)
|
|
|
|
+ {
|
|
|
|
+ if (e.PropertyName == nameof(PanelState.IsLeftPanelExpand))
|
|
|
|
+ {
|
|
|
|
+ ExpandLeftPanel(panelState.IsLeftPanelExpand);
|
|
|
|
+ }
|
|
|
|
+ else if (e.PropertyName == nameof(PanelState.RightPanel))
|
|
|
|
+ {
|
|
|
|
+ if (panelState.RightPanel == PanelState.RightPanelState.PropertyPanel)
|
|
|
|
+ {
|
|
|
|
+ ExpandRightPropertyPanel(FromPropertyControl, Visibility.Visible);
|
|
|
|
+ }
|
|
|
|
+ else if (panelState.RightPanel == PanelState.RightPanelState.ViewSettings)
|
|
|
|
+ {
|
|
|
|
+ ExpandRightPropertyPanel(displaySettingsControl, Visibility.Visible);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ ExpandRightPropertyPanel(null, Visibility.Collapsed);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void UndoManager_PropertyChanged(object sender, PropertyChangedEventArgs e)
|
|
|
|
+ {
|
|
|
|
+ OnPropertyChanged(e.PropertyName);
|
|
|
|
+ if (e.PropertyName == "CanSave")
|
|
|
|
+ {
|
|
|
|
+ OnCanSaveChanged?.Invoke(this, CanSave);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
|
|
+ #region Public Method
|
|
|
|
+
|
|
|
|
+ public void InitWithPDFViewer(CPDFViewer pdfViewer)
|
|
|
|
+ {
|
|
|
|
+ PdfViewControl.PDFView = pdfViewer;
|
|
|
|
+ PDFFormTool.InitWithPDFViewer(pdfViewer, FromPropertyControl);
|
|
|
|
+ FloatPageTool.InitWithPDFViewer(pdfViewer);
|
|
|
|
+ PDFGrid.Child = PdfViewControl;
|
|
|
|
+
|
|
|
|
+ panelState.PropertyChanged -= PanelState_PropertyChanged;
|
|
|
|
+ panelState.PropertyChanged += PanelState_PropertyChanged;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void SetBOTAContainer(CPDFBOTABarControl botaControl)
|
|
|
|
+ {
|
|
|
|
+ this.BotaContainer.Child = botaControl;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void SetDisplaySettingsControl(CPDFDisplaySettingsControl displaySettingsControl)
|
|
|
|
+ {
|
|
|
|
+ this.displaySettingsControl = displaySettingsControl;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void ClearAllToolState()
|
|
|
|
+ {
|
|
|
|
+ this.PDFFormTool.ClearAllToolState();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void SetToolBarContainerVisibility(Visibility visibility)
|
|
|
|
+ {
|
|
|
|
+ this.ToolBarContainer.Visibility = visibility;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void InitialPDFViewControl(PDFViewControl newPDFViewer)
|
|
|
|
+ {
|
|
|
|
+ PDFFormTool.InitWithPDFViewer(newPDFViewer.PDFView, FromPropertyControl);
|
|
|
|
+ FromPropertyControl.SetPDFViewer(newPDFViewer.PDFView);
|
|
|
|
+ PDFFormTool.ClearAllToolState();
|
|
|
|
+ newPDFViewer.PDFView.AnnotEditHandler -= PDFView_AnnotEditHandler;
|
|
|
|
+ newPDFViewer.PDFView.AnnotActiveHandler -= PDFView_AnnotActiveHandler;
|
|
|
|
+ newPDFViewer.PDFView.WidgetClickHandler -= PDFView_WidgetClickHandler;
|
|
|
|
+ PdfViewControl.PDFView.UndoManager.PropertyChanged -= UndoManager_PropertyChanged;
|
|
|
|
+ PdfViewControl.PDFView.UndoManager.PropertyChanged += UndoManager_PropertyChanged;
|
|
|
|
+ newPDFViewer.PDFView.AnnotEditHandler += PDFView_AnnotEditHandler;
|
|
|
|
+ newPDFViewer.PDFView.AnnotActiveHandler += PDFView_AnnotActiveHandler;
|
|
|
|
+ newPDFViewer.PDFView.WidgetClickHandler += PDFView_WidgetClickHandler;
|
|
|
|
+ newPDFViewer.CustomSignHandle = true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void UnloadEvent()
|
|
|
|
+ {
|
|
|
|
+ PdfViewControl.PDFView.AnnotEditHandler -= PDFView_AnnotEditHandler;
|
|
|
|
+ PdfViewControl.PDFView.AnnotActiveHandler -= PDFView_AnnotActiveHandler;
|
|
|
|
+ PdfViewControl.PDFView.WidgetClickHandler -= PDFView_WidgetClickHandler;
|
|
|
|
+ //panelState.PropertyChanged -= PanelState_PropertyChanged;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void ClearViewerControl()
|
|
|
|
+ {
|
|
|
|
+ PDFGrid.Child = null;
|
|
|
|
+ BotaContainer.Child = null;
|
|
|
|
+ PropertyContainer.Child = null;
|
|
|
|
+ displaySettingsControl = null;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|