|
@@ -26,8 +26,9 @@ using System.Windows.Navigation;
|
|
|
using System.Windows.Shapes;
|
|
|
using System.Drawing;
|
|
|
using Path = System.IO.Path;
|
|
|
+using Compdfkit_Tools.Measure;
|
|
|
|
|
|
-namespace PDFMeasure
|
|
|
+namespace Measure
|
|
|
{
|
|
|
/// <summary>
|
|
|
/// MainWindow.xaml 的交互逻辑
|
|
@@ -37,6 +38,8 @@ namespace PDFMeasure
|
|
|
#region Property
|
|
|
private PDFViewControl passwordViewer;
|
|
|
private PDFViewControl pdfViewControl;
|
|
|
+
|
|
|
+ private MeasureControl measureControl = new MeasureControl();
|
|
|
CPDFDisplaySettingsControl displayPanel = new CPDFDisplaySettingsControl();
|
|
|
|
|
|
private int[] zoomLevelList = { 10, 25, 50, 100, 150, 200, 300, 400, 500, 1000 };
|
|
@@ -98,12 +101,11 @@ namespace PDFMeasure
|
|
|
CPDFSaclingControl.InitWithPDFViewer(pdfViewControl.PDFView);
|
|
|
CPDFSaclingControl.SetZoomTextBoxText(string.Format("{0}", (int)(pdfViewControl.PDFView.ZoomFactor * 100)));
|
|
|
|
|
|
- FloatPageTool.InitWithPDFViewer(pdfViewControl.PDFView);
|
|
|
BotaSideTool.InitWithPDFViewer(pdfViewControl.PDFView);
|
|
|
BotaSideTool.SelectBotaTool(BOTATools.Thumbnail);
|
|
|
ViewSettingBtn.IsChecked = false;
|
|
|
- PropertyContainer.Child = null;
|
|
|
- PropertyContainer.Visibility = Visibility.Collapsed;
|
|
|
+
|
|
|
+ LoadMeasureRes();
|
|
|
}
|
|
|
|
|
|
private void LoadDefaultDocument()
|
|
@@ -227,18 +229,53 @@ namespace PDFMeasure
|
|
|
|
|
|
private void ShowViewSettings()
|
|
|
{
|
|
|
+ if (RightPanelButton != null)
|
|
|
+ {
|
|
|
+ if (RightPanelButton.IsChecked == true)
|
|
|
+ {
|
|
|
+ RightPanelButton.IsChecked = false;
|
|
|
+ measureControl.ExpandRightPropertyPanel(Visibility.Collapsed);
|
|
|
+ }
|
|
|
+ }
|
|
|
if (ViewSettingBtn != null)
|
|
|
{
|
|
|
if (ViewSettingBtn.IsChecked == true)
|
|
|
{
|
|
|
- displayPanel.InitWithPDFViewer(pdfViewControl.PDFView);
|
|
|
- PropertyContainer.Child = displayPanel;
|
|
|
- PropertyContainer.Visibility = Visibility.Visible;
|
|
|
+ measureControl.ExpandViewSettings(Visibility.Visible);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- PropertyContainer.Child = null;
|
|
|
- PropertyContainer.Visibility = Visibility.Collapsed;
|
|
|
+ measureControl.ExpandViewSettings(Visibility.Collapsed);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void ControlRightPanel()
|
|
|
+ {
|
|
|
+ if (ViewSettingBtn != null)
|
|
|
+ {
|
|
|
+ if (ViewSettingBtn.IsChecked == true)
|
|
|
+ {
|
|
|
+ ViewSettingBtn.IsChecked = false;
|
|
|
+ measureControl.ExpandViewSettings(Visibility.Collapsed);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (RightPanelButton != null)
|
|
|
+ {
|
|
|
+ if (RightPanelButton.IsChecked == true)
|
|
|
+ {
|
|
|
+ if (measureControl.FromPropertyControl != null)
|
|
|
+ {
|
|
|
+ measureControl.ExpandRightPropertyPanel(Visibility.Visible);
|
|
|
+ if ((bool)ViewSettingBtn.IsChecked)
|
|
|
+ {
|
|
|
+ ViewSettingBtn.IsChecked = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ measureControl.ExpandRightPropertyPanel(Visibility.Collapsed);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -248,6 +285,11 @@ namespace PDFMeasure
|
|
|
ShowViewSettings();
|
|
|
}
|
|
|
|
|
|
+ private void RightPanelButton_Click(object sender, RoutedEventArgs e)
|
|
|
+ {
|
|
|
+ ControlRightPanel();
|
|
|
+ }
|
|
|
+
|
|
|
private void ZoomInBtn_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
if (pdfViewControl != null)
|
|
@@ -747,5 +789,43 @@ namespace PDFMeasure
|
|
|
{
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ #region Measure
|
|
|
+
|
|
|
+ private void LoadMeasureRes()
|
|
|
+ {
|
|
|
+ displayPanel.InitWithPDFViewer(pdfViewControl.PDFView);
|
|
|
+ measureControl.InitWithPDFViewer(pdfViewControl.PDFView);
|
|
|
+ measureControl.SetSettingsControl(displayPanel);
|
|
|
+ PDFGrid.Child = measureControl;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
+ {
|
|
|
+ var item = (sender as ComboBox).SelectedItem as ComboBoxItem;
|
|
|
+ //if ((string)item.Content == "Viewer")
|
|
|
+ //{
|
|
|
+ // measureControl.ClearAllToolState();
|
|
|
+ // measureControl.SetToolBarContainerVisibility(Visibility.Collapsed);
|
|
|
+ // measureControl.ExpandRightPropertyPanel(null, Visibility.Collapsed);
|
|
|
+ // //formControl.FromPropertyControl.AnnotationCancel();
|
|
|
+ // RightPanelButton.IsChecked = false;
|
|
|
+ // if (measureControl.PdfViewControl != null && measureControl.PdfViewControl.PDFView != null)
|
|
|
+ // {
|
|
|
+ // measureControl.PdfViewControl.PDFView.SetMouseMode(MouseModes.Viewer);
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ //else if ((string)item.Content == "Form")
|
|
|
+ //{
|
|
|
+ // measureControl.SetToolBarContainerVisibility(Visibility.Visible);
|
|
|
+ // if (measureControl.PdfViewControl != null && measureControl.PdfViewControl.PDFView != null)
|
|
|
+ // {
|
|
|
+ // measureControl.PdfViewControl.PDFView.SetMouseMode(MouseModes.FormEditTool);
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ #endregion
|
|
|
}
|
|
|
}
|