Renamed Assets Catalog, modernized code

This commit is contained in:
Michael Starke
2018-09-20 18:03:12 +02:00
parent 8d7bb31b7c
commit 9f35450683
33 changed files with 39 additions and 34 deletions

View File

@@ -27,10 +27,10 @@
"color" : {
"color-space" : "srgb",
"components" : {
"red" : "0.300",
"red" : "0.200",
"alpha" : "1.000",
"blue" : "0.300",
"green" : "0.300"
"blue" : "0.200",
"green" : "0.200"
}
}
}

View File

@@ -27,10 +27,10 @@
"color" : {
"color-space" : "srgb",
"components" : {
"red" : "0.300",
"red" : "0.200",
"alpha" : "1.000",
"blue" : "0.300",
"green" : "0.300"
"blue" : "0.200",
"green" : "0.200"
}
}
}

View File

@@ -27,10 +27,10 @@
"color" : {
"color-space" : "srgb",
"components" : {
"red" : "0.300",
"red" : "0.200",
"alpha" : "1.000",
"blue" : "0.300",
"green" : "0.300"
"blue" : "0.200",
"green" : "0.200"
}
}
}

View File

@@ -27,10 +27,10 @@
"color" : {
"color-space" : "srgb",
"components" : {
"red" : "0.300",
"red" : "0.200",
"alpha" : "1.000",
"blue" : "0.300",
"green" : "0.300"
"blue" : "0.200",
"green" : "0.200"
}
}
}

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View File

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 116 KiB

View File

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

View File

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 116 KiB

View File

Before

Width:  |  Height:  |  Size: 257 KiB

After

Width:  |  Height:  |  Size: 257 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@@ -424,8 +424,12 @@ static CGKeyCode kMPNumpadKeyCodes[] = {
/* Send the event */
CGEventPost(kCGHIDEventTap, pressKey);
/* TODO: Evaluate postToPid */
//CGEventPostToPid(0, pressKey);
usleep(0.05 * NSEC_PER_MSEC);
CGEventPost(kCGHIDEventTap, releaseKey);
/* TODO: Evaluate postToPid */
//CGEventPostToPid(0, releaseKey);
usleep(0.05 * NSEC_PER_MSEC);
CFRelease(pressKey);

View File

@@ -51,12 +51,11 @@
- (void)execute {
if([self.pasteData length] > 0) {
MPPasteBoardController *controller = [MPPasteBoardController defaultController];
[controller stashObjects];
[controller copyObjectsWithoutTimeout:@[self.pasteData]];
[MPPasteBoardController.defaultController stashObjects];
[MPPasteBoardController.defaultController copyObjectsWithoutTimeout:@[self.pasteData]];
[self sendPasteKeyCode];
usleep(0.1 * NSEC_PER_MSEC); // on 10.10 we need to wait a bit before restoring the pasteboard contents
[controller restoreObjects];
usleep(0.2 * NSEC_PER_MSEC); // on 10.10 we need to wait a bit before restoring the pasteboard contents
[MPPasteBoardController.defaultController restoreObjects];
}
}

View File

@@ -24,7 +24,7 @@
@interface MPOverlayWindowController : NSWindowController
+ (MPOverlayWindowController *)sharedController;
@property (nonatomic, strong, readonly, class) MPOverlayWindowController *sharedController;
/**
* Displays an overlay HUD style image with the given text, image centered at the given view.

View File

@@ -56,13 +56,14 @@
- (void)windowDidLoad {
[super windowDidLoad];
[self.window setStyleMask:NSBorderlessWindowMask];
[self.window setAlphaValue:0];
[self.window setOpaque:NO];
[self.window setHasShadow:YES];
[[self.textField cell] setBackgroundStyle:NSBackgroundStyleLowered];
[[self.imageView cell] setBackgroundStyle:NSBackgroundStyleDark];
[[self.imageView cell] setImageAlignment:NSImageAlignCenter];
self.window.styleMask = NSBorderlessWindowMask;
self.window.alphaValue = 0;
self.window.opaque = NO;
self.window.hasShadow = YES;
self.textField.cell.backgroundStyle = NSBackgroundStyleLowered;
self.imageView.cell.backgroundStyle = NSBackgroundStyleDark;
((NSImageCell *)self.imageView.cell).imageAlignment = NSImageAlignCenter;
}
- (void)displayOverlayImage:(NSImage *)imageOrNil label:(NSString *)labelOrNil atView:(NSView *)view {

View File

@@ -74,6 +74,7 @@ NSString *const MPPasteBoardControllerDidClearClipboard = @"com.hicknhack.macpas
for (NSPasteboardItem *item in NSPasteboard.generalPasteboard.pasteboardItems) {
NSPasteboardItem *newItem = [[NSPasteboardItem alloc] init];
for (NSString *type in item.types) {
/* mutable copy to ensure actual deep copy */
NSData *data = [[item dataForType:type] mutableCopy];
if (data) {
[newItem setData:data forType:type];
@@ -118,26 +119,26 @@ NSString *const MPPasteBoardControllerDidClearClipboard = @"com.hicknhack.macpas
NSString *infoText = nil;
switch(overlayInfoType) {
case MPPasteboardOverlayInfoPassword:
infoImage = [[NSBundle mainBundle] imageForResource:@"00_PasswordTemplate"];
infoImage = [NSBundle.mainBundle imageForResource:@"00_PasswordTemplate"];
infoText = NSLocalizedString(@"COPIED_PASSWORD", @"Password was copied to the pasteboard");
break;
case MPPasteboardOverlayInfoURL:
infoImage = [[NSBundle mainBundle] imageForResource:@"01_PackageNetworkTemplate"];
infoImage = [NSBundle.mainBundle imageForResource:@"01_PackageNetworkTemplate"];
infoText = NSLocalizedString(@"COPIED_URL", @"URL was copied to the pasteboard");
break;
case MPPasteboardOverlayInfoUsername:
infoImage = [[NSBundle mainBundle] imageForResource:@"09_IdentityTemplate"];
infoImage = [NSBundle.mainBundle imageForResource:@"09_IdentityTemplate"];
infoText = NSLocalizedString(@"COPIED_USERNAME", @"Username was copied to the pasteboard");
break;
case MPPasteboardOverlayInfoCustom:
infoImage = [[NSBundle mainBundle] imageForResource:@"00_PasswordTemplate"];
infoImage = [NSBundle.mainBundle imageForResource:@"00_PasswordTemplate"];
infoText = [NSString stringWithFormat:NSLocalizedString(@"COPIED_FIELD_%@", "Field name that was copied to the pasteboard"), name];
break;
}
[[MPOverlayWindowController sharedController] displayOverlayImage:infoImage label:infoText atView:view];
[MPOverlayWindowController.sharedController displayOverlayImage:infoImage label:infoText atView:view];
}
- (void)_clearPasteboardContents {