mirror of
https://github.com/nickshanks/ResKnife.git
synced 2024-06-28 00:29:33 +00:00
Various bug fixes and a hack to open NovaTools until custom editors are properly supported.
This commit is contained in:
parent
4b5624b606
commit
f4ac76473f
|
@ -3,6 +3,6 @@
|
|||
@interface NSOutlineView (SelectedItems)
|
||||
|
||||
- (id)selectedItem;
|
||||
- (id)selectedItems;
|
||||
- (NSArray *)selectedItems;
|
||||
|
||||
@end
|
|
@ -77,8 +77,8 @@
|
|||
[[filePropertyForm cellAtIndex:1] setStringValue:[currentDocument type]];
|
||||
// [[filePropertyForm cellAtIndex:2] setObjectValue:[NSNumber numberWithUnsignedLongLong:dataLogicalSize]];
|
||||
// [[filePropertyForm cellAtIndex:3] setObjectValue:[NSNumber numberWithUnsignedLongLong:rsrcLogicalSize]];
|
||||
[[filePropertyForm cellAtIndex:2] setStringValue:[NSNumber numberWithUnsignedLongLong:dataLogicalSize]];
|
||||
[[filePropertyForm cellAtIndex:3] setStringValue:[NSNumber numberWithUnsignedLongLong:rsrcLogicalSize]];
|
||||
[[filePropertyForm cellAtIndex:2] setStringValue:[NSString stringWithUnsignedLongLong:dataLogicalSize]];
|
||||
[[filePropertyForm cellAtIndex:3] setStringValue:[NSString stringWithUnsignedLongLong:rsrcLogicalSize]];
|
||||
[placeholderView setContentView:documentView];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -266,8 +266,18 @@ static NSString *RKShowInfoItemIdentifier = @"com.nickshanks.resknife.toolbar.sh
|
|||
|
||||
- (void)openResourceUsingEditor:(Resource *)resource
|
||||
{
|
||||
// Placeholder, change at some point.
|
||||
[self openResource:resource usingTemplate:[resource type]];
|
||||
#warning openResourceUsingEditor: shortcuts to NovaTools !!
|
||||
// opens resource in template using TMPL resource with name templateName
|
||||
NSBundle *editor = [NSBundle bundleWithPath:[[[NSBundle mainBundle] builtInPlugInsPath] stringByAppendingPathComponent:@"NovaTools.plugin"]];
|
||||
|
||||
// open the resources, passing in the template to use
|
||||
if( editor /* && [[editor principalClass] respondsToSelector:@selector(initWithResource:)] */ )
|
||||
{
|
||||
// bug: I alloc a plug instance here, but have no idea where I should dealloc it, perhaps the plug ought to call [self autorelease] when it's last window is closed?
|
||||
[(id <ResKnifePluginProtocol>)[[editor principalClass] alloc] initWithResource:resource];
|
||||
}
|
||||
// if no editor exists, or the editor is broken, open using template
|
||||
else [self openResource:resource usingTemplate:[resource type]];
|
||||
}
|
||||
|
||||
- (void)openResource:(Resource *)resource usingTemplate:(NSString *)templateName
|
||||
|
@ -279,7 +289,7 @@ static NSString *RKShowInfoItemIdentifier = @"com.nickshanks.resknife.toolbar.sh
|
|||
Resource *tmpl = [dataSource resourceNamed:[resource type] ofType:@"TMPL"];
|
||||
|
||||
// open the resources, passing in the template to use
|
||||
if( tmpl /*&& [[templateEditor principalClass] respondsToSelector:@selector(initWithResources:)]*/ )
|
||||
if( tmpl && [[templateEditor principalClass] respondsToSelector:@selector(initWithResources:)] )
|
||||
{
|
||||
// bug: I alloc a plug instance here, but have no idea where I should dealloc it, perhaps the plug ought to call [self autorelease] when it's last window is closed?
|
||||
[(id <ResKnifePluginProtocol>)[[templateEditor principalClass] alloc] initWithResources:resource, tmpl, nil];
|
||||
|
|
|
@ -137,7 +137,7 @@
|
|||
else byteSelection = [[self delegate] byteRangeFromAsciiRange:selection];
|
||||
|
||||
// adjust selection if is insertion point
|
||||
if( byteSelection.length == 0 )
|
||||
if( byteSelection.length == 0 && selection.location > 0 )
|
||||
{
|
||||
byteSelection.location -= 1;
|
||||
byteSelection.length = 1;
|
||||
|
@ -166,7 +166,7 @@
|
|||
else byteSelection = [[self delegate] byteRangeFromAsciiRange:selection];
|
||||
|
||||
// adjust selection if is insertion point
|
||||
if( byteSelection.length == 0 )
|
||||
if( byteSelection.length == 0 && selection.location < [[self string] length] -1 )
|
||||
byteSelection.length = 1;
|
||||
|
||||
// replace bytes (updates views implicitly)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
#import "ResKnifeResourceProtocol.h"
|
||||
|
||||
/* Your plug-in's principle class must implement initWithResource: else it won't be loaded by ResKnife (so neh-neh!), all other methods are optional */
|
||||
|
||||
|
@ -7,7 +8,7 @@
|
|||
/*! @function initWithResource:
|
||||
* @abstract Your plug-in is inited with this call. This allows immediate access to the resource you are about to edit, and with this information you can set up different windows, etc.
|
||||
*/
|
||||
- (id)initWithResource:(id)newResource;
|
||||
- (id)initWithResources:(id)newResource, ...;
|
||||
- (id)initWithResource:(id <ResKnifeResourceProtocol>)newResource;
|
||||
- (id)initWithResources:(id <ResKnifeResourceProtocol>)newResource, ...;
|
||||
|
||||
@end
|
|
@ -15,7 +15,7 @@
|
|||
#define Use_Nibs 0
|
||||
#define Use_GWorlds 1
|
||||
|
||||
// Easire constants
|
||||
// Easier constants
|
||||
#define RGBColour RGBColor
|
||||
|
||||
// Easier API call names
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user