|
@@ -126,6 +126,8 @@ static NSString * const KMTableColumnSizeID = @"size";
|
|
|
}
|
|
|
|
|
|
@property (nonatomic, assign) NSInteger insertRow;
|
|
|
+
|
|
|
+@property (weak) IBOutlet NSBox *tableHeaderBox;
|
|
|
@property (weak) IBOutlet NSTextField *fileNameLabel;
|
|
|
@property (weak) IBOutlet NSTextField *pageRangeLabel;
|
|
|
@property (weak) IBOutlet NSTextField *sizeLabel;
|
|
@@ -138,6 +140,9 @@ static NSString * const KMTableColumnSizeID = @"size";
|
|
|
@property (assign) IBOutlet NSButton *cancelButton;
|
|
|
//@property (assign) IBOutlet NSButton *addFileButton;
|
|
|
|
|
|
+@property (weak) IBOutlet NSButton *nMergeButton;
|
|
|
+@property (weak) IBOutlet NSButton *nCancelButton;
|
|
|
+
|
|
|
@property (weak) IBOutlet NSBox *addBox;
|
|
|
@property (nonatomic, strong) KMDesignSelect *addFileButton;
|
|
|
|
|
@@ -277,37 +282,35 @@ static NSString * const KMTableColumnSizeID = @"size";
|
|
|
i += 1;
|
|
|
}
|
|
|
|
|
|
- _cancelButton.title = NSLocalizedString(@"Cancel", nil);
|
|
|
- self.cancelButton.wantsLayer = YES;
|
|
|
- self.cancelButton.layer.backgroundColor = NSColor.whiteColor.CGColor;
|
|
|
- self.cancelButton.layer.borderWidth = 1;
|
|
|
- self.cancelButton.layer.borderColor = [NSColor colorWithRed:223/255.f green:225/255.f blue:229/255.f alpha:1.f].CGColor;
|
|
|
- self.cancelButton.layer.cornerRadius = 4;
|
|
|
- [self.cancelButton setTitleColor:[NSColor colorWithRed:37/255.f green:38/255.f blue:41/255.f alpha:1.f]];
|
|
|
- self.cancelButton.font = [NSFont fontWithName:@"SFProText-Regular" size:14];
|
|
|
+ self.nCancelButton.title = NSLocalizedString(@"Cancel", nil);
|
|
|
+ self.nCancelButton.wantsLayer = YES;
|
|
|
+ self.nCancelButton.layer.backgroundColor = NSColor.whiteColor.CGColor;
|
|
|
+ self.nCancelButton.layer.borderWidth = 1;
|
|
|
+ self.nCancelButton.layer.borderColor = [NSColor colorWithRed:223/255.f green:225/255.f blue:229/255.f alpha:1.f].CGColor;
|
|
|
+ self.nCancelButton.layer.cornerRadius = 4;
|
|
|
+ [self.nCancelButton setTitleColor:[NSColor colorWithRed:37/255.f green:38/255.f blue:41/255.f alpha:1.f]];
|
|
|
+ self.nCancelButton.font = [NSFont fontWithName:@"SFProText-Regular" size:14];
|
|
|
+ self.nCancelButton.target = self;
|
|
|
+ self.nCancelButton.action = @selector(buttonItemClicked_Cancel:);
|
|
|
_removeButton.title = NSLocalizedString(@"Remove", nil);
|
|
|
self.clearButton.image = [NSImage imageNamed:@"KMImageNameMergeDelete"];
|
|
|
|
|
|
[_addFileButton setTitle:NSLocalizedString(@"Add Files", nil)];
|
|
|
|
|
|
-// if (_editType == KMPDFPageEditAppend) {
|
|
|
-// _appendButton.title = NSLocalizedString(@"Append", nil);
|
|
|
-// } else {
|
|
|
- _appendButton.title = NSLocalizedString(@"Merge", nil);
|
|
|
-// }
|
|
|
- self.appendButton.wantsLayer = YES;
|
|
|
- self.appendButton.layer.backgroundColor = [NSColor colorWithRed:23/255.f green:112/255.f blue:244/255.f alpha:1.f].CGColor;
|
|
|
- self.appendButton.layer.cornerRadius = 4;
|
|
|
- [self.appendButton setTitleColor:[NSColor whiteColor]];
|
|
|
- self.appendButton.font = [NSFont fontWithName:@"SFProText-Regular" size:14];
|
|
|
+ self.nMergeButton.title = NSLocalizedString(@"Merge", nil);
|
|
|
+ self.nMergeButton.wantsLayer = YES;
|
|
|
+ self.nMergeButton.layer.backgroundColor = [NSColor colorWithRed:23/255.f green:112/255.f blue:244/255.f alpha:1.f].CGColor;
|
|
|
+ self.nMergeButton.layer.cornerRadius = 4;
|
|
|
+ [self.nMergeButton setTitleColor:[NSColor whiteColor]];
|
|
|
+ self.nMergeButton.font = [NSFont fontWithName:@"SFProText-Regular" size:14];
|
|
|
+ self.nMergeButton.target = self;
|
|
|
+ self.nMergeButton.action = @selector(buttonItemClicked_Append:);
|
|
|
|
|
|
self.tableView.delegate = self;
|
|
|
self.tableView.dataSource = self;
|
|
|
self.tableView.allowsMultipleSelection = YES;
|
|
|
[_tableView registerForDraggedTypes:[NSArray arrayWithObjects:NSFilenamesPboardType, NSPasteboardTypeString, NSPasteboardTypePDF, MyTableCellViewDataType, nil]];
|
|
|
|
|
|
-
|
|
|
-
|
|
|
NSArray *tableHeaderTitles = @[NSLocalizedString(@"File Name", nil),NSLocalizedString(@"Page Range", nil),NSLocalizedString(@"Size", nil)];
|
|
|
i = 0;
|
|
|
for (NSTextField *label in @[self.fileNameLabel, self.pageRangeLabel, self.sizeLabel]) {
|
|
@@ -340,7 +343,8 @@ static NSString * const KMTableColumnSizeID = @"size";
|
|
|
|
|
|
[self.tableView addSubview:self.myBlankView];
|
|
|
[self.myBlankView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.edges.equalTo(self.tableView);
|
|
|
+ make.left.top.width.equalTo(self.tableView);
|
|
|
+ make.height.equalTo(self.tableView).offset(-60);
|
|
|
}];
|
|
|
self.myBlankView.wantsLayer = YES;
|
|
|
self.myBlankView.layer.backgroundColor = [NSColor clearColor].CGColor;
|
|
@@ -415,22 +419,29 @@ static NSString * const KMTableColumnSizeID = @"size";
|
|
|
{
|
|
|
if (_files.count > 0) {
|
|
|
self.myBlankView.hidden = YES;
|
|
|
+ self.tableHeaderBox.hidden = NO;
|
|
|
[_removeButton setEnabled:YES];
|
|
|
[_clearButton setEnabled:YES];
|
|
|
self.clearButton.image = [NSImage imageNamed:@"KMImageNameMergeDeleteEnabled"];
|
|
|
-// [_appendButton setEnabled:YES];
|
|
|
- [self.appendButton setTitleColor:[NSColor whiteColor]];
|
|
|
- self.appendButton.layer.backgroundColor = [NSColor colorWithRed:23/255.f green:112/255.f blue:244/255.f alpha:1.f].CGColor;
|
|
|
- self.canMerge = YES;
|
|
|
+
|
|
|
+ if (self.files.count > 1) {
|
|
|
+ [self.nMergeButton setTitleColor:[NSColor whiteColor]];
|
|
|
+ self.nMergeButton.layer.backgroundColor = [NSColor colorWithRed:23/255.f green:112/255.f blue:244/255.f alpha:1.f].CGColor;
|
|
|
+ self.canMerge = YES;
|
|
|
+ } else {
|
|
|
+ self.canMerge = NO;
|
|
|
+ [self.nMergeButton setTitleColor:[NSColor colorWithRed:247/255.f green:248/255.f blue:250/255.f alpha:1.f]];
|
|
|
+ self.nMergeButton.layer.backgroundColor = [NSColor colorWithRed:189/255.f green:223/255.f blue:253/255.f alpha:1.f].CGColor;
|
|
|
+ }
|
|
|
} else {
|
|
|
self.myBlankView.hidden = NO;
|
|
|
+ self.tableHeaderBox.hidden = YES;
|
|
|
[_removeButton setEnabled:NO];
|
|
|
[_clearButton setEnabled:NO];
|
|
|
self.clearButton.image = [NSImage imageNamed:@"KMImageNameMergeDelete"];
|
|
|
-// [_appendButton setEnabled:NO];
|
|
|
self.canMerge = NO;
|
|
|
- [self.appendButton setTitleColor:[NSColor colorWithRed:247/255.f green:248/255.f blue:250/255.f alpha:1.f]];
|
|
|
- self.appendButton.layer.backgroundColor = [NSColor colorWithRed:189/255.f green:223/255.f blue:253/255.f alpha:1.f].CGColor;
|
|
|
+ [self.nMergeButton setTitleColor:[NSColor colorWithRed:247/255.f green:248/255.f blue:250/255.f alpha:1.f]];
|
|
|
+ self.nMergeButton.layer.backgroundColor = [NSColor colorWithRed:189/255.f green:223/255.f blue:253/255.f alpha:1.f].CGColor;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -963,8 +974,7 @@ static NSString * const KMTableColumnSizeID = @"size";
|
|
|
|
|
|
_isSuccessfully = NO;
|
|
|
[_progress setHidden:NO];
|
|
|
- [_cancelButton setEnabled:NO];
|
|
|
-// [_appendButton setEnabled:NO];
|
|
|
+ [self.nCancelButton setEnabled:NO];
|
|
|
self.canMerge = NO;
|
|
|
[_progress startAnimation:nil];
|
|
|
|
|
@@ -978,8 +988,7 @@ static NSString * const KMTableColumnSizeID = @"size";
|
|
|
[alert runModal];
|
|
|
|
|
|
[self->_progress setHidden:YES];
|
|
|
- [self->_cancelButton setEnabled:YES];
|
|
|
-// [self->_appendButton setEnabled:YES];
|
|
|
+ [self.nCancelButton setEnabled:YES];
|
|
|
self.canMerge = YES;
|
|
|
});
|
|
|
return;
|
|
@@ -1068,8 +1077,7 @@ static NSString * const KMTableColumnSizeID = @"size";
|
|
|
}
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
[self->_progress setHidden:YES];
|
|
|
- [self->_cancelButton setEnabled:YES];
|
|
|
-// [self->_appendButton setEnabled:YES];
|
|
|
+ [self.nCancelButton setEnabled:YES];
|
|
|
self.canMerge = YES;
|
|
|
|
|
|
if (self->_isSuccessfully) {
|
|
@@ -1113,8 +1121,7 @@ static NSString * const KMTableColumnSizeID = @"size";
|
|
|
});
|
|
|
} else {
|
|
|
[self->_progress setHidden:YES];
|
|
|
- [self->_cancelButton setEnabled:YES];
|
|
|
-// [self->_appendButton setEnabled:YES];
|
|
|
+ [self.nCancelButton setEnabled:YES];
|
|
|
self.canMerge = YES;
|
|
|
}
|
|
|
}];
|
|
@@ -1123,8 +1130,7 @@ static NSString * const KMTableColumnSizeID = @"size";
|
|
|
} else {
|
|
|
|
|
|
[_progress setHidden:YES];
|
|
|
- [_cancelButton setEnabled:YES];
|
|
|
-// [_appendButton setEnabled:YES];
|
|
|
+ [self.nCancelButton setEnabled:YES];
|
|
|
self.canMerge = YES;
|
|
|
|
|
|
if (allPage) {
|
|
@@ -1160,8 +1166,7 @@ static NSString * const KMTableColumnSizeID = @"size";
|
|
|
}
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
[self->_progress setHidden:YES];
|
|
|
- [self->_cancelButton setEnabled:YES];
|
|
|
-// [self->_appendButton setEnabled:YES];
|
|
|
+ [self.nCancelButton setEnabled:YES];
|
|
|
self.canMerge = YES;
|
|
|
|
|
|
if (self->_isSuccessfully) {
|
|
@@ -1205,8 +1210,7 @@ static NSString * const KMTableColumnSizeID = @"size";
|
|
|
});
|
|
|
} else {
|
|
|
[self->_progress setHidden:YES];
|
|
|
- [self->_cancelButton setEnabled:YES];
|
|
|
-// [self->_appendButton setEnabled:YES];
|
|
|
+ [self.nCancelButton setEnabled:YES];
|
|
|
self.canMerge = YES;
|
|
|
}
|
|
|
}];
|