12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- //
- // CPDFStrikeoutViewController.m
- // ComPDFKit_Tools
- // Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
- //
- // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
- // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
- // UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
- // This notice may not be removed from this file.
- //
- #import "CPDFStrikeoutViewController.h"
- #import "CPDFAnnotationBaseViewController_Header.h"
- @interface CPDFStrikeoutViewController ()
- @end
- @implementation CPDFStrikeoutViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view.
- }
- - (void)commomInitTitle {
- self.titleLabel.text = NSLocalizedString(@"Strikeout", nil);
- self.sampleView.selecIndex = CPDFSamplesStrikeout;
- self.colorView.selectedColor = self.annotStyle.color;
- }
- - (void)commomInitFromAnnotStyle {
- self.sampleView.color = self.annotStyle.color;
- self.sampleView.opcity = self.annotStyle.opacity;
-
- self.opacitySliderView.opacitySlider.value = self.annotStyle.opacity;
- self.opacitySliderView.startLabel.text = [NSString stringWithFormat:@"%d%%", (int)((self.opacitySliderView.opacitySlider.value/1)*100)];
- [self.sampleView setNeedsDisplay];
- }
- #pragma mark - CPDFColorSelectViewDelegate
- - (void)selectColorView:(CPDFColorSelectView *)select color:(UIColor *)color {
- self.sampleView.color = color;
- self.annotStyle.color = color;
- if (self.delegate && [self.delegate respondsToSelector:@selector(strikeoutViewController:annotStyle:)]) {
- [self.delegate strikeoutViewController:self annotStyle:self.annotStyle];
- }
- [self.sampleView setNeedsDisplay];
- }
- #pragma mark - CPDFColorPickerViewDelegate
- - (void)pickerView:(CPDFColorPickerView *)colorPickerView color:(UIColor *)color {
- self.sampleView.color = color;
- self.annotStyle.color = color;
- if (self.delegate && [self.delegate respondsToSelector:@selector(strikeoutViewController:annotStyle:)]) {
- [self.delegate strikeoutViewController:self annotStyle:self.annotStyle];
- }
- [self.sampleView setNeedsDisplay];
-
- CGFloat red, green, blue, alpha;
- [color getRed:&red green:&green blue:&blue alpha:&alpha];
- self.opacitySliderView.opacitySlider.value = alpha;
- self.opacitySliderView.startLabel.text = [NSString stringWithFormat:@"%d%%", (int)((self.opacitySliderView.opacitySlider.value/1)*100)];
-
- [self updatePreferredContentSizeWithTraitCollection:self.traitCollection];
- }
- #pragma mark - CPDFOpacitySliderViewDelegate
- - (void)opacitySliderView:(CPDFOpacitySliderView *)opacitySliderView opacity:(CGFloat)opacity {
- self.sampleView.opcity = opacity;
- self.annotStyle.opacity = opacity;
- if (self.delegate && [self.delegate respondsToSelector:@selector(strikeoutViewController:annotStyle:)]) {
- [self.delegate strikeoutViewController:self annotStyle:self.annotStyle];
- }
- [self.sampleView setNeedsDisplay];
- }
- #pragma mark - UIColorPickerViewControllerDelegate
- - (void)colorPickerViewControllerDidFinish:(UIColorPickerViewController *)viewController API_AVAILABLE(ios(14.0)) {
- self.sampleView.color = viewController.selectedColor;
- self.annotStyle.color = self.sampleView.color;
- if (self.delegate && [self.delegate respondsToSelector:@selector(strikeoutViewController:annotStyle:)]) {
- [self.delegate strikeoutViewController:self annotStyle:self.annotStyle];
- }
- [self.sampleView setNeedsDisplay];
-
- CGFloat red, green, blue, alpha;
- [viewController.selectedColor getRed:&red green:&green blue:&blue alpha:&alpha];
- self.opacitySliderView.opacitySlider.value = alpha;
- self.opacitySliderView.startLabel.text = [NSString stringWithFormat:@"%d%%", (int)((self.opacitySliderView.opacitySlider.value/1)*100)];
- }
- @end
|