diff --git a/English.lproj/MainMenu.xib b/English.lproj/MainMenu.xib
index 8f3656b..263a136 100644
--- a/English.lproj/MainMenu.xib
+++ b/English.lproj/MainMenu.xib
@@ -12,8 +12,8 @@
@@ -2063,6 +2106,8 @@
589.IBNumberFormatterBehaviorMetadataKey
589.IBNumberFormatterLocalizesFormatMetadataKey
589.IBPluginDependency
+ 591.IBPluginDependency
+ 592.IBPluginDependency
74.IBPluginDependency
74.ImportedFromIB2
75.IBPluginDependency
@@ -2122,7 +2167,7 @@
com.apple.InterfaceBuilder.CocoaPlugin
- {{525, 653}, {151, 183}}
+ {{525, 653}, {158, 183}}
com.apple.InterfaceBuilder.CocoaPlugin
{{187, 434}, {243, 243}}
@@ -2215,6 +2260,8 @@
com.apple.InterfaceBuilder.CocoaPlugin
com.apple.InterfaceBuilder.CocoaPlugin
+ com.apple.InterfaceBuilder.CocoaPlugin
+ com.apple.InterfaceBuilder.CocoaPlugin
com.apple.InterfaceBuilder.CocoaPlugin
@@ -2248,7 +2295,7 @@
- 590
+ 593
@@ -2272,11 +2319,13 @@
YES
outlineView
+ statusTextField
worldPopup
YES
NSOutlineView
+ NSTextField
NSPopUpButton
@@ -2285,6 +2334,7 @@
YES
outlineView
+ statusTextField
worldPopup
@@ -2293,6 +2343,10 @@
outlineView
NSOutlineView
+
+ statusTextField
+ NSTextField
+
worldPopup
NSPopUpButton
@@ -2878,6 +2932,14 @@
AppKit.framework/Headers/NSText.h
+
+ NSTextField
+ NSControl
+
+ IBFrameworkSource
+ AppKit.framework/Headers/NSTextField.h
+
+
NSTextFieldCell
NSActionCell
diff --git a/IJInventoryWindowController.h b/IJInventoryWindowController.h
index 5e401de..7c169fc 100644
--- a/IJInventoryWindowController.h
+++ b/IJInventoryWindowController.h
@@ -16,6 +16,7 @@
NSOutlineView *outlineView;
NSPopUpButton *worldPopup;
+ NSTextField *statusTextField;
NSArray *rootItems;
NSMutableArray *armorItem;
@@ -28,6 +29,7 @@
@property (nonatomic, assign) IBOutlet NSOutlineView *outlineView;
@property (nonatomic, assign) IBOutlet NSPopUpButton *worldPopup;
+@property (nonatomic, assign) IBOutlet NSTextField *statusTextField;
- (IBAction)worldSelectionChanged:(id)sender;
diff --git a/IJInventoryWindowController.m b/IJInventoryWindowController.m
index f5d574d..7bd3eda 100644
--- a/IJInventoryWindowController.m
+++ b/IJInventoryWindowController.m
@@ -15,7 +15,7 @@
@synthesize outlineView;
@synthesize worldPopup;
-
+@synthesize statusTextField;
- (void)awakeFromNib
{
@@ -23,6 +23,7 @@
quickItem = [NSMutableArray array];
inventoryItem = [NSMutableArray array];
rootItems = [[NSArray alloc] initWithObjects:armorItem, quickItem, inventoryItem, nil];
+ statusTextField.stringValue = @"";
}
- (void)dealloc
{
@@ -97,6 +98,9 @@
[outlineView reloadData];
[outlineView expandItem:nil expandChildren:YES];
+
+ dirty = NO;
+ statusTextField.stringValue = @"";
}
- (void)saveToWorldAtIndex:(int)worldIndex
@@ -137,6 +141,15 @@
}
[[level writeData] writeToURL:[NSURL fileURLWithPath:levelPath] atomically:NO];
+
+ dirty = NO;
+ statusTextField.stringValue = @"Saved.";
+}
+
+- (void)markDirty
+{
+ dirty = YES;
+ statusTextField.stringValue = @"World has unsaved changes.";
}
#pragma mark -
@@ -154,6 +167,24 @@
[self saveToWorldAtIndex:worldIndex];
}
+- (void)delete:(id)sender
+{
+ IJInventoryItem *item = [outlineView itemAtRow:[outlineView selectedRow]];
+ item.count = 0;
+ item.itemId = 0;
+ item.damage = 0;
+ [self markDirty];
+ [outlineView reloadItem:item];
+}
+
+- (BOOL)validateUserInterfaceItem:(id )anItem
+{
+ if (anItem.action == @selector(delete:))
+ {
+ return [outlineView selectedRow] != -1 && ![rootItems containsObject:[outlineView itemAtRow:[outlineView selectedRow]]];
+ }
+ return YES;
+}
#pragma mark -
#pragma mark Inventory Outline View
@@ -256,16 +287,19 @@
if ([tableColumn.identifier isEqual:@"id"])
{
invItem.itemId = [object shortValue];
+ [self markDirty];
}
else if ([tableColumn.identifier isEqual:@"count"])
{
invItem.count = [object unsignedCharValue];
if (invItem.count > 64)
invItem.count = 64;
+ [self markDirty];
}
else if ([tableColumn.identifier isEqual:@"damage"])
{
invItem.damage = [object shortValue];
+ [self markDirty];
}
}
@@ -279,6 +313,7 @@
[[IJItemPickerWindowController sharedController] showPickerWithInitialItemId:invItem.itemId completionBlock:^(uint16_t itemId) {
invItem.itemId = itemId;
[outlineView reloadItem:item];
+ [self markDirty];
}];
return NO;
}
diff --git a/ItemPicker.xib b/ItemPicker.xib
index ee504dc..da878cb 100644
--- a/ItemPicker.xib
+++ b/ItemPicker.xib
@@ -12,7 +12,7 @@
YES
-
+
YES
@@ -175,7 +175,7 @@
3
MC4zMzMzMzI5ODU2AA
-
+
6
System
headerTextColor
@@ -203,7 +203,7 @@
YES
-
+
name
191
10
@@ -219,9 +219,9 @@
headerColor
-
+
-
+
337772096
2048
Text Cell
@@ -232,7 +232,6 @@
3
YES
- YES
@@ -467,7 +466,7 @@
YES
-
+
@@ -487,17 +486,17 @@
26
-
+
YES
-
+
27
-
-
+
+