Revision: 26304 http://sourceforge.net/p/bibdesk/svn/26304 Author: hofman Date: 2021-06-26 09:38:24 +0000 (Sat, 26 Jun 2021) Log Message: ----------- Make named images for touch bars
Modified Paths: -------------- trunk/bibdesk/BDSKBookmarkController.m trunk/bibdesk/BDSKFindController.m trunk/bibdesk/BDSKSearchBookmarkController.m trunk/bibdesk/NSImage_BDSKExtensions.h trunk/bibdesk/NSImage_BDSKExtensions.m Modified: trunk/bibdesk/BDSKBookmarkController.m =================================================================== --- trunk/bibdesk/BDSKBookmarkController.m 2021-06-26 09:14:08 UTC (rev 26303) +++ trunk/bibdesk/BDSKBookmarkController.m 2021-06-26 09:38:24 UTC (rev 26304) @@ -782,7 +782,7 @@ if (addBookmarkTouchBarButton == nil) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wpartial-availability" - addBookmarkTouchBarButton = [[NSButton buttonWithImage:[NSImage addBookmarkTouchBarImage] target:self action:@selector(insertBookmark:)] retain]; + addBookmarkTouchBarButton = [[NSButton buttonWithImage:[NSImage imageNamed:@"BDSKTouchBarAddBookmark"] target:self action:@selector(insertBookmark:)] retain]; #pragma clang diagnostic pop [item setView:addBookmarkTouchBarButton]; [item setCustomizationLabel:NSLocalizedString(@"New Bookmark", @"Toolbar item label")]; @@ -800,7 +800,7 @@ if (addSeparatorTouchBarButton == nil) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wpartial-availability" - addSeparatorTouchBarButton = [[NSButton buttonWithImage:[NSImage addSeparatorTouchBarImage] target:self action:@selector(insertBookmarkSeparator:)] retain]; + addSeparatorTouchBarButton = [[NSButton buttonWithImage:[NSImage imageNamed:@"BDSKTouchBarAddSeparator"] target:self action:@selector(insertBookmarkSeparator:)] retain]; #pragma clang diagnostic pop [item setView:addSeparatorTouchBarButton]; [item setCustomizationLabel:NSLocalizedString(@"New Separator", @"Toolbar item label")]; Modified: trunk/bibdesk/BDSKFindController.m =================================================================== --- trunk/bibdesk/BDSKFindController.m 2021-06-26 09:14:08 UTC (rev 26303) +++ trunk/bibdesk/BDSKFindController.m 2021-06-26 09:38:24 UTC (rev 26304) @@ -1190,6 +1190,7 @@ #pragma mark Touch Bar - (NSTouchBar *)makeTouchBar { + [NSImage makeFindImages]; NSTouchBar *touchBar = [[[NSClassFromString(@"NSTouchBar") alloc] init] autorelease]; [touchBar setDelegate:self]; [touchBar setDefaultItemIdentifiers:[NSArray arrayWithObjects:BDSKTouchBarItemIdentifierReplaceAll, BDSKTouchBarItemIdentifierReplace, BDSKTouchBarItemIdentifierReplaceAndFind, BDSKTouchBarItemIdentifierPrevious, BDSKTouchBarItemIdentifierNext, nil]]; @@ -1201,7 +1202,7 @@ if ([identifier isEqualToString:BDSKTouchBarItemIdentifierReplaceAll]) { #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wpartial-availability" - NSButton *button = [NSButton buttonWithImage:[NSImage replaceAllTouchBarImage] target:self action:@selector(performFindPanelAction:)]; + NSButton *button = [NSButton buttonWithImage:[NSImage imageNamed:@"BDSKTouchBarReplaceAll"] target:self action:@selector(performFindPanelAction:)]; #pragma clang diagnostic pop [button setTag:NSFindPanelActionReplaceAll]; item = [[[NSClassFromString(@"NSCustomTouchBarItem") alloc] initWithIdentifier:identifier] autorelease]; @@ -1209,7 +1210,7 @@ } else if ([identifier isEqualToString:BDSKTouchBarItemIdentifierReplace]) { #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wpartial-availability" - NSButton *button = [NSButton buttonWithImage:[NSImage replaceTouchBarImage] target:self action:@selector(performFindPanelAction:)]; + NSButton *button = [NSButton buttonWithImage:[NSImage imageNamed:@"BDSKTouchBarReplace"] target:self action:@selector(performFindPanelAction:)]; #pragma clang diagnostic pop [button setTag:NSFindPanelActionReplace]; item = [[[NSClassFromString(@"NSCustomTouchBarItem") alloc] initWithIdentifier:identifier] autorelease]; @@ -1217,7 +1218,7 @@ } else if ([identifier isEqualToString:BDSKTouchBarItemIdentifierReplaceAndFind]) { #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wpartial-availability" - NSButton *button = [NSButton buttonWithImage:[NSImage replaceAndFindTouchBarImage] target:self action:@selector(performFindPanelAction:)]; + NSButton *button = [NSButton buttonWithImage:[NSImage imageNamed:@"BDSKTouchBarReplaceAndFind"] target:self action:@selector(performFindPanelAction:)]; #pragma clang diagnostic pop [button setTag:NSFindPanelActionReplaceAndFind]; item = [[[NSClassFromString(@"NSCustomTouchBarItem") alloc] initWithIdentifier:identifier] autorelease]; Modified: trunk/bibdesk/BDSKSearchBookmarkController.m =================================================================== --- trunk/bibdesk/BDSKSearchBookmarkController.m 2021-06-26 09:14:08 UTC (rev 26303) +++ trunk/bibdesk/BDSKSearchBookmarkController.m 2021-06-26 09:38:24 UTC (rev 26304) @@ -753,7 +753,7 @@ if (addSeparatorTouchBarButton == nil) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wpartial-availability" - addSeparatorTouchBarButton = [[NSButton buttonWithImage:[NSImage addSeparatorTouchBarImage] target:self action:@selector(insertBookmarkSeparator:)] retain]; + addSeparatorTouchBarButton = [[NSButton buttonWithImage:[NSImage imageNamed:@"BDSKTouchBarAddSeparator"] target:self action:@selector(insertBookmarkSeparator:)] retain]; #pragma clang diagnostic pop [item setView:addSeparatorTouchBarButton]; [item setCustomizationLabel:NSLocalizedString(@"New Separator", @"Toolbar item label")]; Modified: trunk/bibdesk/NSImage_BDSKExtensions.h =================================================================== --- trunk/bibdesk/NSImage_BDSKExtensions.h 2021-06-26 09:14:08 UTC (rev 26303) +++ trunk/bibdesk/NSImage_BDSKExtensions.h 2021-06-26 09:38:24 UTC (rev 26304) @@ -43,6 +43,7 @@ + (void)makePreviewDisplayImages; + (void)makeBookmarkImages; ++ (void)makeFindImages; + (NSImage *)imageForURL:(NSURL *)aURL; @@ -52,11 +53,6 @@ + (NSImage *)redPaperclipImage; + (NSImage *)annotatedPaperclipImage; + (NSImage *)redAnnotatedPaperclipImage; -+ (NSImage *)addBookmarkTouchBarImage; -+ (NSImage *)addSeparatorTouchBarImage; -+ (NSImage *)replaceAllTouchBarImage; -+ (NSImage *)replaceTouchBarImage; -+ (NSImage *)replaceAndFindTouchBarImage; + (NSImage *)menuIcon; + (NSImage *)overflowImage; Modified: trunk/bibdesk/NSImage_BDSKExtensions.m =================================================================== --- trunk/bibdesk/NSImage_BDSKExtensions.m 2021-06-26 09:14:08 UTC (rev 26303) +++ trunk/bibdesk/NSImage_BDSKExtensions.m 2021-06-26 09:38:24 UTC (rev 26304) @@ -47,9 +47,15 @@ #define BDSKImageNameToolbarAddSeparator @"BDSKToolbarAddSeparator" #define BDSKImageNameToolbarDelete @"BDSKToolbarDelete" #define BDSKImageNameToolbarEdit @"BDSKToolbarEdit" +#define BDSKImageNameTouchBarAddBookmark @"BDSKTouchBarAddBookmark" +#define BDSKImageNameTouchBarAddSeparator @"BDSKTouchBarAddSeparator" #define BDSKImageNameSeparator @"BDSKSeparator" +#define BDSKImageNameTouchBarReplace @"BDSKTouchBarReplace" +#define BDSKImageNameTouchBarReplaceAll @"BDSKTouchBarReplaceAll" +#define BDSKImageNameTouchBarReplaceAndFind @"BDSKTouchBarReplaceAndFind" + #define BDSKImageNamePreviewDisplayTextTemplate @"BDSKPreviewDisplayText" #define BDSKImageNamePreviewDisplayFilesTemplate @"BDSKPreviewDisplayFiles" #define BDSKImageNamePreviewDisplayTeXTemplate @"BDSKPreviewDisplayTeX" @@ -151,7 +157,10 @@ static NSImage *addSeparatorToolbarImage = nil; static NSImage *deleteToolbarImage = nil; static NSImage *editToolbarImage = nil; - + static NSImage *addBookmarkTouchBarImage = nil; + static NSImage *addFolderTouchBarImage = nil; + static NSImage *addSeparatorTouchBarImage = nil; + if (separatorImage == nil) { separatorImage = [[NSImage alloc] initWithSize:NSMakeSize(2.0, 2.0)]; @@ -280,81 +289,69 @@ [path fill]; }]; [editToolbarImage setName:BDSKImageNameToolbarEdit]; + + addBookmarkTouchBarImage = [[NSImage alloc] initToolbarImageWithSize:NSMakeSize(28.0, 30.0) drawingHandler:^{ + NSBezierPath *path = [NSBezierPath bezierPath]; + [path moveToPoint:NSMakePoint(20.5, 18.25)]; + [path lineToPoint:NSMakePoint(28.0, 18.25)]; + [path moveToPoint:NSMakePoint(24.25, 14.5)]; + [path lineToPoint:NSMakePoint(24.25, 22.0)]; + [path setLineWidth:1.5]; + [path stroke]; + path = [NSBezierPath bezierPath]; + [path moveToPoint:NSMakePoint(0.0, 30.0)]; + [path lineToPoint:NSMakePoint(22.5, 30.0)]; + [path lineToPoint:NSMakePoint(22.5, 20.0)]; + [path lineToPoint:NSMakePoint(19.5, 20.0)]; + [path lineToPoint:NSMakePoint(19.5, 16.5)]; + [path lineToPoint:NSMakePoint(22.5, 20.0)]; + [path lineToPoint:NSMakePoint(22.5, 13.5)]; + [path lineToPoint:NSMakePoint(28.0, 13.5)]; + [path lineToPoint:NSMakePoint(28.0, 0.0)]; + [path lineToPoint:NSMakePoint(0.0, 0.0)]; + [path closePath]; + [path addClip]; + path = [NSBezierPath bezierPathWithOvalInRect:NSMakeRect(4.0, 5.0, 20.0, 20.0)]; + [path appendBezierPathWithOvalInRect:NSMakeRect(10.0, 5.0, 8.0, 20.0)]; + [path moveToPoint:NSMakePoint(4.0, 15.0)]; + [path lineToPoint:NSMakePoint(24.0, 15.0)]; + [path moveToPoint:NSMakePoint(7.0, 22.0)]; + [path curveToPoint:NSMakePoint(14.0, 20.0) controlPoint1:NSMakePoint(12.0, 20.0) controlPoint2:NSMakePoint(10.0, 20.0)]; + [path curveToPoint:NSMakePoint(21.0, 22.0) controlPoint1:NSMakePoint(18.0, 20.0) controlPoint2:NSMakePoint(16.0, 20.0)]; + [path moveToPoint:NSMakePoint(7.0, 8.0)]; + [path curveToPoint:NSMakePoint(14.0, 10.0) controlPoint1:NSMakePoint(12.0, 10.0) controlPoint2:NSMakePoint(10.0, 10.0)]; + [path curveToPoint:NSMakePoint(21.0, 8.0) controlPoint1:NSMakePoint(18.0, 10.0) controlPoint2:NSMakePoint(16.0, 10.0)]; + [path stroke]; + }]; + [addBookmarkTouchBarImage setName:BDSKImageNameTouchBarAddBookmark]; + + addSeparatorTouchBarImage = [[NSImage alloc] initToolbarImageWithSize:NSMakeSize(28.0, 30.0) drawingHandler:^{ + NSBezierPath *path = [NSBezierPath bezierPath]; + [path moveToPoint:NSMakePoint(20.5, 18.25)]; + [path lineToPoint:NSMakePoint(28.0, 18.25)]; + [path moveToPoint:NSMakePoint(24.25, 14.5)]; + [path lineToPoint:NSMakePoint(24.25, 22.0)]; + [path setLineWidth:1.5]; + [path stroke]; + path = [NSBezierPath bezierPath]; + [path moveToPoint:NSMakePoint(1.0, 12.0)]; + [path lineToPoint:NSMakePoint(27.0, 12.0)]; + [path setLineWidth:2.0]; + [[NSColor colorWithGenericGamma22White:0.0 alpha:0.8] setStroke]; + [path stroke]; + }]; + [addSeparatorTouchBarImage setName:BDSKImageNameTouchBarAddSeparator]; } } -+ (NSImage *)addBookmarkTouchBarImage { - static NSImage *image = nil; - if (image == nil) { - image = [[NSImage alloc] initWithSize:NSMakeSize(28.0, 30.0)]; - [image lockFocus]; ++ (void)makeFindImages { + static NSImage *replaceAllTouchBarImage = nil; + static NSImage *replaceTouchBarImage = nil; + static NSImage *replaceAndFindTouchBarImage = nil; + + if (replaceAllTouchBarImage == nil) { + replaceAllTouchBarImage = [[NSImage alloc] initToolbarImageWithSize:NSMakeSize(36.0, 30.0) drawingHandler:^{ NSBezierPath *path = [NSBezierPath bezierPath]; - [path moveToPoint:NSMakePoint(20.5, 18.25)]; - [path lineToPoint:NSMakePoint(28.0, 18.25)]; - [path moveToPoint:NSMakePoint(24.25, 14.5)]; - [path lineToPoint:NSMakePoint(24.25, 22.0)]; - [path setLineWidth:1.5]; - [path stroke]; - path = [NSBezierPath bezierPath]; - [path moveToPoint:NSMakePoint(0.0, 30.0)]; - [path lineToPoint:NSMakePoint(22.5, 30.0)]; - [path lineToPoint:NSMakePoint(22.5, 20.0)]; - [path lineToPoint:NSMakePoint(19.5, 20.0)]; - [path lineToPoint:NSMakePoint(19.5, 16.5)]; - [path lineToPoint:NSMakePoint(22.5, 20.0)]; - [path lineToPoint:NSMakePoint(22.5, 13.5)]; - [path lineToPoint:NSMakePoint(28.0, 13.5)]; - [path lineToPoint:NSMakePoint(28.0, 0.0)]; - [path lineToPoint:NSMakePoint(0.0, 0.0)]; - [path closePath]; - [path addClip]; - path = [NSBezierPath bezierPathWithOvalInRect:NSMakeRect(4.0, 5.0, 20.0, 20.0)]; - [path appendBezierPathWithOvalInRect:NSMakeRect(10.0, 5.0, 8.0, 20.0)]; - [path moveToPoint:NSMakePoint(4.0, 15.0)]; - [path lineToPoint:NSMakePoint(24.0, 15.0)]; - [path moveToPoint:NSMakePoint(7.0, 22.0)]; - [path curveToPoint:NSMakePoint(14.0, 20.0) controlPoint1:NSMakePoint(12.0, 20.0) controlPoint2:NSMakePoint(10.0, 20.0)]; - [path curveToPoint:NSMakePoint(21.0, 22.0) controlPoint1:NSMakePoint(18.0, 20.0) controlPoint2:NSMakePoint(16.0, 20.0)]; - [path moveToPoint:NSMakePoint(7.0, 8.0)]; - [path curveToPoint:NSMakePoint(14.0, 10.0) controlPoint1:NSMakePoint(12.0, 10.0) controlPoint2:NSMakePoint(10.0, 10.0)]; - [path curveToPoint:NSMakePoint(21.0, 8.0) controlPoint1:NSMakePoint(18.0, 10.0) controlPoint2:NSMakePoint(16.0, 10.0)]; - [path stroke]; - [image unlockFocus]; - [image setTemplate:YES]; - } - return image; -} - -+ (NSImage *)addSeparatorTouchBarImage { - static NSImage *image = nil; - if (image == nil) { - image = [[NSImage alloc] initWithSize:NSMakeSize(28.0, 30.0)]; - [image lockFocus]; - NSBezierPath *path = [NSBezierPath bezierPath]; - [path moveToPoint:NSMakePoint(20.5, 18.25)]; - [path lineToPoint:NSMakePoint(28.0, 18.25)]; - [path moveToPoint:NSMakePoint(24.25, 14.5)]; - [path lineToPoint:NSMakePoint(24.25, 22.0)]; - [path setLineWidth:1.5]; - [path stroke]; - path = [NSBezierPath bezierPath]; - [path moveToPoint:NSMakePoint(1.0, 12.0)]; - [path lineToPoint:NSMakePoint(27.0, 12.0)]; - [path setLineWidth:2.0]; - [[NSColor colorWithGenericGamma22White:0.0 alpha:0.8] setStroke]; - [path stroke]; - [image unlockFocus]; - [image setTemplate:YES]; - } - return image; -} - -+ (NSImage *)replaceAllTouchBarImage { - static NSImage *image = nil; - if (image == nil) { - image = [[NSImage alloc] initWithSize:NSMakeSize(36.0, 30.0)]; - [image lockFocus]; - NSBezierPath *path = [NSBezierPath bezierPath]; [path moveToPoint:NSMakePoint(23.0, 22.5)]; [path appendBezierPathWithArcFromPoint:NSMakePoint(31.5, 22.5) toPoint:NSMakePoint(31.5, 9.0) radius:4.0]; [path lineToPoint:NSMakePoint(31.5, 11.0)]; @@ -375,17 +372,10 @@ [path lineToPoint:NSMakePoint(8.0, 16.0)]; [path setLineCapStyle:NSRoundLineCapStyle]; [path stroke]; - [image unlockFocus]; - [image setTemplate:YES]; - } - return image; -} - -+ (NSImage *)replaceTouchBarImage { - static NSImage *image = nil; - if (image == nil) { - image = [[NSImage alloc] initWithSize:NSMakeSize(30.0, 30.0)]; - [image lockFocus]; + }]; + [replaceAllTouchBarImage setName:BDSKImageNameTouchBarReplaceAll]; + + replaceTouchBarImage = [[NSImage alloc] initToolbarImageWithSize:NSMakeSize(30.0, 30.0) drawingHandler:^{ NSBezierPath *path = [NSBezierPath bezierPath]; [path moveToPoint:NSMakePoint(2.0, 22.5)]; [path appendBezierPathWithArcFromPoint:NSMakePoint(25.5, 22.5) toPoint:NSMakePoint(25.5, 9.0) radius:4.0]; @@ -401,17 +391,10 @@ [path lineToPoint:NSMakePoint(8.0, 16.0)]; [path setLineCapStyle:NSRoundLineCapStyle]; [path stroke]; - [image unlockFocus]; - [image setTemplate:YES]; - } - return image; -} - -+ (NSImage *)replaceAndFindTouchBarImage { - static NSImage *image = nil; - if (image == nil) { - image = [[NSImage alloc] initWithSize:NSMakeSize(36.0, 30.0)]; - [image lockFocus]; + }]; + [replaceTouchBarImage setName:BDSKImageNameTouchBarReplace]; + + replaceAndFindTouchBarImage = [[NSImage alloc] initToolbarImageWithSize:NSMakeSize(36.0, 30.0) drawingHandler:^{ NSBezierPath *path = [NSBezierPath bezierPath]; [path moveToPoint:NSMakePoint(2.0, 22.5)]; [path lineToPoint:NSMakePoint(13.0, 22.5)]; @@ -434,10 +417,9 @@ [path lineToPoint:NSMakePoint(8.0, 16.0)]; [path setLineCapStyle:NSRoundLineCapStyle]; [path stroke]; - [image unlockFocus]; - [image setTemplate:YES]; + }]; + [replaceAndFindTouchBarImage setName:BDSKImageNameTouchBarReplaceAndFind]; } - return image; } + (NSImage *)menuIcon This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ Bibdesk-commit mailing list Bibdesk-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-commit