mirror of
https://github.com/nickshanks/ResKnife.git
synced 2024-06-08 02:29:27 +00:00
Fixed outline view icons, other bugs.
This commit is contained in:
parent
a935b7c0d4
commit
f62010339d
|
@ -14,11 +14,14 @@ enum Attributes
|
|||
|
||||
@interface InfoWindowController : NSWindowController
|
||||
{
|
||||
IBOutlet NSMatrix *attributesMatrix;
|
||||
IBOutlet NSImageView *iconView;
|
||||
IBOutlet NSTextField *nameView;
|
||||
IBOutlet NSTextField *resIDView;
|
||||
IBOutlet NSTextField *typeView;
|
||||
IBOutlet NSImageView *iconView;
|
||||
IBOutlet NSTextField *nameView;
|
||||
|
||||
IBOutlet NSBox *placeholderView;
|
||||
IBOutlet NSBox *resourceView;
|
||||
IBOutlet NSBox *documentView;
|
||||
|
||||
IBOutlet NSMatrix *attributesMatrix;
|
||||
|
||||
@private
|
||||
ResourceDocument *currentDocument;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
- (id)init
|
||||
{
|
||||
self = [self initWithWindowNibName:@"InfoWindow"];
|
||||
if( self ) [self setWindowFrameAutosaveName:@"Resource Info"];
|
||||
if( self ) [self setWindowFrameAutosaveName:@"InfoWindow"];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,12 @@
|
|||
{
|
||||
[super windowDidLoad];
|
||||
|
||||
// retain views for swapping in and out
|
||||
[documentView retain];
|
||||
[documentView removeFromSuperview];
|
||||
[resourceView retain];
|
||||
[resourceView removeFromSuperview];
|
||||
|
||||
[self setMainWindow:[NSApp mainWindow]];
|
||||
[self updateInfoWindow];
|
||||
|
||||
|
@ -33,9 +39,9 @@
|
|||
{
|
||||
if( selectedResource )
|
||||
{
|
||||
[[self window] setTitle:@"Resource Info"];
|
||||
[placeholderView setContentView:resourceView];
|
||||
[nameView setStringValue:[selectedResource name]];
|
||||
[typeView setStringValue:[selectedResource type]];
|
||||
[resIDView setStringValue:[[selectedResource resID] stringValue]];
|
||||
[[attributesMatrix cellAtRow:changedBox column:0] setState:[[selectedResource attributes] shortValue] & resChanged];
|
||||
[[attributesMatrix cellAtRow:preloadBox column:0] setState:[[selectedResource attributes] shortValue] & resPreload];
|
||||
[[attributesMatrix cellAtRow:protectedBox column:0] setState:[[selectedResource attributes] shortValue] & resProtected];
|
||||
|
@ -45,15 +51,9 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
[nameView setStringValue:@""];
|
||||
[typeView setStringValue:@""];
|
||||
[resIDView setStringValue:@""];
|
||||
[[attributesMatrix cellAtRow:changedBox column:0] setState:NSOffState];
|
||||
[[attributesMatrix cellAtRow:preloadBox column:0] setState:NSOffState];
|
||||
[[attributesMatrix cellAtRow:protectedBox column:0] setState:NSOffState];
|
||||
[[attributesMatrix cellAtRow:lockedBox column:0] setState:NSOffState];
|
||||
[[attributesMatrix cellAtRow:purgableBox column:0] setState:NSOffState];
|
||||
[[attributesMatrix cellAtRow:systemHeapBox column:0] setState:NSOffState];
|
||||
[[self window] setTitle:@"Document Info"];
|
||||
[placeholderView setContentView:documentView];
|
||||
[nameView setStringValue:[currentDocument fileName]? [currentDocument fileName]:[currentDocument displayName]];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ static NSString *RKShowInfoItemIdentifier = @"com.nickshanks.resknife.toolbar.sh
|
|||
[item setPaletteLabel:@"Delete"];
|
||||
[item setToolTip:@"Delete Selected Resource"];
|
||||
[item setImage:[NSImage imageNamed:@"Delete"]];
|
||||
[item setTarget:self];
|
||||
[item setTarget:outlineView];
|
||||
[item setAction:@selector(clear:)];
|
||||
return item;
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ static NSString *RKShowInfoItemIdentifier = @"com.nickshanks.resknife.toolbar.sh
|
|||
NSString *identifier = [item itemIdentifier];
|
||||
|
||||
if( [identifier isEqual:RKCreateItemIdentifier] ) valid = YES;
|
||||
else if( [identifier isEqual:RKDeleteItemIdentifier] ) valid = [outlineView numberOfSelectedRows]? YES:NO;
|
||||
// else if( [identifier isEqual:RKDeleteItemIdentifier] ) valid = [outlineView numberOfSelectedRows]? YES:NO;
|
||||
else if( [identifier isEqual:RKEditItemIdentifier] ) valid = NO;
|
||||
else if( [identifier isEqual:RKEditHexItemIdentifier] ) valid = [outlineView numberOfSelectedRows]? YES:NO;
|
||||
else if( [identifier isEqual:RKSaveItemIdentifier] ) valid = [self isDocumentEdited];
|
||||
|
|
|
@ -17,8 +17,11 @@
|
|||
|
||||
- (void)setImage:(NSImage *)newImage
|
||||
{
|
||||
[image release];
|
||||
// save image and set to 16x16 pixels
|
||||
[image release]; // would this be better autoreleased instead?
|
||||
image = [newImage retain];
|
||||
[image setScalesWhenResized:YES];
|
||||
[image setSize:NSMakeSize(16,16)];
|
||||
}
|
||||
|
||||
- (NSImage *)image
|
||||
|
@ -30,8 +33,9 @@
|
|||
{
|
||||
if( image != nil )
|
||||
{
|
||||
// center image vertically in frame, offset right by three
|
||||
NSRect imageFrame;
|
||||
imageFrame.size = NSMakeSize( 16.0, 16.0 ); // [image size];
|
||||
imageFrame.size = [image size];
|
||||
imageFrame.origin = cellFrame.origin;
|
||||
imageFrame.origin.x += 3;
|
||||
imageFrame.origin.y += ceil((cellFrame.size.height - imageFrame.size.height) / 2);
|
||||
|
@ -42,6 +46,7 @@
|
|||
|
||||
- (void)editWithFrame:(NSRect)cellFrame inView:(NSView *)controlView editor:(NSText *)textObject delegate:(id)delegateObject event:(NSEvent *)theEvent
|
||||
{
|
||||
// split cell frame into two, pass the text part to the superclass
|
||||
NSRect textFrame, imageFrame;
|
||||
NSDivideRect( cellFrame, &imageFrame, &textFrame, 3 + [image size].width, NSMinXEdge );
|
||||
[super editWithFrame:textFrame inView:controlView editor:textObject delegate:delegateObject event:theEvent];
|
||||
|
@ -49,6 +54,7 @@
|
|||
|
||||
- (void)selectWithFrame:(NSRect)cellFrame inView:(NSView *)controlView editor:(NSText *)textObject delegate:(id)delegateObject start:(int)selStart length:(int)selLength
|
||||
{
|
||||
// split cell frame into two, pass the text part to the superclass
|
||||
NSRect textFrame, imageFrame;
|
||||
NSDivideRect( cellFrame, &imageFrame, &textFrame, 3 + [image size].width, NSMinXEdge);
|
||||
[super selectWithFrame:textFrame inView:controlView editor:textObject delegate:delegateObject start:selStart length:selLength];
|
||||
|
@ -60,7 +66,8 @@
|
|||
{
|
||||
NSRect imageFrame;
|
||||
NSSize imageSize = [image size];
|
||||
|
||||
|
||||
// get image frame
|
||||
NSDivideRect( cellFrame, &imageFrame, &cellFrame, 3 + imageSize.width, NSMinXEdge );
|
||||
if( [self drawsBackground] )
|
||||
{
|
||||
|
@ -69,15 +76,17 @@
|
|||
}
|
||||
imageFrame.origin.x += 3;
|
||||
imageFrame.size = imageSize;
|
||||
|
||||
|
||||
// center vertically
|
||||
if( [controlView isFlipped] )
|
||||
imageFrame.origin.y += ceil((cellFrame.size.height + imageFrame.size.height) / 2);
|
||||
else imageFrame.origin.y += ceil((cellFrame.size.height - imageFrame.size.height) / 2);
|
||||
|
||||
// [image compositeToPoint:imageFrame.origin operation:NSCompositeSourceOver];
|
||||
[image drawInRect:imageFrame fromRect:NSMakeRect( 0, 0, imageSize.width, imageSize.height ) operation:NSCompositeSourceOver fraction:1.0];
|
||||
|
||||
// draw image
|
||||
[image compositeToPoint:imageFrame.origin operation:NSCompositeSourceOver];
|
||||
}
|
||||
|
||||
// get the superclass to draw the text stuff
|
||||
[super drawWithFrame:cellFrame inView:controlView];
|
||||
}
|
||||
|
||||
|
|
11
Cocoa/English.lproj/InfoWindow.nib/classes.nib
generated
11
Cocoa/English.lproj/InfoWindow.nib/classes.nib
generated
|
@ -7,11 +7,12 @@
|
|||
CLASS = InfoWindowController;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
attributesMatrix = id;
|
||||
iconView = id;
|
||||
nameView = id;
|
||||
resIDView = id;
|
||||
typeView = id;
|
||||
attributesMatrix = NSMatrix;
|
||||
documentView = NSBox;
|
||||
iconView = NSImageView;
|
||||
nameView = NSTextField;
|
||||
placeholderView = NSBox;
|
||||
resourceView = NSBox;
|
||||
};
|
||||
SUPERCLASS = NSWindowController;
|
||||
}
|
||||
|
|
16
Cocoa/English.lproj/InfoWindow.nib/info.nib
generated
16
Cocoa/English.lproj/InfoWindow.nib/info.nib
generated
|
@ -3,16 +3,10 @@
|
|||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>377 192 384 449 0 74 1280 928 </string>
|
||||
<key>IBUserGuides</key>
|
||||
<dict>
|
||||
<key>InfoWindow</key>
|
||||
<dict>
|
||||
<key>guideLocations</key>
|
||||
<array/>
|
||||
<key>guidesLocked</key>
|
||||
<string>NO</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<string>142 473 384 240 0 0 1024 746 </string>
|
||||
<key>IBFramework Version</key>
|
||||
<string>248.0</string>
|
||||
<key>IBSystem Version</key>
|
||||
<string>5P48</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
BIN
Cocoa/English.lproj/InfoWindow.nib/objects.nib
generated
BIN
Cocoa/English.lproj/InfoWindow.nib/objects.nib
generated
Binary file not shown.
BIN
Cocoa/English.lproj/ResourceDocument.nib/objects.nib
generated
BIN
Cocoa/English.lproj/ResourceDocument.nib/objects.nib
generated
Binary file not shown.
|
@ -444,7 +444,6 @@
|
|||
F5B5885A0156D40B01000001,
|
||||
F5B5885B0156D40B01000001,
|
||||
F5B5885C0156D40B01000001,
|
||||
F5B5885D0156D40B01000001,
|
||||
F5B5885E0156D40B01000001,
|
||||
F5B5885F0156D40B01000001,
|
||||
F5B588600156D40B01000001,
|
||||
|
@ -675,7 +674,6 @@
|
|||
F5B588360156D40B01000001,
|
||||
F5B588380156D40B01000001,
|
||||
F5B5883A0156D40B01000001,
|
||||
F5B5883C0156D40B01000001,
|
||||
F5B5883E0156D40B01000001,
|
||||
F5B588400156D40B01000001,
|
||||
F5B588420156D40B01000001,
|
||||
|
@ -740,21 +738,6 @@
|
|||
path = English.lproj/InfoWindow.nib;
|
||||
refType = 4;
|
||||
};
|
||||
F5B5883C0156D40B01000001 = {
|
||||
children = (
|
||||
F5B5883D0156D40B01000001,
|
||||
);
|
||||
isa = PBXVariantGroup;
|
||||
name = Inspector.nib;
|
||||
path = Cocoa;
|
||||
refType = 2;
|
||||
};
|
||||
F5B5883D0156D40B01000001 = {
|
||||
isa = PBXFileReference;
|
||||
name = English;
|
||||
path = English.lproj/Inspector.nib;
|
||||
refType = 4;
|
||||
};
|
||||
F5B5883E0156D40B01000001 = {
|
||||
children = (
|
||||
F5B5883F0156D40B01000001,
|
||||
|
@ -943,12 +926,6 @@
|
|||
settings = {
|
||||
};
|
||||
};
|
||||
F5B5885D0156D40B01000001 = {
|
||||
fileRef = F5B5883C0156D40B01000001;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
F5B5885E0156D40B01000001 = {
|
||||
fileRef = F5B5883E0156D40B01000001;
|
||||
isa = PBXBuildFile;
|
||||
|
|
Loading…
Reference in New Issue
Block a user