Jelajahi Sumber

【右侧面板】文字 类型选择导入

lizhe 11 bulan lalu
induk
melakukan
eca3b70240

+ 17 - 13
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMGeneralAnnotationViewController.swift

@@ -856,20 +856,24 @@ let KMColorPickerViewHeight: CGFloat = 64
     }
     
     func openFreeTextStylesViewController() {
-//        let vc = KMFreeTextStylesViewController()
-//        vc.annotations = self.annotations
-//        vc.view.frame = CGRect(x: 0, y: 0, width: 280, height: CGRectGetHeight(self.view.window?.frame ?? CGRect.zero) - 300)
-//        
-//        let createFilePopover = NSPopover()
-//        createFilePopover.contentViewController = vc
-//        createFilePopover.animates = true
-//        createFilePopover.behavior = .transient
-//        createFilePopover.show(relativeTo: CGRect(x: _textImageBox.bounds.origin.x, y: 10, width: _textImageBox.bounds.size.width, height: _textImageBox.bounds.size.height), of: _textImageBox, preferredEdge: .minY)
-//        
-//        // Assuming _textImageBox is an NSView instance
-//        createFilePopover.show(relativeTo: _textImageBox.bounds, of: _textImageBox, preferredEdge: .minY)
+        if annotations.count == 0 {
+            return
+        }
+        
+        let vc = KMFreeTextStylesViewController()
+        vc.annotations = annotations
+        vc.view.frame = CGRect(x: 0, y: 0, width: 280, height: CGRectGetHeight(self.view.window?.frame ?? CGRect.zero) - 300)
+        
+        let createFilePopover = NSPopover()
+        createFilePopover.contentViewController = vc
+        createFilePopover.animates = true
+        createFilePopover.behavior = .transient
+        createFilePopover.show(relativeTo: CGRect(x: textImageBox.bounds.origin.x, y: 10, width: textImageBox.bounds.size.width, height: textImageBox.bounds.size.height), of: textImageBox, preferredEdge: .minY)
+        
+        // Assuming _textImageBox is an NSView instance
+        createFilePopover.show(relativeTo: textImageBox.bounds, of: textImageBox, preferredEdge: .minY)
         
-        // Release is not needed in Swift due to automatic reference counting (ARC)
+//         Release is not needed in Swift due to automatic reference counting (ARC)
     }
 
     func changeStoredFontInfo(_ sender: Any) {

+ 14 - 0
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/View/KMFreeTextStylesViewController/KMFreeTextStylesViewController.h

@@ -0,0 +1,14 @@
+//
+//  KMFreeTextStylesViewController.h
+//  PDF Reader Pro Edition
+//
+//  Created by KdanWJ on 2021/1/29.
+//
+
+#import <Cocoa/Cocoa.h>
+
+@interface KMFreeTextStylesViewController : NSViewController
+
+@property (nonatomic, retain) NSArray *annotations;
+
+@end

+ 653 - 0
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/View/KMFreeTextStylesViewController/KMFreeTextStylesViewController.m

@@ -0,0 +1,653 @@
+//
+//  KMFreeTextStylesViewController.m
+//  PDF Reader Pro Edition
+//
+//  Created by KdanWJ on 2021/1/29.
+//
+
+#import "KMFreeTextStylesViewController.h"
+#import "PDF_Reader_Pro-Swift.h"
+//#import "NSMenu_SKExtensions.h"
+//#import <SkimNotes/SkimNotes.h>
+//#import "PDFAnnotation_SKExtensions.h"
+
+typedef NS_ENUM(NSUInteger, KMFreeTextMenuActionType) {
+    KMFreeTextMenuActionType_Redefine = 0,
+    KMFreeTextMenuActionType_Rename,
+    KMFreeTextMenuActionType_Delete,
+    KMFreeTextMenuActionType_Default
+};
+
+#pragma mark - KMScstyleTableRowView
+
+@interface KMScstyleTableRowView : NSTableRowView
+@end
+@implementation KMScstyleTableRowView
+
+- (instancetype)init {
+    self = [super init];
+    if (self) {
+        [self addTrackingArea];
+    }
+    return self;
+}
+
+- (void)addTrackingArea {
+    NSTrackingArea *trackingArea = [[NSTrackingArea alloc] initWithRect:self.bounds options:NSTrackingMouseEnteredAndExited | NSTrackingInVisibleRect | NSTrackingActiveAlways |NSTrackingMouseMoved owner:self userInfo:nil];
+    [self addTrackingArea:trackingArea];
+}
+
+- (void)drawSelectionInRect:(NSRect)dirtyRect {
+        NSRect selectionRect = self.bounds;
+        [[KMAppearance KMColor_Status_Sel] setFill];
+         NSBezierPath *selectionPath = [NSBezierPath bezierPathWithRoundedRect:selectionRect xRadius:0 yRadius:0];
+         [selectionPath fill];
+}
+
+- (void)mouseEntered:(NSEvent *)event {
+    [super mouseEntered:event];
+}
+
+@end
+
+@interface KMFreeTextStyleTableViewCell:NSTableCellView <NSTextFieldDelegate>
+
+@property (nonatomic, retain) IBOutlet NSImageView *checkImageView;
+
+@property (nonatomic, retain) IBOutlet NSButton *updateButton;
+
+@property (nonatomic, retain) IBOutlet NSButton *moreButton;
+
+@property (nonatomic, retain) IBOutlet NSTextField *styleLabel;
+
+@property (assign) IBOutlet NSLayoutConstraint *styleLabelHeightConstant;
+
+@property (nonatomic, copy) void (^mouseMoveCallback) (BOOL mouseEntered);
+
+@property (nonatomic, copy) void (^menuActionCallback) (KMFreeTextMenuActionType memuType);
+
+@property (nonatomic, copy) void (^renameActionCallback) (NSString *count, KMFreeTextMenuActionType memuType);
+
+@property (nonatomic, retain) NSArray *annotations;
+
+@property (nonatomic, retain) NSArray *styleTitles;
+
+@property (nonatomic, assign) NSInteger *selectRow;
+
+@end
+
+@implementation KMFreeTextStyleTableViewCell
+
+- (void)dealloc {
+
+}
+
+- (void)awakeFromNib {
+    [super awakeFromNib];
+    
+    self.checkImageView.hidden = YES;
+        
+    self.updateButton.wantsLayer = YES;
+    self.updateButton.title = @"􀅈";
+    self.updateButton.layer.cornerRadius = CGRectGetWidth(_updateButton.bounds)/2;
+    self.updateButton.layer.backgroundColor = [KMAppearance KMColor_Layout_H2].CGColor;
+    self.updateButton.hidden = YES;
+        
+    self.moreButton.image = [NSImage imageNamed:@"KMImageNameUXIconBtnArrowRight"];
+    _moreButton.hidden = YES;
+    _moreButton.enabled = NO;
+    
+    self.styleLabel.editable = NO;
+    
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(contextDidEndEdit:) name:NSControlTextDidEndEditingNotification object:_styleLabel];
+}
+
+- (void)viewDidMoveToWindow {
+    [super viewDidMoveToWindow];
+    if ([self window] != nil) {
+        [self addTrackingRect:[self bounds]
+                        owner:self
+                     userData:NULL
+                 assumeInside:NO];
+    }
+}
+
+- (void)setFrameSize:(NSSize)newSize {
+    [super setFrameSize:newSize];
+    [self addTrackingRect:NSMakeRect(0, 0, newSize.width, newSize.height)
+                    owner:self
+                 userData:NULL
+             assumeInside:NO];
+}
+
+- (void)mouseEntered:(NSEvent *)event {
+    if (self.mouseMoveCallback) {
+        self.mouseMoveCallback(YES);
+    }
+}
+
+- (void)mouseExited:(NSEvent *)event {
+    if (self.mouseMoveCallback) {
+        self.mouseMoveCallback(NO);
+    }
+}
+
+- (BOOL) isChange {
+    int selectInt = (int)self.selectRow;
+
+    NSAttributedString *string = self.styleLabel.attributedStringValue;
+    if(string.length < 1) {
+        return NO;
+    }
+    NSDictionary *dict = [string attributesAtIndex:0 effectiveRange:nil];
+    NSFont *font = dict[NSFontAttributeName];
+    NSColor *color = dict[NSForegroundColorAttributeName];
+    NSInteger alignment = self.styleLabel.alignment;
+    
+    BOOL colorIsEqual = NO;
+    BOOL alignEqual = NO;
+    BOOL fontSizeEqual = NO;
+    BOOL fontWeightEqual = NO;
+    BOOL fontNameEqual = NO;
+    BOOL stringEqual = NO;
+    
+    NSColor *color2 = nil;
+    if (_styleTitles[selectInt][@"Font Color"]) {
+        color2 = [NSUnarchiver unarchiveObjectWithData:_styleTitles[selectInt][@"Font Color"]];
+    }
+    if (CGColorEqualToColor(color.CGColor, color2.CGColor)){
+        colorIsEqual = YES;
+    }
+    NSString *alignString = @"NSTextAlignmentLeft";
+    if (_styleLabel.alignment == NSTextAlignmentLeft) {
+        alignment = @"NSTextAlignmentLeft";
+    } else if (_styleLabel.alignment == NSTextAlignmentCenter) {
+        alignment = @"NSTextAlignmentCenter";
+    } else if (_styleLabel.alignment == NSTextAlignmentRight) {
+        alignment = @"NSTextAlignmentRight";
+    } else if (_styleLabel.alignment == NSTextAlignmentJustified) {
+        alignment = @"NSTextAlignmentJustified";
+    }
+    if ([alignString isEqualToString:_styleTitles[selectInt][@"Font Alignment"]]) {
+        alignEqual = YES;
+    }
+    if ([_styleLabel.stringValue isEqualToString:_styleTitles[selectInt][@"StringValue"]]) {
+        stringEqual = YES;
+    }
+    NSString *fontSize = [NSString stringWithFormat:@"%.f",font.pointSize];
+    if ([fontSize isEqualToString:_styleTitles[selectInt][@"Font Size"]]) {
+        fontSizeEqual = YES;
+    }
+    if ([font.fontName isEqualToString:_styleTitles[selectInt][@"Font Name"]]) {
+        fontNameEqual = YES;
+    }
+    NSString *weight = [font.fontDescriptor objectForKey:NSFontFaceAttribute];
+    if ([weight isEqualToString:_styleTitles[selectInt][@"Font Weight"]]) {
+        fontWeightEqual = YES;
+    }
+    
+    if (colorIsEqual && alignEqual && fontSizeEqual && fontWeightEqual && stringEqual) {
+        return NO;
+    } else {
+        return YES;
+    }
+}
+
+#pragma mark - Action
+
+- (IBAction)updateButtonAction:(NSButton *)sender {
+    
+}
+
+- (IBAction)moreButtonAction:(NSButton *)sender {
+    NSMenu *menu = [[NSMenu alloc] init];
+    NSMenuItem *redefineItem = [menu addItemWithTitle:NSLocalizedString(@"Redefine from Selection", nil) action:@selector(redefineAction:) target:self];
+    [redefineItem setRepresentedObject:self];
+    [menu addItem:[NSMenuItem separatorItem]];
+    NSMenuItem *renameItem = [menu addItemWithTitle:NSLocalizedString(@"Rename Style", nil) action:@selector(renameAction:) target:self];
+    [renameItem setRepresentedObject:self];
+    [menu addItem:[NSMenuItem separatorItem]];
+    NSMenuItem *deleteItem = [menu addItemWithTitle:NSLocalizedString(@"Delete style", nil) action:@selector(deleteAction:) target:self];
+    [deleteItem setRepresentedObject:self];
+    NSMenuItem *defaultItem = [menu addItemWithTitle:NSLocalizedString(@"Restore Default Style", nil) action:@selector(defaultAction:) target:self];
+    [defaultItem setRepresentedObject:self];
+    [NSMenu popUpContextMenu:menu withEvent:[NSApp currentEvent] forView:(NSButton *)sender];
+}
+
+- (IBAction)redefineAction:(id)sender {
+    if (self.menuActionCallback) {
+        self.menuActionCallback(KMFreeTextMenuActionType_Redefine);
+    }
+}
+
+- (IBAction)renameAction:(id)sender {
+    _styleLabel.editable = YES;
+    [_styleLabel becomeFirstResponder];
+}
+
+- (IBAction)deleteAction:(id)sender {
+    if (self.menuActionCallback) {
+        self.menuActionCallback(KMFreeTextMenuActionType_Delete);
+    }
+}
+
+- (IBAction)defaultAction:(id)sender {
+    if (self.menuActionCallback) {
+        self.menuActionCallback(KMFreeTextMenuActionType_Default);
+    }
+}
+
+- (BOOL)validateMenuItem:(NSMenuItem *)menuItem {
+    SEL action = [menuItem action];
+    if (action == @selector(redefineAction:)) {
+        PDFAnnotation *annotation = _annotations.firstObject;
+//        if (annotation.string != nil) {
+//            return YES;
+//        } else {
+            return NO;
+//        }
+    } else if (action == @selector(deleteAction:)) {
+        if (_styleTitles.count > 1) {
+            return YES;
+        } else {
+            return NO;
+        }
+    } else if (action == @selector(defaultAction:)) {
+        if (_selectRow > 9) {
+            return NO;
+        } else {
+            if (_styleTitles.count > 1) {
+                if ([self isChange]) {
+                    return YES;
+                } else {
+                    return NO;
+                }
+            }
+            return YES;
+        }
+    }
+    return YES;
+}
+
+#pragma mark - NSNotification
+
+- (void)contextDidEndEdit:(NSNotification *)notification {
+    NSTextField *textField = (NSTextField *)notification.object;
+    
+    if (self.renameActionCallback) {
+        self.renameActionCallback(textField.stringValue, KMFreeTextMenuActionType_Rename);
+    }
+}
+
+@end
+
+@interface KMFreeTextStylesViewController () <NSTableViewDelegate, NSTableViewDataSource>
+
+@property (assign) IBOutlet NSTextField *defaultStylesLabel;
+@property (assign) IBOutlet NSButton *styleAddButton;
+@property (assign) IBOutlet NSButton *styleMoreButton;
+
+@property (assign) IBOutlet NSScrollView *styleScrollView;
+@property (assign) IBOutlet NSTableView *scstyleTableView;
+
+@property (nonatomic, retain) NSMutableArray <NSDictionary *>*freetextStyles;
+
+@property (nonatomic, assign) NSInteger lastSelectRow;
+
+@end
+
+@implementation KMFreeTextStylesViewController
+
+- (void)dealloc {
+
+}
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    // Do view setup here.
+    
+    self.defaultStylesLabel.stringValue = NSLocalizedString(@"Default Style", nil);
+    
+    self.styleAddButton.image = [NSImage imageNamed:@"KMImageNameUXIconBtnAddNor"];
+    self.styleMoreButton.image = [NSImage imageNamed:@"KMImageNameUXIconBtnSidebarMoreSecondary"];
+    
+    [[_defaultStylesLabel cell] setLineBreakMode:NSLineBreakByCharWrapping];
+    [[_defaultStylesLabel cell] setTruncatesLastVisibleLine:YES];
+    
+    self.lastSelectRow = -1;
+}
+
+#pragma mark - View Methods
+
+#pragma mark - freetextStyles
+
+- (void)setFreetextStyles:(NSMutableArray<NSDictionary *> *)freetextStyles {
+    [[NSUserDefaults standardUserDefaults] setObject:freetextStyles forKey:@"KMFreetextAnnotationStylesKey"];
+    [[NSUserDefaults standardUserDefaults] synchronize];
+}
+
+- (NSMutableArray<NSDictionary *> *)freetextStyles {
+    if ([[NSUserDefaults standardUserDefaults] objectForKey:@"KMFreetextAnnotationStylesKey"]) {
+        return [[NSUserDefaults standardUserDefaults] objectForKey:@"KMFreetextAnnotationStylesKey"];
+    } else {
+        return [self defaultFreetextStyles];
+    }
+}
+
+- (NSMutableArray <NSDictionary *>*)defaultFreetextStyles {
+    return @[@{@"Font Name" : @"PingFang HK", @"Font Size" : @"40", @"Font Weight" : @"Semibold", @"Font Color" : [self dataForColor:[NSColor colorWithRed:36/255.0 green:42/255.0 blue:51/255.0 alpha:1.0]], @"Font Alignment" : @"NSTextAlignmentLeft", @"StringValue" : NSLocalizedString(@"The Headlines", nil)},
+             @{@"Font Name" : @"PingFang HK", @"Font Size" : @"32", @"Font Weight" : @"Semibold", @"Font Color" : [self dataForColor:[NSColor colorWithRed:36/255.0 green:42/255.0 blue:51/255.0 alpha:1.0]], @"Font Alignment" : @"NSTextAlignmentLeft", @"StringValue" : NSLocalizedString(@"Title (small)", nil)},
+             @{@"Font Name" : @"PingFang HK", @"Font Size" : @"24", @"Font Weight" : @"Semibold", @"Font Color" : [self dataForColor:[NSColor colorWithRed:36/255.0 green:42/255.0 blue:51/255.0 alpha:1.0]], @"Font Alignment" : @"NSTextAlignmentLeft", @"StringValue" : NSLocalizedString(@"Subtitle (Bold)", nil)},
+             @{@"Font Name" : @"PingFang HK", @"Font Size" : @"24", @"Font Weight" : @"Regular", @"Font Color" : [self dataForColor:[NSColor colorWithRed:36/255.0 green:42/255.0 blue:51/255.0 alpha:1.0]], @"Font Alignment" : @"NSTextAlignmentLeft", @"StringValue" : NSLocalizedString(@"Subtitle", nil)},
+             @{@"Font Name" : @"PingFang HK", @"Font Size" : @"20", @"Font Weight" : @"Regular", @"Font Color" : [self dataForColor:[NSColor colorWithRed:36/255.0 green:42/255.0 blue:51/255.0 alpha:1.0]], @"Font Alignment" : @"NSTextAlignmentLeft", @"StringValue" : NSLocalizedString(@"Text", nil)},
+             @{@"Font Name" : @"PingFang HK", @"Font Size" : @"16", @"Font Weight" : @"Regular", @"Font Color" : [self dataForColor:[NSColor colorWithRed:36/255.0 green:42/255.0 blue:51/255.0 alpha:1.0]], @"Font Alignment" : @"NSTextAlignmentLeft", @"StringValue" : NSLocalizedString(@"Text (small)", nil)},
+             @{@"Font Name" : @"PingFang HK", @"Font Size" : @"16", @"Font Weight" : @"Regular", @"Font Color" : [self dataForColor:[NSColor colorWithRed:117/255.0 green:119/255.0 blue:128/255.0 alpha:1.0]], @"Font Alignment" : @"NSTextAlignmentLeft", @"StringValue" : NSLocalizedString(@"Text (grey)", nil)},
+             @{@"Font Name" : @"PingFang HK", @"Font Size" : @"14", @"Font Weight" : @"Semibold", @"Font Color" : [self dataForColor:[NSColor colorWithRed:36/255.0 green:42/255.0 blue:51/255.0 alpha:1.0]], @"Font Alignment" : @"NSTextAlignmentLeft", @"StringValue" : NSLocalizedString(@"Instructions", nil)},
+             @{@"Font Name" : @"PingFang HK", @"Font Size" : @"16", @"Font Weight" : @"Semibold", @"Font Color" : [self dataForColor:[NSColor colorWithRed:200/255.0 green:38/255.0 blue:6/255.0 alpha:1.0]], @"Font Alignment" : @"NSTextAlignmentLeft", @"StringValue" : NSLocalizedString(@"Instructions (red)", nil)},
+             @{@"Font Name" : @"PingFang HK", @"Font Size" : @"12", @"Font Weight" : @"Regular", @"Font Color" : [self dataForColor:[NSColor colorWithRed:36/255.0 green:42/255.0 blue:51/255.0 alpha:1.0]], @"Font Alignment" : @"NSTextAlignmentLeft", @"StringValue" : NSLocalizedString(@"Annotations", nil)}];
+}
+
+- (NSColor *)colorForData:(NSData *)data {
+    NSColor *color = nil;
+    if (data) {
+        color = [NSUnarchiver unarchiveObjectWithData:data];
+    }
+    return color;
+}
+
+- (NSData *)dataForColor:(NSColor *)color {
+    NSData *data = color ? [NSArchiver archivedDataWithRootObject:color] : nil;
+    return data;
+}
+
+- (CGFloat)heightForNoteStringValue:(NSString *)text attrited:(NSDictionary *)attrited {
+    CGSize maxSize = CGSizeMake(MAXFLOAT, MAXFLOAT);
+    NSStringDrawingOptions opts = NSStringDrawingUsesLineFragmentOrigin| NSStringDrawingUsesFontLeading;
+    CGRect rect = [text boundingRectWithSize:maxSize
+                                     options:opts
+                                  attributes:attrited
+                                     context:nil];
+    return rect.size.height;
+}
+
+#pragma mark - Action
+
+- (IBAction)styleAddButtonAction:(NSButton *)sender {
+    PDFAnnotationFreeText *annotation = (PDFAnnotationFreeText *)self.annotations.firstObject;
+    NSString *fontName = [annotation.font.fontDescriptor objectForKey:NSFontFamilyAttribute] ? : @"PingFang HK";
+    NSString *fontSize = [NSString stringWithFormat:@"%f", annotation.font.pointSize] ? : @"20";
+    NSString *fontWeight = [annotation.font.fontDescriptor objectForKey:NSFontFaceAttribute] ? : @"Regular";
+    NSColor *fontColor = annotation.fontColor ? : [NSColor colorWithRed:36/255.0 green:42/255.0 blue:51/255.0 alpha:1.0];
+    NSString *alignmentType = @"NSTextAlignmentLeft";
+    if (annotation.alignment == NSTextAlignmentLeft) {
+        alignmentType = @"NSTextAlignmentLeft";
+    } else if (annotation.alignment == NSTextAlignmentCenter) {
+        alignmentType = @"NSTextAlignmentCenter";
+    } else if (annotation.alignment == NSTextAlignmentRight) {
+        alignmentType = @"NSTextAlignmentRight";
+    } else if (annotation.alignment == NSTextAlignmentJustified) {
+        alignmentType = @"NSTextAlignmentJustified";
+    }
+    NSString *fontAlignment = alignmentType ? : @"NSTextAlignmentLeft";
+    NSString *noteString = /*annotation.string ? :*/ NSLocalizedString(@"Text", nil);
+    NSDictionary *dict = @{@"Font Name" : fontName, @"Font Size" : fontSize, @"Font Weight" : fontWeight, @"Font Color" : [self dataForColor:fontColor], @"Font Alignment" : fontAlignment, @"StringValue" : noteString};
+    NSMutableArray <NSDictionary *>*styleArr = [NSMutableArray arrayWithArray:[self freetextStyles]];
+    [styleArr addObject:dict];
+    [self setFreetextStyles:styleArr];
+    
+    [_scstyleTableView reloadData];
+    
+    NSIndexSet *indexSet = [NSIndexSet indexSetWithIndex:(styleArr.count - 1)];
+    [self.scstyleTableView selectRowIndexes:indexSet byExtendingSelection:NO];
+    [self.scstyleTableView.enclosingScrollView.contentView scrollToPoint:NSMakePoint(0, ((NSView*)self.scstyleTableView.enclosingScrollView.documentView).frame.size.height - self.scstyleTableView.enclosingScrollView.contentSize.height)];
+}
+
+- (IBAction)styleMoreButtonAction:(NSButton *)sender {
+    NSMenu *menu = [[NSMenu alloc] init];
+    NSMenuItem *moreItem = [menu addItemWithTitle:NSLocalizedString(@"Restore Default Style", nil) action:@selector(freetextNote_moreAction:) target:self];
+    [moreItem setRepresentedObject:self];
+    [NSMenu popUpContextMenu:menu withEvent:[NSApp currentEvent] forView:(NSButton *)sender];
+}
+
+- (IBAction)freetextNote_moreAction:(id)sender {
+    [self setFreetextStyles:[self defaultFreetextStyles]];
+    
+    [_scstyleTableView reloadData];
+}
+
+- (void)redefineAction:(NSInteger)count {
+    if (self.annotations.count > 0) {
+        PDFAnnotationFreeText *tAnnotation = (PDFAnnotationFreeText *)self.annotations.firstObject;
+        NSString * family =   [tAnnotation.font.fontDescriptor objectForKey:NSFontFamilyAttribute];
+        NSString * style =   [tAnnotation.font.fontDescriptor objectForKey:NSFontFaceAttribute];
+        NSString *fontSize = [NSString stringWithFormat:@"%f",tAnnotation.font.pointSize];
+        NSColor *color = tAnnotation.fontColor;
+        NSString *alignment = @"NSTextAlignmentLeft";
+        if (tAnnotation.alignment == NSTextAlignmentLeft) {
+            alignment = @"NSTextAlignmentLeft";
+        } else if (tAnnotation.alignment == NSTextAlignmentCenter) {
+            alignment = @"NSTextAlignmentCenter";
+        } else if (tAnnotation.alignment == NSTextAlignmentRight) {
+            alignment = @"NSTextAlignmentRight";
+        } else if (tAnnotation.alignment == NSTextAlignmentJustified) {
+            alignment = @"NSTextAlignmentJustified";
+        }
+        NSString *stringValue = @"";
+        /*if (tAnnotation.string && tAnnotation.string.length > 0) {
+            stringValue = tAnnotation.string;
+        } else */if (count < (NSInteger)self.defaultFreetextStyles.count) {
+            NSDictionary *dict = self.defaultFreetextStyles[count];
+            stringValue = dict[@"StringValue"] ? : @"";
+        }
+        
+        NSMutableArray <NSDictionary *>*dictArr = [NSMutableArray arrayWithArray:[self freetextStyles]];
+        dictArr[count] = @{@"Font Name" : family, @"Font Size" : fontSize, @"Font Weight" : style, @"Font Color" : [self dataForColor:color], @"Font Alignment" : alignment, @"StringValue" : stringValue};
+        [self setFreetextStyles:dictArr];
+        [_scstyleTableView reloadData];
+    }
+}
+
+- (IBAction)renameAction:(NSString *)value
+                   Count:(NSInteger)count {
+    if(count >= [self freetextStyles].count) return;
+    NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithDictionary:[self freetextStyles][count]];
+    [dict setObject:value forKey:@"StringValue"];
+    NSMutableArray *styleArr = [NSMutableArray arrayWithArray:[self freetextStyles]];
+    styleArr[count] = (NSDictionary *)dict;
+    [self setFreetextStyles:styleArr];
+    
+    NSInteger selectRow = _scstyleTableView.selectedRow;
+    [_scstyleTableView reloadData];
+    NSIndexSet *indexSet = [NSIndexSet indexSetWithIndex:selectRow];
+    [self.scstyleTableView selectRowIndexes:indexSet byExtendingSelection:NO];
+}
+
+- (IBAction)deleteAction:(NSInteger)count {
+    NSMutableArray *styleArr = [NSMutableArray arrayWithArray:[self freetextStyles]];
+    [styleArr removeObjectAtIndex:count];
+    [self setFreetextStyles:styleArr];
+    
+    [self.scstyleTableView reloadData];
+}
+
+- (IBAction)defaultAction:(NSInteger)count {
+    if (count < 10) {
+        NSDictionary *dict = [self defaultFreetextStyles][count];
+        
+        NSMutableArray *styleArr = [NSMutableArray arrayWithArray:[self freetextStyles]];
+        styleArr[count] = dict;
+        [self setFreetextStyles:styleArr];
+        
+        NSMutableIndexSet *rowIndexSet = [[NSMutableIndexSet alloc] init];
+        [rowIndexSet addIndex:count];
+        NSMutableIndexSet *columnIndexSet = [[NSMutableIndexSet alloc] init];
+        [columnIndexSet addIndex:0];
+        [self.scstyleTableView reloadDataForRowIndexes:rowIndexSet columnIndexes:columnIndexSet];
+    }
+}
+
+#pragma mark - NSTableViewDelegate, NSTableViewDataSource
+
+- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView {
+    return [self freetextStyles].count;
+}
+
+- (CGFloat)tableView:(NSTableView *)tableView heightOfRow:(NSInteger)row {
+    NSDictionary *dict = [self freetextStyles][row];
+    NSString *fontName = dict[@"Font Name"];
+    CGFloat fontSize = [dict[@"Font Size"] floatValue];
+    NSString *fontWeight = dict[@"Font Weight"];
+    NSString *fontStringValue = dict[@"StringValue"];
+    
+    NSMutableParagraphStyle *paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
+    paragraphStyle.lineBreakMode = NSLineBreakByWordWrapping;
+    paragraphStyle.alignment = NSTextAlignmentLeft;
+    paragraphStyle.lineSpacing = 1;
+    
+    NSFontDescriptor *attributeFontDescriptor = [NSFontDescriptor fontDescriptorWithFontAttributes:@{NSFontFamilyAttribute:fontName,NSFontFaceAttribute:fontWeight}];
+    NSFont *font = [NSFont fontWithDescriptor:attributeFontDescriptor size:fontSize];
+    NSDictionary *attrited = @{NSFontAttributeName:font, NSParagraphStyleAttributeName: paragraphStyle};
+       
+   CGRect rect = [fontStringValue boundingRectWithSize:CGSizeMake(135.0, CGRectMaxYEdge)
+                                        options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading
+                                     attributes:attrited
+                                        context:nil];
+    return CGRectGetHeight(rect);
+}
+
+- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
+    NSString *identifier = [tableColumn identifier];
+    KMFreeTextStyleTableViewCell *cellView = [tableView makeViewWithIdentifier:identifier owner:self];
+    NSDictionary *dict = [self freetextStyles][row];
+    NSString *fontName = dict[@"Font Name"];
+    CGFloat fontSize = [dict[@"Font Size"] floatValue];
+    NSString *fontWeight = dict[@"Font Weight"];
+    NSColor *fontColor = [self colorForData:dict[@"Font Color"]];
+    NSString *fontAlignment = dict[@"Font Alignment"];
+    NSString *fontStringValue = dict[@"StringValue"];
+    
+    if (@available(macOS 10.14, *)) {
+        cellView.styleLabel.wantsLayer = YES;
+        NSAppearanceName appearanceName = [[NSApp effectiveAppearance] bestMatchFromAppearancesWithNames:@[NSAppearanceNameAqua, NSAppearanceNameDarkAqua]];
+        if ([appearanceName isEqualToString:NSAppearanceNameDarkAqua]) {
+            if (row == 0 || row == 1 || row == 2 || row == 3 || row == 4 || row == 5  || row == 7 || row == 9) {
+                cellView.styleLabel.layer.backgroundColor = [KMAppearance KMColor_Layout_W30].CGColor;
+            } else {
+                cellView.styleLabel.layer.backgroundColor = [NSColor clearColor].CGColor;
+            }
+        } else {
+            cellView.styleLabel.layer.backgroundColor = [NSColor clearColor].CGColor;
+        }
+    }
+    
+    NSFontDescriptor *attributeFontDescriptor = [NSFontDescriptor fontDescriptorWithFontAttributes:@{NSFontFamilyAttribute:fontName,NSFontFaceAttribute:fontWeight}];
+    NSFont *font = [NSFont fontWithDescriptor:attributeFontDescriptor size:fontSize];
+    NSDictionary *attrited = @{NSFontAttributeName:font, NSForegroundColorAttributeName:fontColor};
+    NSAttributedString *string = [[NSAttributedString alloc] initWithString:fontStringValue attributes:attrited];
+    cellView.styleLabel.attributedStringValue = string;
+    if ([fontAlignment isEqualToString:@"NSTextAlignmentLeft"]) {
+        cellView.styleLabel.alignment = NSTextAlignmentLeft;
+    } else if ([fontAlignment isEqualToString:@"NSTextAlignmentCenter"]) {
+        cellView.styleLabel.alignment = NSTextAlignmentCenter;
+    } else if ([fontAlignment isEqualToString:@"NSTextAlignmentRight"]) {
+        cellView.styleLabel.alignment = NSTextAlignmentRight;
+    } else if ([fontAlignment isEqualToString:@"NSTextAlignmentJustified"]) {
+        cellView.styleLabel.alignment = NSTextAlignmentJustified;
+    }
+    cellView.styleLabelHeightConstant.constant = [self heightForNoteStringValue:fontStringValue attrited:attrited];
+    
+    cellView.annotations = _annotations;
+    cellView.styleTitles = [self freetextStyles];
+    cellView.selectRow = row;
+    
+    if (row != tableView.selectedRow) {
+        cellView.moreButton.hidden = YES;
+        cellView.moreButton.enabled = NO;
+    }
+    
+    cellView.mouseMoveCallback = ^(BOOL mouseEntered) {
+        if (mouseEntered) {
+            cellView.moreButton.hidden = NO;
+            cellView.moreButton.enabled = YES;
+        } else {
+            if (row != tableView.selectedRow) {
+                cellView.moreButton.hidden = YES;
+                cellView.moreButton.enabled = NO;
+            }
+        }
+    };
+    
+    __block typeof(self) blockSelf = self;
+    cellView.menuActionCallback = ^(KMFreeTextMenuActionType memuType) {
+        switch (memuType) {
+            case KMFreeTextMenuActionType_Redefine:
+                [blockSelf redefineAction:row];
+                break;
+            case KMFreeTextMenuActionType_Delete:
+                [blockSelf deleteAction:row];
+                break;
+            case KMFreeTextMenuActionType_Default:
+                [blockSelf defaultAction:row];
+                break;
+            default:
+                break;
+        }
+    };
+    
+    cellView.renameActionCallback = ^(NSString *count, KMFreeTextMenuActionType memuType) {
+        if (memuType == KMFreeTextMenuActionType_Rename) {
+            [blockSelf renameAction:count Count:row];
+        }
+    };
+    
+    return cellView;
+}
+
+- (void)tableViewSelectionDidChange:(NSNotification *)notification {
+    NSTableView *tableView = (NSTableView *)notification.object;
+    NSInteger selectRow = tableView.selectedRow;
+    if(selectRow < 0) return;
+    if (_lastSelectRow != selectRow && _lastSelectRow != -1) {
+        NSMutableIndexSet *rowIndexSet = [[NSMutableIndexSet alloc] init];
+        [rowIndexSet addIndex:_lastSelectRow];
+        NSMutableIndexSet *columnIndexSet = [[NSMutableIndexSet alloc] init];
+        [columnIndexSet addIndex:0];
+        [tableView reloadDataForRowIndexes:rowIndexSet columnIndexes:columnIndexSet];
+    }
+    _lastSelectRow = selectRow;
+    
+    NSDictionary *dict = [self freetextStyles][selectRow];
+    NSString *fontName = dict[@"Font Name"];
+    CGFloat fontSize = [dict[@"Font Size"] floatValue];
+    NSString *fontWeight = dict[@"Font Weight"];
+    NSColor *fontColor = [self colorForData:dict[@"Font Color"]];
+    NSString *fontAlignment = dict[@"Font Alignment"];
+    
+    for (PDFAnnotation *tAnnotation in self.annotations) {
+        NSFontDescriptor *attributeFontDescriptor = [NSFontDescriptor fontDescriptorWithFontAttributes:@{NSFontFamilyAttribute:fontName,NSFontFaceAttribute:fontWeight}];
+        NSFont *font = [NSFont fontWithDescriptor:attributeFontDescriptor size:fontSize];
+        if (font) {
+            tAnnotation.font = font;
+        }
+        if (fontColor) {
+            tAnnotation.fontColor = fontColor;
+        }
+        
+        if ([fontAlignment isEqualToString:@"NSTextAlignmentLeft"]) {
+            tAnnotation.alignment = NSTextAlignmentLeft;
+        } else if ([fontAlignment isEqualToString:@"NSTextAlignmentCenter"]) {
+            tAnnotation.alignment = NSTextAlignmentCenter;
+        } else if ([fontAlignment isEqualToString:@"NSTextAlignmentRight"]) {
+            tAnnotation.alignment = NSTextAlignmentRight;
+        } else if ([fontAlignment isEqualToString:@"NSTextAlignmentJustified"]) {
+            tAnnotation.alignment = NSTextAlignmentJustified;
+        }
+    }
+}
+
+- (NSTableRowView *)tableView:(NSTableView *)tableView rowViewForRow:(NSInteger)row {
+    KMScstyleTableRowView *rowView = [[KMScstyleTableRowView alloc] init];
+    return rowView;
+}
+
+@end

+ 218 - 0
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/View/KMFreeTextStylesViewController/KMFreeTextStylesViewController.xib

@@ -0,0 +1,218 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22505" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+    <dependencies>
+        <deployment identifier="macosx"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22505"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="KMFreeTextStylesViewController">
+            <connections>
+                <outlet property="defaultStylesLabel" destination="Gzb-9T-0tE" id="Gmc-hB-Zzh"/>
+                <outlet property="scstyleTableView" destination="Z7J-YB-AAs" id="THM-R9-2TJ"/>
+                <outlet property="styleAddButton" destination="k3S-hD-FHn" id="2j8-lO-MhV"/>
+                <outlet property="styleMoreButton" destination="13Z-Zn-F1p" id="CPL-5g-fyk"/>
+                <outlet property="styleScrollView" destination="7y1-Xw-f9S" id="y6W-oa-LAL"/>
+                <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <customView misplaced="YES" id="Hz6-mo-xeY">
+            <rect key="frame" x="0.0" y="0.0" width="280" height="350"/>
+            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+            <subviews>
+                <customView translatesAutoresizingMaskIntoConstraints="NO" id="oKi-FG-j4C">
+                    <rect key="frame" x="0.0" y="236" width="280" height="30"/>
+                    <subviews>
+                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Gzb-9T-0tE">
+                            <rect key="frame" x="121" y="8" width="39" height="15"/>
+                            <textFieldCell key="cell" lineBreakMode="clipping" alignment="center" title="Label" id="V6W-Qz-DGI">
+                                <font key="font" metaFont="cellTitle"/>
+                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                            </textFieldCell>
+                        </textField>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="k3S-hD-FHn">
+                            <rect key="frame" x="232" y="7" width="16" height="16"/>
+                            <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="KMImageNameUXIconBtnAddNor" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="ltt-nH-5Da">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                            </buttonCell>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="16" id="ryH-wu-HIA"/>
+                                <constraint firstAttribute="width" constant="16" id="xXX-Rj-Ur3"/>
+                            </constraints>
+                            <connections>
+                                <action selector="styleAddButtonAction:" target="-2" id="7Le-QW-AWT"/>
+                            </connections>
+                        </button>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="13Z-Zn-F1p">
+                            <rect key="frame" x="256" y="7" width="16" height="16"/>
+                            <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="KMImageNameUXIconBtnSidebarMoreSecondary" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="4e5-xG-0os">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                            </buttonCell>
+                            <constraints>
+                                <constraint firstAttribute="width" constant="16" id="At0-OD-C3r"/>
+                                <constraint firstAttribute="height" constant="16" id="n8c-lz-3tg"/>
+                            </constraints>
+                            <connections>
+                                <action selector="styleMoreButtonAction:" target="-2" id="Ehx-EB-NAR"/>
+                            </connections>
+                        </button>
+                        <box verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="eSd-Jr-1St">
+                            <rect key="frame" x="12" y="-2" width="256" height="5"/>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="1" id="l9W-d2-K3y"/>
+                            </constraints>
+                        </box>
+                    </subviews>
+                    <constraints>
+                        <constraint firstItem="13Z-Zn-F1p" firstAttribute="centerY" secondItem="k3S-hD-FHn" secondAttribute="centerY" id="01U-VO-f5a"/>
+                        <constraint firstItem="Gzb-9T-0tE" firstAttribute="centerY" secondItem="oKi-FG-j4C" secondAttribute="centerY" id="HxR-o0-ZiH"/>
+                        <constraint firstItem="13Z-Zn-F1p" firstAttribute="centerY" secondItem="oKi-FG-j4C" secondAttribute="centerY" id="JwJ-qT-HBo"/>
+                        <constraint firstAttribute="bottom" secondItem="eSd-Jr-1St" secondAttribute="bottom" id="SJy-pf-AUT"/>
+                        <constraint firstItem="13Z-Zn-F1p" firstAttribute="leading" secondItem="k3S-hD-FHn" secondAttribute="trailing" constant="8" id="VPx-m3-5v6"/>
+                        <constraint firstAttribute="trailing" secondItem="13Z-Zn-F1p" secondAttribute="trailing" constant="8" id="hhi-Va-RnO"/>
+                        <constraint firstAttribute="height" constant="30" id="kCJ-zE-5Im"/>
+                        <constraint firstItem="Gzb-9T-0tE" firstAttribute="centerX" secondItem="oKi-FG-j4C" secondAttribute="centerX" id="mQl-Oc-r0G"/>
+                        <constraint firstAttribute="trailing" secondItem="eSd-Jr-1St" secondAttribute="trailing" constant="12" id="tqk-eU-RRn"/>
+                        <constraint firstItem="eSd-Jr-1St" firstAttribute="leading" secondItem="oKi-FG-j4C" secondAttribute="leading" constant="12" id="ycp-eC-o09"/>
+                    </constraints>
+                </customView>
+                <scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="77" horizontalPageScroll="10" verticalLineScroll="77" verticalPageScroll="10" hasHorizontalScroller="NO" hasVerticalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7y1-Xw-f9S">
+                    <rect key="frame" x="0.0" y="0.0" width="280" height="236"/>
+                    <clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="60s-CE-t8g">
+                        <rect key="frame" x="0.0" y="0.0" width="280" height="236"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <subviews>
+                            <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" rowHeight="75" rowSizeStyle="automatic" viewBased="YES" id="Z7J-YB-AAs">
+                                <rect key="frame" x="0.0" y="0.0" width="280" height="236"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                <size key="intercellSpacing" width="3" height="2"/>
+                                <color key="backgroundColor" white="1" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                <color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
+                                <tableColumns>
+                                    <tableColumn width="248" minWidth="40" maxWidth="1000" id="g77-Mp-maO">
+                                        <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border">
+                                            <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
+                                        </tableHeaderCell>
+                                        <textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" title="Text Cell" id="ah1-fv-9UC">
+                                            <font key="font" metaFont="system"/>
+                                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                        <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
+                                        <prototypeCellViews>
+                                            <tableCellView id="V0s-yA-xvK" customClass="KMFreeTextStyleTableViewCell">
+                                                <rect key="frame" x="11" y="1" width="257" height="75"/>
+                                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                                <subviews>
+                                                    <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="aLR-Ih-hWR">
+                                                        <rect key="frame" x="16" y="32" width="12" height="12"/>
+                                                        <constraints>
+                                                            <constraint firstAttribute="height" constant="12" id="IbQ-oP-04G"/>
+                                                            <constraint firstAttribute="width" constant="12" id="Zo8-Kk-h7o"/>
+                                                        </constraints>
+                                                        <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="OXu-8s-2tx"/>
+                                                    </imageView>
+                                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Qhl-y5-raD">
+                                                        <rect key="frame" x="34" y="30" width="37" height="16"/>
+                                                        <constraints>
+                                                            <constraint firstAttribute="height" constant="16" id="2PZ-nq-Zuf"/>
+                                                        </constraints>
+                                                        <textFieldCell key="cell" lineBreakMode="truncatingTail" truncatesLastVisibleLine="YES" title="Label" id="uyo-Vx-wIU">
+                                                            <font key="font" metaFont="system"/>
+                                                            <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                        </textFieldCell>
+                                                    </textField>
+                                                    <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="IEp-Vd-zdP">
+                                                        <rect key="frame" x="233" y="0.0" width="16" height="75"/>
+                                                        <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="KMImageNameUXIconBtnArrowRight" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="8gv-dG-17v">
+                                                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                                            <font key="font" metaFont="system"/>
+                                                        </buttonCell>
+                                                        <constraints>
+                                                            <constraint firstAttribute="width" constant="16" id="CJm-1M-RzL"/>
+                                                            <constraint firstAttribute="height" constant="75" id="xrA-mG-p9T"/>
+                                                        </constraints>
+                                                        <connections>
+                                                            <action selector="moreButtonAction:" target="V0s-yA-xvK" id="a1w-NU-Ns3"/>
+                                                        </connections>
+                                                    </button>
+                                                    <button hidden="YES" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="oWq-Xq-NnS">
+                                                        <rect key="frame" x="213" y="30" width="16" height="16"/>
+                                                        <buttonCell key="cell" type="square" title="􀅈" bezelStyle="shadowlessSquare" alignment="center" imageScaling="proportionallyDown" inset="2" id="aax-vk-qBo">
+                                                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                                            <font key="font" metaFont="system"/>
+                                                        </buttonCell>
+                                                        <constraints>
+                                                            <constraint firstAttribute="height" constant="16" id="kMC-12-jI3"/>
+                                                            <constraint firstAttribute="width" constant="16" id="lGn-Lf-Rbg"/>
+                                                        </constraints>
+                                                        <connections>
+                                                            <action selector="updateButtonAction:" target="-1" id="1i1-6N-jwn"/>
+                                                        </connections>
+                                                    </button>
+                                                </subviews>
+                                                <constraints>
+                                                    <constraint firstItem="Qhl-y5-raD" firstAttribute="centerY" secondItem="V0s-yA-xvK" secondAttribute="centerY" id="4pK-IB-vBf"/>
+                                                    <constraint firstItem="Qhl-y5-raD" firstAttribute="centerY" secondItem="aLR-Ih-hWR" secondAttribute="centerY" id="7Ir-u1-hao"/>
+                                                    <constraint firstItem="Qhl-y5-raD" firstAttribute="leading" secondItem="aLR-Ih-hWR" secondAttribute="trailing" constant="8" id="Deo-JU-p01"/>
+                                                    <constraint firstItem="aLR-Ih-hWR" firstAttribute="leading" secondItem="V0s-yA-xvK" secondAttribute="leading" constant="16" id="L9h-Fh-zpe"/>
+                                                    <constraint firstItem="IEp-Vd-zdP" firstAttribute="centerY" secondItem="V0s-yA-xvK" secondAttribute="centerY" id="SDB-bs-pwu"/>
+                                                    <constraint firstItem="oWq-Xq-NnS" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="Qhl-y5-raD" secondAttribute="trailing" constant="8" id="T7e-D5-eej"/>
+                                                    <constraint firstItem="IEp-Vd-zdP" firstAttribute="centerY" secondItem="oWq-Xq-NnS" secondAttribute="centerY" id="pjW-5R-LRw"/>
+                                                    <constraint firstItem="IEp-Vd-zdP" firstAttribute="leading" secondItem="oWq-Xq-NnS" secondAttribute="trailing" constant="4" id="rzb-mG-mn1"/>
+                                                    <constraint firstAttribute="trailing" secondItem="IEp-Vd-zdP" secondAttribute="trailing" constant="8" id="vCp-7e-MRO"/>
+                                                </constraints>
+                                                <connections>
+                                                    <outlet property="checkImageView" destination="aLR-Ih-hWR" id="lF9-xZ-EdI"/>
+                                                    <outlet property="moreButton" destination="IEp-Vd-zdP" id="Uz7-h5-sL3"/>
+                                                    <outlet property="styleLabel" destination="Qhl-y5-raD" id="7sJ-x9-HGp"/>
+                                                    <outlet property="styleLabelHeightConstant" destination="2PZ-nq-Zuf" id="WBt-jw-8Pa"/>
+                                                    <outlet property="updateButton" destination="oWq-Xq-NnS" id="c6M-As-848"/>
+                                                </connections>
+                                            </tableCellView>
+                                        </prototypeCellViews>
+                                    </tableColumn>
+                                </tableColumns>
+                                <connections>
+                                    <outlet property="dataSource" destination="-2" id="VsW-ZF-DsS"/>
+                                    <outlet property="delegate" destination="-2" id="pK8-Ci-u3S"/>
+                                </connections>
+                            </tableView>
+                        </subviews>
+                        <color key="backgroundColor" white="1" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                    </clipView>
+                    <scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="ynv-cX-WoY">
+                        <rect key="frame" x="-100" y="-100" width="238" height="16"/>
+                        <autoresizingMask key="autoresizingMask"/>
+                    </scroller>
+                    <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="Duu-lp-Acy">
+                        <rect key="frame" x="-100" y="-100" width="15" height="102"/>
+                        <autoresizingMask key="autoresizingMask"/>
+                    </scroller>
+                </scrollView>
+            </subviews>
+            <constraints>
+                <constraint firstItem="7y1-Xw-f9S" firstAttribute="top" secondItem="oKi-FG-j4C" secondAttribute="bottom" id="1de-mf-urb"/>
+                <constraint firstAttribute="trailing" secondItem="oKi-FG-j4C" secondAttribute="trailing" id="CWq-WD-pMz"/>
+                <constraint firstAttribute="bottom" secondItem="7y1-Xw-f9S" secondAttribute="bottom" id="D5j-5t-puu"/>
+                <constraint firstItem="7y1-Xw-f9S" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="GhX-vN-Xak"/>
+                <constraint firstAttribute="trailing" secondItem="7y1-Xw-f9S" secondAttribute="trailing" id="GrU-6h-3Tp"/>
+                <constraint firstItem="oKi-FG-j4C" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" id="Oid-bB-xfe"/>
+                <constraint firstItem="oKi-FG-j4C" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="e96-SO-RzR"/>
+            </constraints>
+            <point key="canvasLocation" x="139" y="173.5"/>
+        </customView>
+    </objects>
+    <resources>
+        <image name="KMImageNameUXIconBtnAddNor" width="16" height="16"/>
+        <image name="KMImageNameUXIconBtnArrowRight" width="17" height="16"/>
+        <image name="KMImageNameUXIconBtnSidebarMoreSecondary" width="16" height="16"/>
+    </resources>
+</document>

+ 2 - 0
PDF Office/PDF Master/PDF_Reader_Pro DMG-Bridging-Header.h

@@ -104,6 +104,8 @@
 #import "SKBookmarkSheetController.h"
 #import "SKBookmarkController.h"
 #import "SKBookmark.h"
+//文字
+#import "KMFreeTextStylesViewController.h"
 
 #import "AutoSavePopController.h"
 #import "SKFileUpdateChecker.h"

+ 2 - 0
PDF Office/PDF Master/PDF_Reader_Pro Edition-Bridging-Header.h

@@ -100,6 +100,8 @@
 #import "SKBookmarkSheetController.h"
 #import "SKBookmarkController.h"
 #import "SKBookmark.h"
+//文字
+#import "KMFreeTextStylesViewController.h"
 
 #import "AutoSavePopController.h"
 #import "SKFileUpdateChecker.h"

+ 2 - 0
PDF Office/PDF Master/PDF_Reader_Pro-Bridging-Header.h

@@ -100,6 +100,8 @@
 #import "SKBookmarkSheetController.h"
 #import "SKBookmarkController.h"
 #import "SKBookmark.h"
+//文字
+#import "KMFreeTextStylesViewController.h"
 
 #import "AutoSavePopController.h"
 #import "SKFileUpdateChecker.h"

+ 26 - 0
PDF Office/PDF Reader Pro.xcodeproj/project.pbxproj

@@ -2134,6 +2134,12 @@
 		ADD272D429B9CFE20032B5D6 /* KMLightNoNetworkView.xib in Resources */ = {isa = PBXBuildFile; fileRef = ADD272D329B9CFE20032B5D6 /* KMLightNoNetworkView.xib */; };
 		ADD272D529B9CFE20032B5D6 /* KMLightNoNetworkView.xib in Resources */ = {isa = PBXBuildFile; fileRef = ADD272D329B9CFE20032B5D6 /* KMLightNoNetworkView.xib */; };
 		ADD272D629B9CFE20032B5D6 /* KMLightNoNetworkView.xib in Resources */ = {isa = PBXBuildFile; fileRef = ADD272D329B9CFE20032B5D6 /* KMLightNoNetworkView.xib */; };
+		ADD56F572BB3F48300E87ED9 /* KMFreeTextStylesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ADD56F542BB3F48200E87ED9 /* KMFreeTextStylesViewController.m */; };
+		ADD56F582BB3F48300E87ED9 /* KMFreeTextStylesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ADD56F542BB3F48200E87ED9 /* KMFreeTextStylesViewController.m */; };
+		ADD56F592BB3F48300E87ED9 /* KMFreeTextStylesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ADD56F542BB3F48200E87ED9 /* KMFreeTextStylesViewController.m */; };
+		ADD56F5A2BB3F48300E87ED9 /* KMFreeTextStylesViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = ADD56F552BB3F48200E87ED9 /* KMFreeTextStylesViewController.xib */; };
+		ADD56F5B2BB3F48300E87ED9 /* KMFreeTextStylesViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = ADD56F552BB3F48200E87ED9 /* KMFreeTextStylesViewController.xib */; };
+		ADD56F5C2BB3F48300E87ED9 /* KMFreeTextStylesViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = ADD56F552BB3F48200E87ED9 /* KMFreeTextStylesViewController.xib */; };
 		ADD5AE552A64D31200C14249 /* KMPurchaseAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADD5AE542A64D31200C14249 /* KMPurchaseAlertView.swift */; };
 		ADD5AE562A64D31200C14249 /* KMPurchaseAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADD5AE542A64D31200C14249 /* KMPurchaseAlertView.swift */; };
 		ADD5AE572A64D31200C14249 /* KMPurchaseAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADD5AE542A64D31200C14249 /* KMPurchaseAlertView.swift */; };
@@ -6006,6 +6012,9 @@
 		ADD1B70929471FA500C3FFF7 /* KMPrintChoosePresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMPrintChoosePresenter.swift; sourceTree = "<group>"; };
 		ADD272CF29B9CFD30032B5D6 /* KMLightNoNetworkView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMLightNoNetworkView.swift; sourceTree = "<group>"; };
 		ADD272D329B9CFE20032B5D6 /* KMLightNoNetworkView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMLightNoNetworkView.xib; sourceTree = "<group>"; };
+		ADD56F542BB3F48200E87ED9 /* KMFreeTextStylesViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KMFreeTextStylesViewController.m; sourceTree = "<group>"; };
+		ADD56F552BB3F48200E87ED9 /* KMFreeTextStylesViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KMFreeTextStylesViewController.xib; sourceTree = "<group>"; };
+		ADD56F562BB3F48200E87ED9 /* KMFreeTextStylesViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KMFreeTextStylesViewController.h; sourceTree = "<group>"; };
 		ADD5AE542A64D31200C14249 /* KMPurchaseAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMPurchaseAlertView.swift; sourceTree = "<group>"; };
 		ADD5AE582A64DD2600C14249 /* KMPurchaseAlertView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMPurchaseAlertView.xib; sourceTree = "<group>"; };
 		ADDDCE1B2B43A32A005B4AB5 /* AppSandboxFileAccess.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppSandboxFileAccess.h; sourceTree = "<group>"; };
@@ -7729,6 +7738,7 @@
 		89E4E6F82963D341002DBA6F /* View */ = {
 			isa = PBXGroup;
 			children = (
+				ADD56F532BB3F48200E87ED9 /* KMFreeTextStylesViewController */,
 				ADDEEA712AD3EFE200EF675D /* KMButton.swift */,
 				BBA922212B4E7D340061057A /* HyperLinkButton.swift */,
 				ADDEEA792AD3F4C800EF675D /* KMPopUpButton.swift */,
@@ -9926,6 +9936,16 @@
 			path = TextField;
 			sourceTree = "<group>";
 		};
+		ADD56F532BB3F48200E87ED9 /* KMFreeTextStylesViewController */ = {
+			isa = PBXGroup;
+			children = (
+				ADD56F562BB3F48200E87ED9 /* KMFreeTextStylesViewController.h */,
+				ADD56F542BB3F48200E87ED9 /* KMFreeTextStylesViewController.m */,
+				ADD56F552BB3F48200E87ED9 /* KMFreeTextStylesViewController.xib */,
+			);
+			path = KMFreeTextStylesViewController;
+			sourceTree = "<group>";
+		};
 		ADD5AE532A64D29600C14249 /* Alert */ = {
 			isa = PBXGroup;
 			children = (
@@ -14017,6 +14037,7 @@
 				ADDF83472B391A5C00A81A4E /* DSignatureCreateInfoViewController.xib in Resources */,
 				AD7D5C982B8F20FE006562CD /* synctex_parser_readme.txt in Resources */,
 				AD0FA4FE29A8DD8700EDEB50 /* KMRegisterSuccessView.xib in Resources */,
+				ADD56F5A2BB3F48300E87ED9 /* KMFreeTextStylesViewController.xib in Resources */,
 				9F0CB49229683DEE00007028 /* KMPropertiesPanelLineSubVC.xib in Resources */,
 				BBE9D09B2AF0CEEB002E83CE /* KMBatchOperateCompressViewController.xib in Resources */,
 				BB88108E2B4F7C4100AFA63E /* KMVerificationExpiredViewController.xib in Resources */,
@@ -14405,6 +14426,7 @@
 				9F8539FA2947137500DF644E /* newtab_p.pdf in Resources */,
 				BB853C962AF8DCC7009C20C1 /* KMBatchOperateRemovePasswordViewController.xib in Resources */,
 				BB1B0AE42B4FC6E900889528 /* KMOpenFileGuideToolbar.xib in Resources */,
+				ADD56F5B2BB3F48300E87ED9 /* KMFreeTextStylesViewController.xib in Resources */,
 				9F5752ED2B58FF73005DC303 /* KMAnnotationFromViewController.xib in Resources */,
 				BB04FD112B206F4000D80F7B /* KMPlanViewController.xib in Resources */,
 				BBB376AB2B10A7FD009539CC /* a_3a.png in Resources */,
@@ -14913,6 +14935,7 @@
 				BBAFC8412985194800D0648E /* KMPDFEditAppendWindow.xib in Resources */,
 				BBA19F3829ADACC5001A285A /* signPicture_nor.pdf in Resources */,
 				9FBA0EE628FEC253001117AF /* KMProductPromotionViewController.xib in Resources */,
+				ADD56F5C2BB3F48300E87ED9 /* KMFreeTextStylesViewController.xib in Resources */,
 				89E9B3FB295BE2EC00AEFA61 /* KMEditPDFTextPropertyViewController.xib in Resources */,
 				ADFCEB662B4FBFC50001EBAF /* ad_cancel_button00@2x.png in Resources */,
 				9F02018B2A1DA28B00C9B673 /* KMAILanguagePopVC.xib in Resources */,
@@ -15461,6 +15484,7 @@
 				F3599222292CA27B000D25DE /* CPDFListViewRuntime.m in Sources */,
 				BB1331542AD7A6A1008F6791 /* KMFileAttribute.swift in Sources */,
 				BB0A55182A3074F400B6E84B /* KMHoverView.swift in Sources */,
+				ADD56F572BB3F48300E87ED9 /* KMFreeTextStylesViewController.m in Sources */,
 				9F53D54F2AD677A000CCF9D8 /* CPDFListViewConfig.swift in Sources */,
 				AD7D5CB32B9070AF006562CD /* KMSyncDot.swift in Sources */,
 				BB2A98522B270B3300647AF3 /* KMBatchAddBackgroundOperation.swift in Sources */,
@@ -17494,6 +17518,7 @@
 				9F0CB4DE2986554D00007028 /* KMDesignToken+HorizontalPadding.swift in Sources */,
 				BBBAED112B57E76400266BD3 /* NSGraphics_SKExtensions.m in Sources */,
 				9F1FE49A29406E4700E952CA /* NewTabButton.m in Sources */,
+				ADD56F582BB3F48300E87ED9 /* KMFreeTextStylesViewController.m in Sources */,
 				9F512CD02B469A7700EC0BC3 /* KMPageDisplayThemeCollectionViewItem.swift in Sources */,
 				BBF2455E2AE78FF900037D08 /* KMBatchWindow.swift in Sources */,
 				BBC4F9FB2AEB9E200098A1A8 /* KMBatchTableCellView.swift in Sources */,
@@ -17801,6 +17826,7 @@
 				9F0CB4F7298655D500007028 /* KMDesignToken+Fill.swift in Sources */,
 				BB49ED1F293F4FB200C82CA2 /* KMConvertPPTsSettingView.swift in Sources */,
 				BB14703D299DC0D200784A6A /* OIDErrorUtilities.m in Sources */,
+				ADD56F592BB3F48300E87ED9 /* KMFreeTextStylesViewController.m in Sources */,
 				BBFE6E772930E53000142C01 /* KMMergePopoverViewController.swift in Sources */,
 				ADF6B8782A48155E0090CB78 /* KMComparativeViewCollectionItem.swift in Sources */,
 				BB65A07A2AF8E2F2003A27A0 /* KMSyncPreferences.swift in Sources */,

File diff ditekan karena terlalu besar
+ 1605 - 1018
PDF Office/PDF Reader Pro.xcodeproj/xcuserdata/lizhe.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist