Permalink
Browse files

removal of the ObjC++ files and merging their differences into the .m…

… versions

git-svn-id: https://resknife.svn.sourceforge.net/svnroot/resknife/trunk/ResKnife@136 25122d23-1bc7-42f3-9251-2040de679093
  • Loading branch information...
1 parent e1f6dcd commit 8538a4f5c4c600ca09c3eef1748575739052d83b nickshanks committed Aug 31, 2010
@@ -208,11 +208,21 @@ - (id)selectedItem
}
- (NSArray *)selectedItems;
{
- NSNumber *row;
NSMutableArray *items = [NSMutableArray array];
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_3
+ NSIndexSet *indicies = [self selectedRowIndexes];
+ unsigned int rowIndex = [indicies firstIndex];
+ while (rowIndex != NSNotFound)
+ {
+ [items addObject:[self itemAtRow:rowIndex]];
+ rowIndex = [indicies indexGreaterThanIndex:rowIndex];
+ }
+#else
+ NSNumber *row;
NSEnumerator *enumerator = [self selectedRowEnumerator];
while(row = [enumerator nextObject])
[items addObject:[self itemAtRow:[row intValue]]];
+#endif
return items;
}
@end
@@ -31,7 +31,7 @@ - (void)applicationWillFinishLaunching:(NSNotification *)notification
/*!
@method awakeFromNib
-@change 2003-10-24 NGS: moved icon caching into method called by timer (to speed up app launch time)
+@updated 2003-10-24 NGS: moved icon caching into method called by timer (to speed up app launch time)
*/
- (void)awakeFromNib
@@ -8,8 +8,8 @@ @implementation CreateResourceSheetController
/*!
@method controlTextDidChange:
@abstract Handles updating of the 'Create' button when valid values are present in the sheet's fields.
-@change 2003-08-01 UK: Changed to use data source's resourceOfType instead of directly messing with the resource list's enumerator.
-@change 2003-08-01 UK: Removed ID > 0 check -- negative IDs are allowed as well.<br/><small>Note from Nick: IIRC this was there as a workaround for another bug which prohibited negative IDs from being used. Not sure if that got fixed though :)</small>
+@updated 2003-08-01 UK: Changed to use data source's resourceOfType instead of directly messing with the resource list's enumerator.
+@updated 2003-08-01 UK: Removed ID > 0 check -- negative IDs are allowed as well.<br/><small>Note from Nick: IIRC this was there as a workaround for another bug which prohibited negative IDs from being used. Not sure if that got fixed though :)</small>
@description Someone changed the control ID edit field. Check whether this is a unique ID and appropriately enable the "create" button.</p><p>Check "notification" against being nil, which is how we call it when we need to explicitly update the enabled state of the "create" button.
*/
@@ -32,8 +32,8 @@ - (void)controlTextDidChange:(NSNotification *)notification
/*!
@method showCreateResourceSheet:
@abstract Shows the sheet allowing the user to define the properties of a new resource.
-@change 2003-08-01 UK: Made it "fake" a popup selection so type field and popup match.
-@change 2003-08-01 UK: Made it suggest an unused resource ID.
+@updated 2003-08-01 UK: Made it "fake" a popup selection so type field and popup match.
+@updated 2003-08-01 UK: Made it suggest an unused resource ID.
*/
- (void)showCreateResourceSheet:(ResourceDocument *)sheetDoc
@@ -48,8 +48,6 @@ - (void)updateInfoWindow
if(selectedResource)
{
- NSLog(@"selected resource data: %@", [selectedResource data]);
-
// set UI values
[[self window] setTitle:NSLocalizedString(@"Resource Info",nil)];
[nameView setStringValue:[selectedResource name]];
@@ -56,7 +56,7 @@ - (void)tableView:(NSTableView*)tableView didClickTableColumn:(NSTableColumn *)t
/*!
@function compareResourcesAscending
-@change 2003-10-25 NGS: now uses KVC methods to obtain the strings to compare
+@updated 2003-10-25 NGS: now uses KVC methods to obtain the strings to compare
*/
int compareResourcesAscending(Resource *r1, Resource *r2, void *context)
@@ -71,7 +71,7 @@ int compareResourcesAscending(Resource *r1, Resource *r2, void *context)
/*!
@function compareResourcesDescending
-@change 2003-10-25 NGS: now uses KVC methods to obtain the strings to compare
+@updated 2003-10-25 NGS: now uses KVC methods to obtain the strings to compare
*/
int compareResourcesDescending(Resource *r1, Resource *r2, void *context)
@@ -93,13 +93,13 @@ - (BOOL)outlineView:(NSOutlineView *)outlineView shouldEditTableColumn:(NSTableC
/*!
@method outlineView:willDisplayCell:forTableColumn:item:
-@change 2003-10-25 NGS: Moved functionality of NameFormatter into this method, removed NameFormatter class.
-@change 2003-10-24 NGS: Swapped row colours so first row is white (as per 10.3), conditionalised drawing line background colours to system versions < 10.3, since in 10.3 it is handled by the nib file.
-@change 2003-10-24 NGS: Added iconForResourceType method to app delegate instead of interrogating the cache here.
+@updated 2003-10-25 NGS: Moved functionality of NameFormatter into this method, removed NameFormatter class.
+@updated 2003-10-24 NGS: Swapped row colours so first row is white (as per 10.3), conditionalised drawing line background colours to system versions < 10.3, since in 10.3 it is handled by the nib file.
+@updated 2003-10-24 NGS: Added iconForResourceType method to app delegate instead of interrogating the cache here.
@pending remove setting of the cell formatter when that capability is in interface builder
*/
-- (void)outlineView:(NSOutlineView *)olView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item
+- (void)outlineView:(NSOutlineView *)outlineView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item
{
Resource *resource = (Resource *)item;
NSString *identifier = [tableColumn identifier];
@@ -161,7 +161,7 @@ - (void)outlineView:(NSOutlineView *)olView willDisplayCell:(id)cell forTableCol
// draw alternating blue/white backgrounds (if pre-10.3)
if(NSAppKitVersionNumber < 700.0)
{
- int row = [olView rowForItem:item];
+ int row = [outlineView rowForItem:item];
if(row % 2) [cell setBackgroundColor:[NSColor colorWithCalibratedRed:0.93 green:0.95 blue:1.0 alpha:1.0]];
else [cell setBackgroundColor:[NSColor whiteColor]];
[cell setDrawsBackground:YES];
@@ -44,7 +44,7 @@ @implementation RKEditorRegistry
@method +defaultRegistry
@author Uli Kusterer
@created 2003-07-31
-@change 2003-10-28 NS: Changed method name from +mainRegistry (so it more closly matchs +defaultCenter) and moved global var inside method, making it a static.
+@updated 2003-10-28 NGS: Changed method name from +mainRegistry (so it more closly matchs +defaultCenter) and moved global var inside method, making it a static.
@description Returns the default plugin registry of this application, instantiating it first if there is none yet. As soon as this is instantiated, the plugins are loaded.
*/
+ (RKEditorRegistry *)defaultRegistry
@@ -74,7 +74,7 @@ - (void)awakeFromNib
@abstract (Re)loads our list of plugins. You can use this as an action for a menu item, if you want.
@author Uli Kusterer
@created 2003-07-31
-@change 2003-10-28 NGS: Updated to look for more sophisticated RKSupportedTypes key in addition to (the now deprecated) RKEditedTypes.
+@updated 2003-10-28 NGS: Updated to look for more sophisticated RKSupportedTypes key in addition to (the now deprecated) RKEditedTypes.
@pending Use NSSearchPathForDirectoriesInDomains() or equivalent to get folder paths instead of hard coding them.
@pending Currently, Cocoa classes can't be unloaded, which means we're
not leaking the NSBundles we load here. However, if this one
@@ -1,14 +1,14 @@
#import "RKSupportResourceRegistry.h"
-#import "NGSCategories.h"
+#import "../Categories/NGSCategories.h"
@implementation RKSupportResourceRegistry
+ (void)scanForSupportResources
{
- // TODO: Instead of hard-coding sysPath we should use some FindFolder-like API!
#if MAC_OS_X_VERSION_10_4 <= MAC_OS_X_VERSION_MAX_ALLOWED
NSArray *dirsArray = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSAllDomainsMask, YES);
dirsArray = [dirsArray arrayByMakingObjectsPerformSelector:@selector(stringByAppendingPathComponent:) withObject:@"ResKnife/Support Resources"];
+ // FIXME: log content of dirsArray and merge with the following:
#endif
[RKSupportResourceRegistry scanForSupportResourcesInFolder:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Support Resources"]];
[RKSupportResourceRegistry scanForSupportResourcesInFolder:[NSHomeDirectory() stringByAppendingPathComponent:@"Library/Application Support/ResKnife/Support Resources"]];
@@ -25,7 +25,7 @@ + (void)scanForSupportResourcesInFolder:(NSString *)path
{
// NSLog(@"Examining %@", name);
if([[name pathExtension] isEqualToString:@"rsrc"])
- // FIXME: this method was deprecate in 10.4 in favour of - (id)openDocumentWithContentsOfURL:(NSURL *)absoluteURL display:(BOOL)displayDocument error:(NSError **)outError;
+ // FIXME: this method was deprecated in 10.4 in favour of - (id)openDocumentWithContentsOfURL:(NSURL *)absoluteURL display:(BOOL)displayDocument error:(NSError **)outError;
[[NSDocumentController sharedDocumentController] openDocumentWithContentsOfFile:[path stringByAppendingPathComponent:name] display:YES];
}
}
@@ -1,25 +0,0 @@
-#import "RKSupportResourceRegistry.h"
-
-@implementation RKSupportResourceRegistry
-
-+ (void)scanForSupportResources
-{
- // TODO: Instead of hard-coding sysPath we should use some FindFolder-like API!
- [RKSupportResourceRegistry scanForSupportResourcesInFolder:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Support Resources"]];
- [RKSupportResourceRegistry scanForSupportResourcesInFolder:[NSHomeDirectory() stringByAppendingPathComponent:@"Library/Application Support/ResKnife/Support Resources/"]];
- [RKSupportResourceRegistry scanForSupportResourcesInFolder:[@"/" stringByAppendingPathComponent:@"Library/Application Support/ResKnife/Support Resources/"]];
-}
-
-+ (void)scanForSupportResourcesInFolder:(NSString *)path
-{
-// NSLog(@"Looking for resources in %@", path);
- NSEnumerator *enumerator = [[[NSFileManager defaultManager] directoryContentsAtPath:path] objectEnumerator];
- while(NSString *name = [enumerator nextObject])
- {
-// NSLog(@"Examining %@", name);
- if([[name pathExtension] isEqualToString:@"rsrc"])
- [[NSDocumentController sharedDocumentController] openDocumentWithContentsOfFile:[path stringByAppendingPathComponent:name] display:YES];
- }
-}
-
-@end
View
@@ -8,7 +8,6 @@
@description The Resource class fully complies with key-value coding, with the keys @"name", @"type", @"resID", @"attributes", @"data", @"dirty" and @"representedFork" available.
*/
-@class ResourceDocument;
@interface Resource : NSObject <NSCopying, NSCoding, ResKnifeResourceProtocol>
{
@private
View
@@ -90,7 +90,7 @@ + (NSArray *)allResourcesOfType:(NSString *)typeValue inDocument:(NSDocument *)s
return [NSArray arrayWithArray:array];
}
-+ (id)resourceOfType:(NSString *)typeValue withName:(NSString *)nameValue inDocument:(NSDocument *)searchDoc
++ (Resource *)resourceOfType:(NSString *)typeValue withName:(NSString *)nameValue inDocument:(NSDocument *)searchDoc
{
NSDocument *doc;
NSEnumerator *enumerator = [[[NSDocumentController sharedDocumentController] documents] objectEnumerator];
@@ -106,7 +106,7 @@ + (id)resourceOfType:(NSString *)typeValue withName:(NSString *)nameValue inDocu
return nil;
}
-+ (id)resourceOfType:(NSString *)typeValue andID:(NSNumber *)resIDValue inDocument:(NSDocument *)searchDoc
++ (Resource *)resourceOfType:(NSString *)typeValue andID:(NSNumber *)resIDValue inDocument:(NSDocument *)searchDoc
{
NSDocument *doc;
NSEnumerator *enumerator = [[[NSDocumentController sharedDocumentController] documents] objectEnumerator];
Oops, something went wrong.

0 comments on commit 8538a4f

Please sign in to comment.