internal void PdfViewerControl_ShapeAnnotationSelected(object sender, ShapeAnnotationSelectedEventArgs args) { parent.annotation = sender as ShapeAnnotation; parent.shapeView = args.AnnotationType; if (args.AnnotationType == AnnotationMode.Arrow) { parent.arrowToolbar = CreateSeparateAnnotationToolbar(parent.arrowToolbar, parent.arrowEnable, "\ue712", true, (parent.annotation as ShapeAnnotation).Settings.StrokeColor); parent.isOpacityNeeded = true; parent.textToolbarBackButton.RemoveFromSuperview(); parent.Add(parent.arrowToolbar); } if (args.AnnotationType == AnnotationMode.Line) { parent.lineToolbar = CreateSeparateAnnotationToolbar(parent.lineToolbar, parent.lineEnable, "\ue717", true, (parent.annotation as ShapeAnnotation).Settings.StrokeColor); parent.isOpacityNeeded = true; parent.textToolbarBackButton.RemoveFromSuperview(); parent.Add(parent.lineToolbar); } if (args.AnnotationType == AnnotationMode.Rectangle) { parent.rectangleToolbar = CreateSeparateAnnotationToolbar(parent.rectangleToolbar, parent.rectangleEnable, "\ue705", true, (parent.annotation as ShapeAnnotation).Settings.StrokeColor); parent.isOpacityNeeded = true; parent.textToolbarBackButton.RemoveFromSuperview(); parent.Add(parent.rectangleToolbar); } if (args.AnnotationType == AnnotationMode.Circle) { parent.circleToolbar = CreateSeparateAnnotationToolbar(parent.circleToolbar, parent.circleEnable, "\ue71f", true, (parent.annotation as ShapeAnnotation).Settings.StrokeColor); parent.isOpacityNeeded = true; parent.textToolbarBackButton.RemoveFromSuperview(); parent.Add(parent.circleToolbar); } }
internal void HighlightAnnotationButton_TouchUpInside(object sender, EventArgs e) { parent.pdfViewerControl.AnnotationMode = AnnotationMode.Highlight; parent.textAnnotationToolbar.RemoveFromSuperview(); parent.isAnnotationToolbarVisible = true; parent.deleteButton.RemoveFromSuperview(); parent.highlightToolbar = CreateSeparateAnnotationToolbar(parent.highlightToolbar, parent.highlightEnable, "\ue710", false, parent.pdfViewerControl.AnnotationSettings.TextMarkup.Highlight.Color); parent.Add(parent.highlightToolbar); }
internal void AnnotationButton_TouchUpInside(object sender, EventArgs e) { if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad && parent.bookmarkToolbar != null && parent.bookmarkToolbar.Superview != null) { parent.bookmarkToolbar.RemoveFromSuperview(); parent.isBookmarkPaneVisible = false; } parent.isColorSelected = false; parent.isThicknessTouched = false; parent.isOpacityNeeded = false; parent.annotationToolbar.AutoresizingMask = UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleWidth; if (parent.pdfViewerControl.AnnotationMode == AnnotationMode.Ink) { parent.pdfViewerControl.EndInkSession(false); } if (parent.annotation != null) { parent.inkThicknessButton.Frame = new CGRect(parent.parentView.Frame.Width - 55, 7, 35, 35); parent.inkAnnotationToolbar.Add(parent.inkThicknessButton); parent.inkColorButton.Frame = new CGRect(parent.parentView.Frame.Width - 100, 7, 35, 35); parent.inkAnnotationToolbar.Add(parent.inkColorButton); parent.inkdeleteButton.RemoveFromSuperview(); parent.annotation = null; } if (!parent.isAnnotationToolbarVisible) { int buttonSpacing = (int)((parent.annotationToolbar.Frame.Width - 100) / numberOfButtonsInAnnotationToolbar); int left = 80; parent.thicknessToolbar.RemoveFromSuperview(); parent.toolBar.RemoveFromSuperview(); parent.toolbar = parent.toolBar; parent.toolBarFrame.Height = DefaultToolbarHeight; parent.AddSubview(parent.toolbar); parent.searchToolBar.RemoveFromSuperview(); parent.annotationFrame = parent.Frame; parent.annotationFrame.Height = DefaultToolbarHeight; parent.annotationFrame.Y = parent.parentView.Frame.Height - parent.annotationFrame.Height + 4; parent.annotationToolbar.Frame = parent.annotationFrame; parent.annotationToolbar.BackgroundColor = UIColor.FromRGB(249, 249, 249); if ((UIDevice.CurrentDevice).UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { parent.textMarkupAnnotationButton.Frame = new CGRect(left, 7, 35, 35); } else { parent.textMarkupAnnotationButton.Frame = new CGRect(0, 7, 35, 35); } parent.textMarkupAnnotationButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; parent.textMarkupAnnotationButton.TouchUpInside += parent.helper.TextMarkupAnnotationButton_TouchUpInside; parent.textMarkupAnnotationButton.Font = parent.highFont; parent.textMarkupAnnotationButton.SetTitle("\ue70e", UIControlState.Normal); parent.textMarkupAnnotationButton.SetTitleColor(UIColor.FromRGB(0, 118, 255), UIControlState.Normal); parent.annotationToolbar.Add(parent.textMarkupAnnotationButton); if ((UIDevice.CurrentDevice).UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { parent.inkAnnotationButton.Frame = new CGRect(left + 4 * buttonSpacing, 7, 35, 35); } else { parent.inkAnnotationButton.Frame = new CGRect(105, 7, 35, 35); } parent.inkAnnotationButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; parent.inkAnnotationButton.Font = parent.highFont; parent.inkAnnotationButton.SetTitle("\ue704", UIControlState.Normal); parent.inkAnnotationButton.SetTitleColor(UIColor.FromRGB(0, 118, 255), UIControlState.Normal); parent.annotationToolbar.Add(parent.inkAnnotationButton); if ((UIDevice.CurrentDevice).UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { parent.editTextAnnotationButton.Frame = new CGRect(left + buttonSpacing, 7, 35, 35); } else { parent.editTextAnnotationButton.Frame = new CGRect((165), 7, 35, 35); } parent.editTextAnnotationButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; parent.editTextAnnotationButton.TouchUpInside += parent.edittextHelper.EditTextAnnotationButton_TouchUpInside; parent.editTextAnnotationButton.Font = parent.highFont; parent.editTextAnnotationButton.SetTitle("\ue700", UIControlState.Normal); parent.editTextAnnotationButton.SetTitleColor(UIColor.FromRGB(0, 118, 255), UIControlState.Normal); parent.annotationToolbar.Add(parent.editTextAnnotationButton); if ((UIDevice.CurrentDevice).UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { parent.shapeAnnotationButton.Frame = new CGRect(left + 2 * buttonSpacing, 7, 35, 35); } else { parent.shapeAnnotationButton.Frame = new CGRect(45, 7, 35, 35); } parent.shapeAnnotationButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; parent.shapeAnnotationButton.TouchUpInside += parent.shapeHelper.ShapeAnnotationButton_TouchUpInside; parent.shapeAnnotationButton.Font = parent.highFont; parent.shapeAnnotationButton.SetTitle("\ue721", UIControlState.Normal); parent.shapeAnnotationButton.SetTitleColor(UIColor.FromRGB(0, 118, 255), UIControlState.Normal); parent.annotationToolbar.Add(parent.shapeAnnotationButton); if ((UIDevice.CurrentDevice).UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { parent.signatureButton.Frame = new CGRect(left + 3 * buttonSpacing, 7, 35, 35); } else { parent.signatureButton.Frame = new CGRect(225, 7, 35, 35); } parent.signatureButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; parent.signatureButton.VerticalAlignment = UIControlContentVerticalAlignment.Top; parent.signatureButton.TouchUpInside += SignatureButton_TouchUpInside; parent.signatureButton.Font = parent.signatureFont; parent.signatureButton.SetTitle("\ue702", UIControlState.Normal); parent.signatureButton.SetTitleColor(UIColor.FromRGB(0, 118, 255), UIControlState.Normal); parent.annotationToolbar.Add(parent.signatureButton); if ((UIDevice.CurrentDevice).UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { parent.stampButton.Frame = new CGRect(left + 5 * buttonSpacing, 7, 35, 35); } else { parent.stampButton.Frame = new CGRect(275, 7, 35, 35); } parent.stampButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; parent.stampButton.VerticalAlignment = UIControlContentVerticalAlignment.Top; parent.stampButton.TouchUpInside += StampButton_TouchUpInside; parent.stampButton.Font = parent.stampFont; parent.stampButton.SetTitle("\ue701", UIControlState.Normal); parent.stampButton.SetTitleColor(UIColor.FromRGB(0, 118, 255), UIControlState.Normal); parent.annotationToolbar.Add(parent.stampButton); parent.annotationToolbar = parent.UpdateToolbarBorder(parent.annotationToolbar, parent.annotationFrame); parent.annotationToolbar = parent.UpdateToolbarBorder(parent.annotationToolbar, parent.annotationFrame); parent.Add(parent.annotationToolbar); parent.isAnnotationToolbarVisible = true; parent.highlightToolbar.RemoveFromSuperview(); parent.editStampAnnotationToolbar.RemoveFromSuperview(); parent.strikeOutToolbar.RemoveFromSuperview(); parent.underlineToolbar.RemoveFromSuperview(); parent.colorToolbar.RemoveFromSuperview(); } else { parent.annotHelper.RemoveAllToolbars(false); parent.pdfViewerControl.AnnotationMode = AnnotationMode.None; parent.isAnnotationToolbarVisible = false; } }
internal void PdfViewerControl_FreeTextAnnotationSelected(object sender, FreeTextAnnotationSelectedEventArgs args) { parent.annotation = sender as FreeTextAnnotation; parent.toolbarBackbutton.RemoveFromSuperview(); parent.isOpacityNeeded = false; parent.iseditEnable = true; parent.annotationFrame = parent.Frame; parent.annotationFrame.Height = DefaultToolbarHeight; parent.annotationFrame.Y = parent.parentView.Frame.Height - parent.annotationFrame.Height + 4; parent.editTextAnnotationToolbar.Frame = parent.annotationFrame; parent.editTextAnnotationToolbar.BackgroundColor = UIColor.FromRGB(249, 249, 249); parent.editTextAnnotationToolbar.RemoveFromSuperview(); if ((UIDevice.CurrentDevice).UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) editTextButton.Frame = new CGRect(65, 7, 35, 35); else editTextButton.Frame = new CGRect(40, 7, 35, 35); editTextButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; editTextButton.Font = parent.highFont; editTextButton.SetTitle("\ue700", UIControlState.Normal); editTextButton.SetTitleColor(UIColor.FromRGB(0, 118, 255), UIControlState.Normal); parent.editTextAnnotationToolbar.Add(editTextButton); if (parent.iseditEnable) { editButton.Frame = new CGRect(parent.parentView.Frame.Width - 200, 7, 35, 35); editButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; editButton.Font = parent.highFont; editButton.TouchUpInside += EditButton_TouchUpInside; editButton.SetTitle("\ue720", UIControlState.Normal); editButton.SetTitleColor(UIColor.FromRGB(0, 118, 255), UIControlState.Normal); parent.editTextAnnotationToolbar.Add(editButton); } else { editButton.RemoveFromSuperview(); } parent.edittextThicknessButton.Frame = new CGRect(parent.parentView.Frame.Width - 150, 7, 30, 30); parent.edittextThicknessButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; parent.edittextThicknessButton.Font = parent.fontSizeFont; parent.edittextThicknessButton.SetTitle("\ue700", UIControlState.Normal); parent.edittextThicknessButton.SetTitleColor(UIColor.FromRGB(0, 118, 255), UIControlState.Normal); parent.editTextAnnotationToolbar.Add(parent.edittextThicknessButton); parent.edittextColorButton.Frame = new CGRect(parent.parentView.Frame.Width - 100, 7, 30, 30); parent.edittextColorButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; if (parent.annotation != null) parent.edittextColorButton.BackgroundColor = (parent.annotation as FreeTextAnnotation).Settings.TextColor; else parent.edittextColorButton.BackgroundColor = parent.pdfViewerControl.AnnotationSettings.FreeText.TextColor; parent.editTextAnnotationToolbar.Add(parent.edittextColorButton); parent.editTextAnnotationToolbar = parent.UpdateToolbarBorder(parent.editTextAnnotationToolbar, parent.annotationFrame); parent.Add(parent.editTextAnnotationToolbar); parent.edittextDeleteButton.Frame = new CGRect(parent.parentView.Frame.Width - 55, 7, 35, 35); parent.edittextDeleteButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; parent.edittextDeleteButton.TouchUpInside += parent.inkHelper.InkdeleteButton_TouchUpInside; parent.edittextDeleteButton.Font = parent.highFont; parent.edittextDeleteButton.SetTitle("\ue714", UIControlState.Normal); parent.edittextDeleteButton.SetTitleColor(UIColor.FromRGB(0, 118, 255), UIControlState.Normal); parent.editTextAnnotationToolbar.Add(parent.edittextDeleteButton); }