diff --git a/English.lproj/MainMenu.xib b/English.lproj/MainMenu.xib index e1eeda2..16798a6 100644 --- a/English.lproj/MainMenu.xib +++ b/English.lproj/MainMenu.xib @@ -12,8 +12,8 @@ YES - + YES @@ -492,7 +492,7 @@ 15 2 - {{431, 306}, {551, 419}} + {{431, 188}, {551, 537}} 1954021376 Inside Job NSWindow @@ -516,7 +516,7 @@ 4352 - {551, 328} + {551, 160} YES @@ -893,7 +893,7 @@ 0 - {{1, 17}, {551, 328}} + {{1, 17}, {551, 160}} @@ -935,7 +935,7 @@ - {{-1, -1}, {553, 346}} + {{-1, -1}, {553, 178}} 562 @@ -949,7 +949,7 @@ 266 - {{211, 392}, {332, 14}} + {{211, 510}, {332, 14}} YES @@ -970,7 +970,7 @@ 268 - {{53, 353}, {85, 19}} + {{53, 471}, {85, 19}} YES @@ -1046,7 +1046,7 @@ 268 - {{8, 355}, {40, 14}} + {{8, 473}, {40, 14}} YES @@ -1061,8 +1061,8 @@ - 12 - {{0, 378}, {551, 5}} + 10 + {{0, 496}, {551, 5}} {0, 0} @@ -1084,7 +1084,7 @@ 268 - {{11, 387}, {195, 25}} + {{11, 505}, {195, 25}} YES @@ -1128,8 +1128,29 @@ 2 + + + 278 + {{77, 295}, {432, 144}} + + NSView + + + + 278 + {{77, 239}, {432, 48}} + + NSView + + + + 278 + {{11, 247}, {48, 192}} + + NSView + - {551, 419} + {551, 537} {{0, 0}, {1440, 878}} @@ -1444,6 +1465,30 @@ 607 + + + inventoryMatrixContainer + + + + 614 + + + + quickMatrixContainer + + + + 616 + + + + armorMatrixContainer + + + + 618 + @@ -1816,6 +1861,9 @@ + + + @@ -2064,6 +2112,24 @@ + + 612 + + + Matrix Placeholder + + + 615 + + + Matrix Placeholder + + + 617 + + + Matrix Placeholder + @@ -2208,6 +2274,12 @@ 600.IBViewBoundsToFrameTransform 601.IBPluginDependency 601.IBSegmentedControlInspectorSelectedSegmentMetadataKey + 612.IBPluginDependency + 612.IBViewBoundsToFrameTransform + 615.IBPluginDependency + 615.IBViewBoundsToFrameTransform + 617.IBPluginDependency + 617.IBViewBoundsToFrameTransform 74.IBPluginDependency 74.ImportedFromIB2 75.IBPluginDependency @@ -2307,9 +2379,9 @@ {{475, 832}, {234, 43}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{191, 193}, {551, 419}} + {{105, 24}, {551, 537}} com.apple.InterfaceBuilder.CocoaPlugin - {{191, 193}, {551, 419}} + {{105, 24}, {551, 537}} {{33, 99}, {480, 360}} {3.40282e+38, 3.40282e+38} @@ -2381,6 +2453,18 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + + AUGgAABDcAAAA + + com.apple.InterfaceBuilder.CocoaPlugin + + AUKaAABDcAAAA + + com.apple.InterfaceBuilder.CocoaPlugin + + AUGgAABDcAAAA + + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -2414,7 +2498,7 @@ - 607 + 618 @@ -2437,13 +2521,19 @@ YES YES + armorMatrixContainer + inventoryMatrixContainer outlineView + quickMatrixContainer statusTextField worldSelectionControl YES + NSView + NSView NSOutlineView + NSView NSTextField NSSegmentedControl @@ -2452,16 +2542,31 @@ YES YES + armorMatrixContainer + inventoryMatrixContainer outlineView + quickMatrixContainer statusTextField worldSelectionControl YES + + armorMatrixContainer + NSView + + + inventoryMatrixContainer + NSView + outlineView NSOutlineView + + quickMatrixContainer + NSView + statusTextField NSTextField diff --git a/IJInventoryWindowController.h b/IJInventoryWindowController.h index a8760ea..3a81966 100644 --- a/IJInventoryWindowController.h +++ b/IJInventoryWindowController.h @@ -8,6 +8,7 @@ #import +@class IJItemMatrix; @class IJMinecraftLevel; @interface IJInventoryWindowController : NSWindowController { @@ -18,6 +19,15 @@ NSSegmentedControl *worldSelectionControl; NSTextField *statusTextField; + NSView *inventoryMatrixContainer; + IJItemMatrix *inventoryMatrix; + + NSView *quickMatrixContainer; + IJItemMatrix *quickMatrix; + + NSView *armorMatrixContainer; + IJItemMatrix *armorMatrix; + NSArray *rootItems; NSMutableArray *armorItem; NSMutableArray *quickItem; @@ -30,6 +40,9 @@ @property (nonatomic, assign) IBOutlet NSOutlineView *outlineView; @property (nonatomic, assign) IBOutlet NSSegmentedControl *worldSelectionControl; @property (nonatomic, assign) IBOutlet NSTextField *statusTextField; +@property (nonatomic, assign) IBOutlet NSView *inventoryMatrixContainer; +@property (nonatomic, assign) IBOutlet NSView *quickMatrixContainer; +@property (nonatomic, assign) IBOutlet NSView *armorMatrixContainer; @property (nonatomic, retain) NSNumber *worldTime; diff --git a/IJInventoryWindowController.m b/IJInventoryWindowController.m index 19b6601..9372a69 100644 --- a/IJInventoryWindowController.m +++ b/IJInventoryWindowController.m @@ -9,6 +9,7 @@ #import "IJInventoryWindowController.h" #import "IJMinecraftLevel.h" #import "IJInventoryItem.h" +#import "IJItemMatrix.h" #import "IJItemPickerWindowController.h" @implementation IJInventoryWindowController @@ -16,6 +17,8 @@ @synthesize outlineView; @synthesize worldSelectionControl; @synthesize statusTextField; +@synthesize inventoryMatrixContainer, quickMatrixContainer, armorMatrixContainer; + - (void)awakeFromNib { @@ -24,6 +27,15 @@ inventoryItem = [NSMutableArray array]; rootItems = [[NSArray alloc] initWithObjects:armorItem, quickItem, inventoryItem, nil]; statusTextField.stringValue = @""; + + inventoryMatrix = [IJItemMatrix itemMatrixWithFrame:inventoryMatrixContainer.bounds rows:3 columns:9]; + [inventoryMatrixContainer addSubview:inventoryMatrix]; + + quickMatrix = [IJItemMatrix itemMatrixWithFrame:quickMatrixContainer.bounds rows:1 columns:9]; + [quickMatrixContainer addSubview:quickMatrix]; + + armorMatrix = [IJItemMatrix itemMatrixWithFrame:armorMatrixContainer.bounds rows:4 columns:1]; + [armorMatrixContainer addSubview:armorMatrix]; } - (void)dealloc { @@ -120,6 +132,25 @@ [outlineView reloadData]; [outlineView expandItem:nil expandChildren:YES]; + for (IJInventoryItem *item in inventoryItem) + { + int slot = item.slot - IJInventorySlotNormalFirst; + NSImageCell *cell = [inventoryMatrix cellAtRow:slot/9 column:slot%9]; + cell.image = item.image; + } + for (IJInventoryItem *item in quickItem) + { + int slot = item.slot - IJInventorySlotQuickFirst; + NSImageCell *cell = [quickMatrix cellAtRow:0 column:slot]; + cell.image = item.image; + } + for (IJInventoryItem *item in armorItem) + { + int slot = item.slot - IJInventorySlotArmorFirst; + NSImageCell *cell = [armorMatrix cellAtRow:3-slot column:0]; + cell.image = item.image; + } + dirty = NO; statusTextField.stringValue = @""; } diff --git a/IJItemMatrix.h b/IJItemMatrix.h new file mode 100644 index 0000000..5301c1b --- /dev/null +++ b/IJItemMatrix.h @@ -0,0 +1,18 @@ +// +// IJItemMatrix.h +// InsideJob +// +// Created by Adam Preble on 10/8/10. +// Copyright 2010 Adam Preble. All rights reserved. +// + +#import + + +@interface IJItemMatrix : NSMatrix { + +} + ++ (id)itemMatrixWithFrame:(NSRect)frame rows:(int)rows columns:(int)cols; + +@end diff --git a/IJItemMatrix.m b/IJItemMatrix.m new file mode 100644 index 0000000..204bda1 --- /dev/null +++ b/IJItemMatrix.m @@ -0,0 +1,47 @@ +// +// IJItemMatrix.m +// InsideJob +// +// Created by Adam Preble on 10/8/10. +// Copyright 2010 Adam Preble. All rights reserved. +// + +#import "IJItemMatrix.h" + + +@implementation IJItemMatrix + ++ (id)itemMatrixWithFrame:(NSRect)frame rows:(int)rows columns:(int)cols +{ + NSMatrix *matrix = nil; // output + NSImageCell *imageCellPrototype = [[[NSImageCell alloc] init] autorelease]; + [imageCellPrototype setImageFrameStyle:NSImageFrameGrayBezel]; + matrix = [[[self class] alloc] initWithFrame:frame + mode:NSHighlightModeMatrix + prototype:imageCellPrototype + numberOfRows:rows + numberOfColumns:cols]; + [matrix setCellSize:NSMakeSize(32+16, 32+16)]; + [matrix setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable]; + [matrix setDrawsBackground:NO]; + [matrix setDrawsCellBackground:NO]; + [matrix setIntercellSpacing:NSMakeSize(0, 0)]; + return [matrix autorelease]; +} + +- (id)initWithCoder:(NSCoder *)aDecoder +{ + if (self = [super initWithCoder:aDecoder]) + { + // Initialization code here. + } + return self; +} + +- (void)dealloc +{ + [super dealloc]; +} + + +@end diff --git a/InsideJob.xcodeproj/project.pbxproj b/InsideJob.xcodeproj/project.pbxproj index be118ca..983a0ef 100644 --- a/InsideJob.xcodeproj/project.pbxproj +++ b/InsideJob.xcodeproj/project.pbxproj @@ -21,6 +21,7 @@ 66BCFC2B125E9A51005A23F4 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 66BCFC2A125E9A51005A23F4 /* Credits.rtf */; }; 66BCFC36125EA53E005A23F4 /* InsideJob.icns in Resources */ = {isa = PBXBuildFile; fileRef = 66BCFC35125EA53E005A23F4 /* InsideJob.icns */; }; 66BCFE62125FCEC6005A23F4 /* DataValuesV110Transparent.png in Resources */ = {isa = PBXBuildFile; fileRef = 66BCFE61125FCEC6005A23F4 /* DataValuesV110Transparent.png */; }; + 66BCFEE812600847005A23F4 /* IJItemMatrix.m in Sources */ = {isa = PBXBuildFile; fileRef = 66BCFEE712600847005A23F4 /* IJItemMatrix.m */; }; 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; @@ -55,6 +56,8 @@ 66BCFC2A125E9A51005A23F4 /* Credits.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = Credits.rtf; sourceTree = ""; }; 66BCFC35125EA53E005A23F4 /* InsideJob.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = InsideJob.icns; sourceTree = ""; }; 66BCFE61125FCEC6005A23F4 /* DataValuesV110Transparent.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = DataValuesV110Transparent.png; sourceTree = ""; }; + 66BCFEE612600847005A23F4 /* IJItemMatrix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJItemMatrix.h; sourceTree = ""; }; + 66BCFEE712600847005A23F4 /* IJItemMatrix.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJItemMatrix.m; sourceTree = ""; }; 8D1107310486CEB800E47090 /* InsideJob-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "InsideJob-Info.plist"; sourceTree = ""; }; 8D1107320486CEB800E47090 /* Inside Job.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Inside Job.app"; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ @@ -185,6 +188,8 @@ 668B27F1125D963F0060BF71 /* IJInventoryWindowController.m */, 668B2977125E5DD40060BF71 /* IJItemPickerWindowController.h */, 668B2978125E5DD40060BF71 /* IJItemPickerWindowController.m */, + 66BCFEE612600847005A23F4 /* IJItemMatrix.h */, + 66BCFEE712600847005A23F4 /* IJItemMatrix.m */, ); name = Interface; sourceTree = ""; @@ -267,6 +272,7 @@ 668B27B2125D8F8E0060BF71 /* IJInventoryItem.m in Sources */, 668B27F2125D963F0060BF71 /* IJInventoryWindowController.m in Sources */, 668B2979125E5DD40060BF71 /* IJItemPickerWindowController.m in Sources */, + 66BCFEE812600847005A23F4 /* IJItemMatrix.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; };