|
@@ -395,7 +395,7 @@ class KMBatchOperateAddWatermarkViewController: KMBatchOperateBaseViewController
|
|
|
let controller = KMWatermarkWindowController(windowNibName: "KMWatermarkWindowController")
|
|
|
controller.isBatch = isBatchOperation
|
|
|
controller.pdfDocument = cdocument
|
|
|
-
|
|
|
+ controller.currentType = self.currentType.rawValue
|
|
|
controller.cancelAction = { [unowned self] wmWindowC in
|
|
|
self.km_endSheet()
|
|
|
}
|
|
@@ -404,158 +404,6 @@ class KMBatchOperateAddWatermarkViewController: KMBatchOperateBaseViewController
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /*
|
|
|
-
|
|
|
- //添加水印模版
|
|
|
- - (IBAction):(id)sender {
|
|
|
- NSWindowController *windowController = self.view.window.windowController;
|
|
|
- NSString *filePath = nil;
|
|
|
- NSString *password = nil;
|
|
|
- // if ([self.view.window.windowController isKindOfClass:[SKMainWindowController class]]) {
|
|
|
- // filePath = [[(SKMainWindowController *)windowController pdfView].document.documentURL path];
|
|
|
- // SKPDFDocument *document = (SKPDFDocument *)[(SKMainWindowController *)windowController pdfView].document;
|
|
|
- // password = document.password;
|
|
|
- // }
|
|
|
-
|
|
|
- if (!self.isBackground) {
|
|
|
- // KMWatermarkManagerWindowController *watermarWindowController = [[[KMWatermarkManagerWindowController alloc] initWithBaseFile:filePath watermark:nil password:password type:KMWatermarkManagerType_Add fileType:self.currentType] autorelease];
|
|
|
- // __block typeof(self) blockSelf = self;
|
|
|
- // watermarWindowController.operateCallBack = ^(KMPDFWatermarkData *watermark, NSInteger currentType) {
|
|
|
- // blockSelf.currentType = currentType;
|
|
|
- //
|
|
|
- // [blockSelf loadData];
|
|
|
- //// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
- //// if ([self checkAndResetTask]) {
|
|
|
- //// [self choosePathAndBeginOperation:watermark];
|
|
|
- //// }
|
|
|
- //// });
|
|
|
- //
|
|
|
- // BOOL haveWaters = NO;
|
|
|
- // if (blockSelf.currentType == KMWatermarkType_Txt) {
|
|
|
- // blockSelf.currentTextData = watermark;;
|
|
|
- // if (blockSelf.textTemplateArray.count > 0) {
|
|
|
- // haveWaters = YES;
|
|
|
- // }
|
|
|
- // } else if (blockSelf.currentType == KMWatermarkType_File) {
|
|
|
- // blockSelf.currentFileData = watermark;;
|
|
|
- // if (blockSelf.fileTemplateArray.count > 0) {
|
|
|
- // haveWaters = YES;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // if (haveWaters) {
|
|
|
- // NSIndexPath *indexpath = [NSIndexPath indexPathForItem:0 inSection:0];
|
|
|
- // NSMutableSet *set = [NSMutableSet set];
|
|
|
- // [set addObject:indexpath];
|
|
|
- // [blockSelf.collectionView selectItemsAtIndexPaths:set scrollPosition:NSCollectionViewScrollPositionBottom];
|
|
|
- // }
|
|
|
- //
|
|
|
- // [blockSelf postNotification];
|
|
|
- // };
|
|
|
- // [watermarWindowController beginSheetModalForWindow:[NSApp keyWindow] completionHandler:nil];
|
|
|
- } else {
|
|
|
- // KMBackgroundManagerWindowController *backgroundWindowController = [[[KMBackgroundManagerWindowController alloc] initWithBaseFile:filePath background:nil password:password type:KMBackgroundManagerType_Add fileType:self.currentBackgroundType] autorelease];
|
|
|
- // __block typeof(self) blockSelf = self;
|
|
|
- // backgroundWindowController.operateCallBack = ^(KMBackgroundObject *background, NSInteger currentType) {
|
|
|
- // blockSelf.currentBackgroundType = currentType;
|
|
|
- //
|
|
|
- // [blockSelf loadData];
|
|
|
- //// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
- //// if ([self checkAndResetTask]) {
|
|
|
- //// [self choosePathAndBeginOperation:background];
|
|
|
- //// }
|
|
|
- //// });
|
|
|
- //
|
|
|
- // BOOL haveBackgrounds = NO;
|
|
|
- // if (blockSelf.currentBackgroundType == KMBackgroundType_Color) {
|
|
|
- // blockSelf.currentColorData = background;
|
|
|
- // if (blockSelf.textTemplateArray.count > 0) {
|
|
|
- // haveBackgrounds = YES;
|
|
|
- // }
|
|
|
- // } else if (blockSelf.currentBackgroundType == KMBackgroundType_File) {
|
|
|
- // blockSelf.currentImageData = background;
|
|
|
- // if (blockSelf.fileTemplateArray.count > 0) {
|
|
|
- // haveBackgrounds = YES;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // if (haveBackgrounds) {
|
|
|
- // NSIndexPath *indexpath = [NSIndexPath indexPathForItem:0 inSection:0];
|
|
|
- // NSMutableSet *set = [NSMutableSet set];
|
|
|
- // [set addObject:indexpath];
|
|
|
- // [blockSelf.collectionView selectItemsAtIndexPaths:set scrollPosition:NSCollectionViewScrollPositionBottom];
|
|
|
- // }
|
|
|
- //
|
|
|
- // [blockSelf postNotification];
|
|
|
- // };
|
|
|
- // [backgroundWindowController beginSheetModalForWindow:[NSApp keyWindow] completionHandler:nil];
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- - (void)editWatermark:(KMPDFWatermarkData *)waterMark {
|
|
|
- if (!self.isBackground) {
|
|
|
- NSString *filePath = nil;
|
|
|
- NSString *password = nil;
|
|
|
-
|
|
|
- NSWindowController *windowController = self.view.window.windowController;
|
|
|
- // if ([self.view.window.windowController isKindOfClass:[SKMainWindowController class]]) {
|
|
|
- // filePath = [[(SKMainWindowController *)windowController pdfView].document.documentURL path];
|
|
|
- // SKPDFDocument *document = (SKPDFDocument *)[(SKMainWindowController *)windowController pdfView].document;
|
|
|
- // password = document.password;
|
|
|
- // }
|
|
|
-
|
|
|
- // KMWatermarkManagerWindowController *watermarWindowController = [[[KMWatermarkManagerWindowController alloc] initWithBaseFile:filePath watermark:waterMark password:password type:KMWatermarkManagerType_Edit fileType:self.currentType] autorelease];
|
|
|
- // __block typeof(self) blockSelf = self;
|
|
|
- // watermarWindowController.operateCallBack = ^(KMPDFWatermarkData *watermark, NSInteger currentType) {
|
|
|
- // blockSelf.currentType = currentType;
|
|
|
- // if (currentType == 0) {
|
|
|
- // blockSelf.currentTextData = watermark;
|
|
|
- // } else {
|
|
|
- // blockSelf.currentFileData = watermark;
|
|
|
- // }
|
|
|
- // [blockSelf loadData];
|
|
|
- //
|
|
|
- // [blockSelf postNotification];
|
|
|
- // };
|
|
|
- // [watermarWindowController beginSheetModalForWindow:[NSApp keyWindow] completionHandler:nil];
|
|
|
- } else {
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- - (void)editBackground:(KMBackgroundObject *)background {
|
|
|
- NSWindowController *windowController = self.view.window.windowController;
|
|
|
- NSString *filePath = nil;
|
|
|
- NSString *password = nil;
|
|
|
- // if ([self.view.window.windowController isKindOfClass:[SKMainWindowController class]]) {
|
|
|
- // filePath = [[(SKMainWindowController *)windowController pdfView].document.documentURL path];
|
|
|
- // SKPDFDocument *document = (SKPDFDocument *)[(SKMainWindowController *)windowController pdfView].document;
|
|
|
- // password = document.password;
|
|
|
- // }
|
|
|
- //
|
|
|
- // KMBackgroundManagerWindowController *backgroundWindowController = [[[KMBackgroundManagerWindowController alloc] initWithBaseFile:filePath background:background password:password type:KMBackgroundManagerType_Edit fileType:self.currentBackgroundType] autorelease];
|
|
|
- // __block typeof(self) blockSelf = self;
|
|
|
- // backgroundWindowController.operateCallBack = ^(KMBackgroundObject *background, NSInteger currentType) {
|
|
|
- // blockSelf.currentBackgroundType = currentType;
|
|
|
- // if (currentType == 0) {
|
|
|
- // blockSelf.currentColorData = background;
|
|
|
- // } else {
|
|
|
- // blockSelf.currentImageData = background;
|
|
|
- // }
|
|
|
- // [blockSelf loadData];
|
|
|
- //
|
|
|
- // [blockSelf postNotification];
|
|
|
- // };
|
|
|
- // [backgroundWindowController beginSheetModalForWindow:[NSApp keyWindow] completionHandler:nil];
|
|
|
- }
|
|
|
-
|
|
|
- - (void)deleteBackground:(KMBackgroundObject *)background {
|
|
|
- // [[KMBackgroundManager defaultManager] removeBackground:background];
|
|
|
- [self loadData];
|
|
|
-
|
|
|
- [self postNotification];
|
|
|
- }
|
|
|
-
|
|
|
- */
|
|
|
-
|
|
|
}
|
|
|
|
|
|
// MARK: - Private Methods
|