Revision: 25427
http://sourceforge.net/p/bibdesk/svn/25427
Author: hofman
Date: 2021-01-18 00:00:41 +0000 (Mon, 18 Jan 2021)
Log Message:
-----------
Declare and implement canInit... method only in base icon and web icon classes
and subclasses
Modified Paths:
--------------
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVBaseIcon.h
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVBaseIcon.m
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFinderIcon.m
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVIcon.m
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVIcon_Private.h
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVIcon_Private.m
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVPreviewer.m
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVWebViewIcon.h
Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVBaseIcon.h
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVBaseIcon.h 2021-01-17
22:45:44 UTC (rev 25426)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVBaseIcon.h 2021-01-18
00:00:41 UTC (rev 25427)
@@ -53,6 +53,11 @@
BOOL _drawsLinkBadge;
}
+/** Determine whether the class can instantiate with a URl.
+ @param aURL The URL by which to intantiate.
+ @param type The UTI of the file pointed to by the URl. */
++ (BOOL)canInitWithURL:(NSURL *)aURL withType:(NSString *)type;
+
/** Designated initializer.
@param aURL Any NSURL instance.
@param drawsLinkBadge A BOOL. */
Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVBaseIcon.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVBaseIcon.m 2021-01-17
22:45:44 UTC (rev 25426)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVBaseIcon.m 2021-01-18
00:00:41 UTC (rev 25427)
@@ -41,6 +41,11 @@
@implementation FVBaseIcon
++ (BOOL)canInitWithURL:(NSURL *)aURL withType:(NSString *)type;
+{
+ return NO;
+}
+
- (id)initWithURL:(NSURL *)aURL drawsLinkBadge:(BOOL)drawsLinkBadge;
{
self = [self init];
Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFinderIcon.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFinderIcon.m 2021-01-17
22:45:44 UTC (rev 25426)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFinderIcon.m 2021-01-18
00:00:41 UTC (rev 25427)
@@ -105,12 +105,6 @@
// no-op
}
-+ (BOOL)canInitWithURL:(NSURL *)aURL withType:(NSString *)type
-{
- // FVFinderIcon can basically handle any type
- return [aURL scheme] != nil;
-}
-
- (id)initWithURL:(NSURL *)aURL drawsLinkBadge:(BOOL)drawsLinkBadge {
[self release];
if (aURL == nil)
Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVIcon.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVIcon.m 2021-01-17 22:45:44 UTC
(rev 25426)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVIcon.m 2021-01-18 00:00:41 UTC
(rev 25427)
@@ -151,8 +151,8 @@
{
NSParameterAssert(nil != representedURL);
- // initWithURLScheme requires a scheme, so there's not much we can do
without it
- if ([representedURL isEqual:_missingFileURL] || nil == representedURL) {
+ // newWithScheme: requires a scheme, so there's not much we can do without
it
+ if ([representedURL isEqual:_missingFileURL] || nil == [representedURL
scheme]) {
return (id)[FVFinderIcon newMissing];
}
else if (NO == [representedURL isFileURL]) {
@@ -160,10 +160,8 @@
// return a Finder scheme based icon in that case
if ([FVWebViewIcon canInitWithURL:representedURL withType:nil])
return (id)[[FVWebViewIcon alloc] initWithURL:representedURL];
- else if ([FVFinderIcon canInitWithURL:representedURL withType:nil])
+ else
return (id)[FVFinderIcon newWithScheme:[representedURL scheme]];
- else
- return (id)[FVFinderIcon newMissing];
}
NSURL *resolvedURL = nil;
@@ -257,7 +255,7 @@
else if ([FVMovieIcon canInitWithURL:resolvedURL withType:type]) {
anIcon = [[FVMovieIcon alloc] initWithURL:resolvedURL
drawsLinkBadge:isLink];
}
- else if ([FVWebViewIcon canInitWithURL:resolvedURL withType:type]) {
+ else if ([FVWebViewIcon canInitWithURL:resolvedURL withType:type]) {
anIcon = [[FVWebViewIcon alloc] initWithURL:resolvedURL];
}
else if (dataPhysicalSize < maximumTextDataSize && [FVTextIcon
canInitWithURL:resolvedURL withType:type]) {
@@ -268,8 +266,7 @@
if (nil == anIcon && [FVQuickLookIcon canInitWithURL:resolvedURL
withType:type])
anIcon = [[FVQuickLookIcon alloc] initWithURL:resolvedURL
drawsLinkBadge:isLink];
- // In case all subclasses failed, fall back to a Finder icon. +canInit...
is a no-op
- if (nil == anIcon && [FVFinderIcon canInitWithURL:resolvedURL
withType:type])
+ if (nil == anIcon)
anIcon = [FVFinderIcon newWithURL:resolvedURL drawsLinkBadge:isLink];
[(id)theUTI release];
Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVIcon_Private.h
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVIcon_Private.h 2021-01-17
22:45:44 UTC (rev 25426)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVIcon_Private.h 2021-01-18
00:00:41 UTC (rev 25427)
@@ -62,18 +62,7 @@
+ (void)_initializeCategory;
/** @internal
-
- \warning Concrete subclasses should always override this method, so it is
basically a primitive method.
- Determines whether a concrete icon subclass can be initialized with the given
URL and UTI.
-
- @param aURL The URL with which to initialize the icon.
- @param type The UTI for the URL if this is a file URL. May be nil, for
instance for remote URLs.
-*/
-+ (BOOL)canInitWithURL:(NSURL *)aURL withType:(NSString *)type;
-
-/** @internal
-
\warning Subclasses should never have a need to override this method.
Call FVIcon::_startRenderingForKey: for classes that should avoid multiple
render requests for the same icon; useful for multiple views, since the
operation queue only ensures uniqueness of rendering requests per-view.
Requires synchronous caching to be effective, and must be called as @code
[[self class] _startRenderingForKey:aKey] @endcode rather than @code [FVIcon
_startRenderingForKey:aKey] @endcode in order to achieve proper granularity.
Each FVIcon::_startRenderingForKey: must be matched by
FVIcon::_stopRenderingForKey: or bad things will happen. */
Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVIcon_Private.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVIcon_Private.m 2021-01-17
22:45:44 UTC (rev 25426)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVIcon_Private.m 2021-01-18
00:00:41 UTC (rev 25427)
@@ -122,8 +122,6 @@
}
}
-+ (BOOL)canInitWithURL:(NSURL *)aURL withType:(NSString *)type { return NO; }
-
+ (void)_startRenderingForKey:(id)aKey;
{
_FVQueuedKeys *qkeys = [(NSDictionary *)_queuedKeysByClass
objectForKey:self];
Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVPreviewer.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVPreviewer.m 2021-01-17
22:45:44 UTC (rev 25426)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVPreviewer.m 2021-01-18
00:00:41 UTC (rev 25427)
@@ -45,7 +45,6 @@
#import <pthread.h>
#import "_FVPreviewerWindow.h"
#import "FVTextIcon.h" // for NSAttributedString initialization check
-#import "FVIcon_Private.h" // for NSAttributedString initialization check
NSString * const FVPreviewerWillCloseNotification =
@"FVPreviewerWillCloseNotification";
Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVWebViewIcon.h
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVWebViewIcon.h 2021-01-17
22:45:44 UTC (rev 25426)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVWebViewIcon.h 2021-01-18
00:00:41 UTC (rev 25427)
@@ -60,6 +60,8 @@
NSConditionLock *_condLock;
}
++ (BOOL)canInitWithURL:(NSURL *)aURL withType:(NSString *)type;
+
- (id)initWithURL:(NSURL *)aURL;
@end
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit