Fixed crash on 10.8 and 10.9 caused by MPToolbarButton

Signed-off-by: michael starke <michael.starke@hicknhack-software.com>
This commit is contained in:
michael starke
2015-10-22 14:25:27 +02:00
parent 83a89b9d1a
commit 4c91a55410
7 changed files with 50 additions and 15 deletions

View File

@@ -13,6 +13,7 @@
4C0104BE17C37DA400173EF3 /* KPKXmlUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C0104BD17C37DA400173EF3 /* KPKXmlUtilities.m */; }; 4C0104BE17C37DA400173EF3 /* KPKXmlUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C0104BD17C37DA400173EF3 /* KPKXmlUtilities.m */; };
4C01C2421764D8980016D5D0 /* MPContextMenuHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C01C2411764D8980016D5D0 /* MPContextMenuHelper.m */; }; 4C01C2421764D8980016D5D0 /* MPContextMenuHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C01C2411764D8980016D5D0 /* MPContextMenuHelper.m */; };
4C01C245176500C40016D5D0 /* HNHLevelIndicatorCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C01C244176500C40016D5D0 /* HNHLevelIndicatorCell.m */; }; 4C01C245176500C40016D5D0 /* HNHLevelIndicatorCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C01C244176500C40016D5D0 /* HNHLevelIndicatorCell.m */; };
4C066A7F1BD8E2C60082CB39 /* KPKReferenceKeys.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C066A7E1BD8E2C60082CB39 /* KPKReferenceKeys.m */; settings = {ASSET_TAGS = (); }; };
4C0728BD17B5B7F7005A7DD9 /* MPPasswordEditWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C0728BC17B5B7F7005A7DD9 /* MPPasswordEditWindowController.m */; }; 4C0728BD17B5B7F7005A7DD9 /* MPPasswordEditWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C0728BC17B5B7F7005A7DD9 /* MPPasswordEditWindowController.m */; };
4C0728BF17B68ED0005A7DD9 /* SavePanelAccessoryView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C0728BE17B68ED0005A7DD9 /* SavePanelAccessoryView.xib */; }; 4C0728BF17B68ED0005A7DD9 /* SavePanelAccessoryView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C0728BE17B68ED0005A7DD9 /* SavePanelAccessoryView.xib */; };
4C08C3AE17B3022400BBBC95 /* KPKLegacyHeaderWriter.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C08C3AD17B3022400BBBC95 /* KPKLegacyHeaderWriter.m */; }; 4C08C3AE17B3022400BBBC95 /* KPKLegacyHeaderWriter.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C08C3AD17B3022400BBBC95 /* KPKLegacyHeaderWriter.m */; };
@@ -409,6 +410,8 @@
4C01C2411764D8980016D5D0 /* MPContextMenuHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = MPContextMenuHelper.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 4C01C2411764D8980016D5D0 /* MPContextMenuHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = MPContextMenuHelper.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
4C01C243176500C40016D5D0 /* HNHLevelIndicatorCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HNHLevelIndicatorCell.h; sourceTree = "<group>"; }; 4C01C243176500C40016D5D0 /* HNHLevelIndicatorCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HNHLevelIndicatorCell.h; sourceTree = "<group>"; };
4C01C244176500C40016D5D0 /* HNHLevelIndicatorCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HNHLevelIndicatorCell.m; sourceTree = "<group>"; }; 4C01C244176500C40016D5D0 /* HNHLevelIndicatorCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HNHLevelIndicatorCell.m; sourceTree = "<group>"; };
4C066A7D1BD8E2C60082CB39 /* KPKReferenceKeys.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPKReferenceKeys.h; sourceTree = "<group>"; };
4C066A7E1BD8E2C60082CB39 /* KPKReferenceKeys.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKReferenceKeys.m; sourceTree = "<group>"; };
4C0728BB17B5B7F7005A7DD9 /* MPPasswordEditWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPPasswordEditWindowController.h; sourceTree = "<group>"; }; 4C0728BB17B5B7F7005A7DD9 /* MPPasswordEditWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPPasswordEditWindowController.h; sourceTree = "<group>"; };
4C0728BC17B5B7F7005A7DD9 /* MPPasswordEditWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPPasswordEditWindowController.m; sourceTree = "<group>"; }; 4C0728BC17B5B7F7005A7DD9 /* MPPasswordEditWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPPasswordEditWindowController.m; sourceTree = "<group>"; };
4C0728BE17B68ED0005A7DD9 /* SavePanelAccessoryView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SavePanelAccessoryView.xib; sourceTree = "<group>"; }; 4C0728BE17B68ED0005A7DD9 /* SavePanelAccessoryView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SavePanelAccessoryView.xib; sourceTree = "<group>"; };
@@ -1160,6 +1163,8 @@
4CD4900F18513C180017397F /* KPKXmlElements.m */, 4CD4900F18513C180017397F /* KPKXmlElements.m */,
4CDFD35618AED5C5002BB267 /* KPKAutotypeCommands.h */, 4CDFD35618AED5C5002BB267 /* KPKAutotypeCommands.h */,
4CDFD35718AED5C5002BB267 /* KPKAutotypeCommands.m */, 4CDFD35718AED5C5002BB267 /* KPKAutotypeCommands.m */,
4C066A7D1BD8E2C60082CB39 /* KPKReferenceKeys.h */,
4C066A7E1BD8E2C60082CB39 /* KPKReferenceKeys.m */,
); );
name = Format; name = Format;
sourceTree = "<group>"; sourceTree = "<group>";
@@ -2425,6 +2430,7 @@
4C26C34B18D8D5A300CF1A1C /* MPPreviewViewController.m in Sources */, 4C26C34B18D8D5A300CF1A1C /* MPPreviewViewController.m in Sources */,
4C4B728518E4B9B400A1A5D5 /* MPDockTileHelper.m in Sources */, 4C4B728518E4B9B400A1A5D5 /* MPDockTileHelper.m in Sources */,
4C52A244177D7B9F0000D88F /* HNHScrollView.m in Sources */, 4C52A244177D7B9F0000D88F /* HNHScrollView.m in Sources */,
4C066A7F1BD8E2C60082CB39 /* KPKReferenceKeys.m in Sources */,
4CC7EA1B17807E7E0089D4F3 /* HNHRoundedTextFieldCellHelper.m in Sources */, 4CC7EA1B17807E7E0089D4F3 /* HNHRoundedTextFieldCellHelper.m in Sources */,
4C5FE9AE17843CE20001D5A8 /* MPSelectedAttachmentTableCellView.m in Sources */, 4C5FE9AE17843CE20001D5A8 /* MPSelectedAttachmentTableCellView.m in Sources */,
4C3666411787327E00B249F1 /* MPDocument+Attachments.m in Sources */, 4C3666411787327E00B249F1 /* MPDocument+Attachments.m in Sources */,

View File

@@ -26,7 +26,8 @@
buildConfiguration = "Debug" buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "NO"> shouldUseLaunchSchemeArgsEnv = "NO"
codeCoverageEnabled = "YES">
<Testables> <Testables>
<TestableReference <TestableReference
skipped = "NO"> skipped = "NO">

View File

@@ -89,6 +89,23 @@
} }
- (void)setControlSize:(NSControlSize)controlSize { - (void)setControlSize:(NSControlSize)controlSize {
NSImageRep *rep = [[self imageForSegment:0] bestRepresentationForRect:NSMakeRect(0, 0, 100, 100) context:nil hints:nil];
CGFloat scale = rep.size.width / rep.size.height;
switch (controlSize) {
case NSRegularControlSize:
[self imageForSegment:0].size = NSMakeSize(16 * scale, 16);
break;
case NSSmallControlSize:
[self imageForSegment:0].size = NSMakeSize(14 * scale, 14);
break;
case NSMiniControlSize:
[self imageForSegment:0].size = NSMakeSize(8 * scale, 8);
default:
break;
}
self.cell.controlSize = controlSize; self.cell.controlSize = controlSize;
} }

View File

@@ -7,6 +7,7 @@
// //
#import "MPReferenceBuilderViewController.h" #import "MPReferenceBuilderViewController.h"
#import "KPKReferenceKeys.h"
@interface MPReferenceBuilderViewController () @interface MPReferenceBuilderViewController ()
@@ -40,7 +41,7 @@
if(allowCustomAttributes) { if(allowCustomAttributes) {
[menu addItemWithTitle:NSLocalizedString(@"CUSTOM_ATTRIBUTE","") action:NULL keyEquivalent:@""]; [menu addItemWithTitle:NSLocalizedString(@"CUSTOM_ATTRIBUTE","") action:NULL keyEquivalent:@""];
} }
NSArray *keys = @[ @"I", @"T", @"U", @"P", @"A", @"N", @"S" ]; NSArray *keys = @[ kKPKReferenceUUIDKey, kKPKReferenceTitleKey, kKPKReferenceUsernameKey, kKPKReferencePasswordKey, kKPKReferenceURLKey, kKPKReferenceNotesKey, @"S" ];
[menu.itemArray enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { [menu.itemArray enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
NSMenuItem *item = (NSMenuItem *)obj; NSMenuItem *item = (NSMenuItem *)obj;
NSAssert(keys.count > idx, @""); NSAssert(keys.count > idx, @"");

View File

@@ -21,6 +21,7 @@
// //
#import "MPToolbarButton.h" #import "MPToolbarButton.h"
#import "HNHCommon.h"
@implementation MPToolbarButton @implementation MPToolbarButton
@@ -54,7 +55,12 @@
default: default:
break; break;
} }
super.controlSize = controlSize; if([self.superclass instancesRespondToSelector:@selector(setControlSize:)]) {
super.controlSize = controlSize;
}
else {
self.cell.controlSize = controlSize;
}
} }
- (NSControlSize)controlSize { - (NSControlSize)controlSize {

View File

@@ -62,9 +62,20 @@
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>2558</string> <string>2560</string>
<key>LSMinimumSystemVersion</key> <key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string> <string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>www.nomadsland.de</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
<key>NSHumanReadableCopyright</key> <key>NSHumanReadableCopyright</key>
<string>Copyright © 2012-2014 HicknHack Software GmbH. All rights reserved.</string> <string>Copyright © 2012-2014 HicknHack Software GmbH. All rights reserved.</string>
<key>NSMainNibFile</key> <key>NSMainNibFile</key>
@@ -114,16 +125,5 @@
</dict> </dict>
</dict> </dict>
</array> </array>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>www.nomadsland.de</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
</dict> </dict>
</plist> </plist>

View File

@@ -15,6 +15,10 @@
@implementation KPKTestAutotype @implementation KPKTestAutotype
- (void)testCommandValidation {
XCTAssertFalse([@"" validateCommmand], @"Emptry strings aren't valid commands");
}
- (void)testSimpleNormalization { - (void)testSimpleNormalization {
NSString *normalized = [@"Whoo %{%}{^}{SHIFT}+ {SPACE}{ENTER}^V%V~T" normalizedAutotypeSequence]; NSString *normalized = [@"Whoo %{%}{^}{SHIFT}+ {SPACE}{ENTER}^V%V~T" normalizedAutotypeSequence];
XCTAssertTrue([normalized isEqualToString:@"Whoo{SPACE}{ALT}{%}{^}{SHIFT}{SHIFT}{SPACE}{SPACE}{ENTER}{CONTROL}V{ALT}V{ENTER}T"]); XCTAssertTrue([normalized isEqualToString:@"Whoo{SPACE}{ALT}{%}{^}{SHIFT}{SHIFT}{SPACE}{SPACE}{ENTER}{CONTROL}V{ALT}V{ENTER}T"]);