|
@@ -363,10 +363,10 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
{
|
|
|
PdfViewControl.PDFViewTool.GetCPDFViewer().UndoManager.PropertyChanged -= UndoManager_PropertyChanged;
|
|
|
PdfViewControl.PDFViewTool.GetCPDFViewer().UndoManager.PropertyChanged += UndoManager_PropertyChanged;
|
|
|
- //PdfViewControl.MouseLeftButtonDownHandler -= PDFToolManager_MouseLeftButtonDownHandler;
|
|
|
- //PdfViewControl.MouseLeftButtonDownHandler += PDFToolManager_MouseLeftButtonDownHandler;
|
|
|
- //PdfViewControl.MouseLeftButtonUpHandler -= PDFToolManager_MouseLeftButtonUpHandler;
|
|
|
- //PdfViewControl.MouseLeftButtonUpHandler += PDFToolManager_MouseLeftButtonUpHandler;
|
|
|
+ PdfViewControl.MouseLeftButtonDownHandler -= PDFToolManager_MouseLeftButtonDownHandler;
|
|
|
+ PdfViewControl.MouseLeftButtonDownHandler += PDFToolManager_MouseLeftButtonDownHandler;
|
|
|
+ PdfViewControl.MouseLeftButtonUpHandler -= PDFToolManager_MouseLeftButtonUpHandler;
|
|
|
+ PdfViewControl.MouseLeftButtonUpHandler += PDFToolManager_MouseLeftButtonUpHandler;
|
|
|
PdfViewControl.MouseRightButtonDownHandler -= PdfViewControl_MouseRightButtonDownHandler;
|
|
|
PdfViewControl.MouseRightButtonDownHandler += PdfViewControl_MouseRightButtonDownHandler;
|
|
|
PdfViewControl = view;
|
|
@@ -673,7 +673,7 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
{
|
|
|
int index = -1;
|
|
|
CPDFEditImageArea imageArea = PdfViewControl.PDFToolManager.GetSelectedEditAreaObject(ref index) as CPDFEditImageArea;
|
|
|
-
|
|
|
+
|
|
|
MenuItem rotateLeftMenu = new MenuItem();
|
|
|
rotateLeftMenu.Header = LanguageHelper.CommonManager.GetString("Menu_RotateLeft");
|
|
|
rotateLeftMenu.Click += (o, p) =>
|
|
@@ -686,14 +686,119 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
}
|
|
|
};
|
|
|
menu.Items.Add(rotateLeftMenu);
|
|
|
- if (BotaContainer.Child is CPDFBOTABarControl botaControl)
|
|
|
+
|
|
|
+ MenuItem rotateRightMenu = new MenuItem();
|
|
|
+ rotateRightMenu.Header = LanguageHelper.CommonManager.GetString("Menu_RotateRight");
|
|
|
+ rotateRightMenu.Click += (o, p) =>
|
|
|
{
|
|
|
- botaControl.ReplaceFunctionEnabled = false;
|
|
|
- }
|
|
|
- PDFGrid.Child = null;
|
|
|
- BotaContainer.Child = null;
|
|
|
- PropertyContainer.Child = null;
|
|
|
- displaySettingsControl = null;
|
|
|
+ if (imageArea != null)
|
|
|
+ {
|
|
|
+ imageArea.Rotate(90);
|
|
|
+ pdfContentEditControl.RefreshThumb();
|
|
|
+ UpdateImageArea(imageArea);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ menu.Items.Add(rotateRightMenu);
|
|
|
+
|
|
|
+ MenuItem replaceMenu = new MenuItem();
|
|
|
+ replaceMenu.Header = LanguageHelper.CommonManager.GetString("Menu_Replace");
|
|
|
+ replaceMenu.Click += (o, p) =>
|
|
|
+ {
|
|
|
+ if (imageArea != null)
|
|
|
+ {
|
|
|
+ OpenFileDialog openFileDialog = new OpenFileDialog();
|
|
|
+ openFileDialog.Filter = "Image Files(*.jpg;*.jpeg;*.png;*.bmp)|*.jpg;*.jpeg;*.png;*.bmp;";
|
|
|
+ if (openFileDialog.ShowDialog() == true)
|
|
|
+ {
|
|
|
+ //byte[] fileData = File.ReadAllBytes(openFileDialog.FileName);
|
|
|
+ //Bitmap bitmap = new Bitmap(openFileDialog.FileName);
|
|
|
+ //imageArea.ReplaceImageArea(imageArea.GetFrame(), fileData, bitmap.Width, bitmap.Height);
|
|
|
+ imageArea.ReplaceImageArea(imageArea.GetFrame(), openFileDialog.FileName,string.Empty);
|
|
|
+ pdfContentEditControl.RefreshThumb();
|
|
|
+ UpdateImageArea(imageArea);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ menu.Items.Add(replaceMenu);
|
|
|
+
|
|
|
+ MenuItem exportMenu = new MenuItem();
|
|
|
+ exportMenu.Header = LanguageHelper.CommonManager.GetString("Menu_Export");
|
|
|
+ exportMenu.Click += (o, p) =>
|
|
|
+ {
|
|
|
+ if (PdfViewControl != null && PdfViewControl.PDFView != null)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();
|
|
|
+ if (folderBrowserDialog.ShowDialog() == DialogResult.OK && imageArea != null)
|
|
|
+ {
|
|
|
+ string path = Path.GetTempPath();
|
|
|
+ string uuid = Guid.NewGuid().ToString("N");
|
|
|
+ string imagePath = Path.Combine(path, uuid + ".tmp");
|
|
|
+ imageArea.ExtractImage(imagePath);
|
|
|
+
|
|
|
+ Bitmap bitmapImage = new Bitmap(imagePath);
|
|
|
+ string fileName = Path.Combine(folderBrowserDialog.SelectedPath, uuid + ".jpg");
|
|
|
+ bitmapImage.Save(fileName, System.Drawing.Imaging.ImageFormat.Jpeg);
|
|
|
+ Process.Start("explorer", "/select,\"" + fileName + "\"");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ menu.Items.Add(exportMenu);
|
|
|
+
|
|
|
+ MenuItem opacityMenu = new MenuItem();
|
|
|
+ opacityMenu.Header = LanguageHelper.CommonManager.GetString("Menu_Opacity");
|
|
|
+ menu.Items.Add(opacityMenu);
|
|
|
+
|
|
|
+ AppendOpacityMenu(opacityMenu, imageArea, CPDFEditType.EditImage);
|
|
|
+
|
|
|
+ MenuItem horizonMirror = new MenuItem();
|
|
|
+ horizonMirror.Header = LanguageHelper.CommonManager.GetString("Menu_HFlip");
|
|
|
+ horizonMirror.Click += (o, p) =>
|
|
|
+ {
|
|
|
+ imageArea?.HorizontalMirror();
|
|
|
+ pdfContentEditControl.RefreshThumb();
|
|
|
+ UpdateImageArea(imageArea);
|
|
|
+ };
|
|
|
+ menu.Items.Add(horizonMirror);
|
|
|
+
|
|
|
+ MenuItem verticalMirror = new MenuItem();
|
|
|
+ verticalMirror.Header = LanguageHelper.CommonManager.GetString("Menu_VFlip");
|
|
|
+ verticalMirror.Click += (o, p) =>
|
|
|
+ {
|
|
|
+ if (imageArea != null)
|
|
|
+ {
|
|
|
+ imageArea?.VerticalMirror();
|
|
|
+ pdfContentEditControl.RefreshThumb();
|
|
|
+ UpdateImageArea(imageArea);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ menu.Items.Add(verticalMirror);
|
|
|
+
|
|
|
+ MenuItem cropMenu = new MenuItem();
|
|
|
+ cropMenu.Header = LanguageHelper.CommonManager.GetString("Menu_Crop");
|
|
|
+ cropMenu.Click += (o, p) =>
|
|
|
+ {
|
|
|
+ if (imageArea != null)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ };
|
|
|
+ menu.Items.Add(cropMenu);
|
|
|
+
|
|
|
+ menu.Items.Add(new MenuItem() { Header = LanguageHelper.CommonManager.GetString("Menu_Copy"), Command = ApplicationCommands.Copy, CommandTarget = (UIElement)sender });
|
|
|
+ menu.Items.Add(new MenuItem() { Header = LanguageHelper.CommonManager.GetString("Menu_Cut"), Command = ApplicationCommands.Cut, CommandTarget = (UIElement)sender });
|
|
|
+ menu.Items.Add(new MenuItem() { Header = LanguageHelper.CommonManager.GetString("Menu_Delete"), Command = ApplicationCommands.Delete, CommandTarget = (UIElement)sender });
|
|
|
+ menu.Items.Add(new MenuItem() { Header = LanguageHelper.CommonManager.GetString("Menu_Paste"), Command = ApplicationCommands.Paste, CommandTarget = (UIElement)sender });
|
|
|
+ // if (editCommand.TextAreaCopied)
|
|
|
+ // {
|
|
|
+ // menu.Items.Add(new MenuItem() { Header = LanguageHelper.CommonManager.GetString("Menu_MatchPaste"), Command = CustomCommands.PasteWithoutStyle, CommandTarget = (UIElement)sender });
|
|
|
+ // }
|
|
|
}
|
|
|
|
|
|
#region Property changed
|