From 5da9ecc7d013a0dedd761cccb7159663791964e7 Mon Sep 17 00:00:00 2001 From: Nick Loose Date: Thu, 18 Nov 2010 17:55:54 +0100 Subject: [PATCH] Added menu item to set time easily to the next sunrise --- Classes/IJInventoryWindowController.h | 2 + Classes/IJInventoryWindowController.m | 12 ++ English.lproj/MainMenu.xib | 231 ++++++++++++-------------- 3 files changed, 119 insertions(+), 126 deletions(-) diff --git a/Classes/IJInventoryWindowController.h b/Classes/IJInventoryWindowController.h index 3dcbea4..c4dad33 100644 --- a/Classes/IJInventoryWindowController.h +++ b/Classes/IJInventoryWindowController.h @@ -62,4 +62,6 @@ - (IBAction)updateItemSearchFilter:(id)sender; - (IBAction)makeSearchFieldFirstResponder:(id)sender; +- (IBAction)setNextDay:(id)sender; + @end diff --git a/Classes/IJInventoryWindowController.m b/Classes/IJInventoryWindowController.m index 61ed9dc..a0e07e6 100644 --- a/Classes/IJInventoryWindowController.m +++ b/Classes/IJInventoryWindowController.m @@ -308,10 +308,12 @@ return YES; } + - (NSNumber *)worldTime { return [level worldTimeContainer].numberValue; } + - (void)setWorldTime:(NSNumber *)number { [self willChangeValueForKey:@"worldTime"]; @@ -319,6 +321,16 @@ [self didChangeValueForKey:@"worldTime"]; [self markDirty]; } +- (IBAction)setNextDay:(id)sender +{ + int result; + int wTime = [[self worldTime] intValue]; + result =wTime +(24000 - (wTime % 24000)); + + NSNumber *newTime = [NSNumber numberWithInt:result]; + [self setWorldTime:newTime]; +} + #pragma mark - #pragma mark IJInventoryViewDelegate diff --git a/English.lproj/MainMenu.xib b/English.lproj/MainMenu.xib index 845cd0f..6bdc2e3 100644 --- a/English.lproj/MainMenu.xib +++ b/English.lproj/MainMenu.xib @@ -2,18 +2,18 @@ 1060 - 10F569 - 804 - 1038.29 + 10H574 + 823 + 1038.35 461.00 com.apple.InterfaceBuilder.CocoaPlugin - 804 + 823 YES - - + + YES @@ -381,32 +381,22 @@ - + - View + Tools - 1048576 2147483647 submenuAction: - - View + + Tools YES - - - Show Toolbar - t - 1572864 - 2147483647 - - - - - - Customize Toolbar… - + + + Next Sunrise + D 1048576 2147483647 @@ -1170,22 +1160,6 @@ 364 - - - runToolbarCustomizationPalette: - - - - 365 - - - - toggleToolbarShown: - - - - 366 - hide: @@ -1418,6 +1392,14 @@ 684 + + + setNextDay: + + + + 705 + @@ -1455,8 +1437,8 @@ - + @@ -1496,27 +1478,6 @@ - - 81 - - - YES - - - - - - - - 75 - - - - - 112 - - - 205 @@ -1690,35 +1651,6 @@ - - 295 - - - YES - - - - - - 296 - - - YES - - - - - - - 297 - - - - - 298 - - - 371 @@ -1979,6 +1911,17 @@ + + 81 + + + YES + + + + + + 672 @@ -1993,27 +1936,17 @@ YES - - - - + + + + - 674 - - - - - 676 - - - - - 677 - + 679 + @@ -2022,10 +1955,53 @@ - 679 - + 677 + + + 676 + + + + + 674 + + + + + 112 + + + + + 75 + + + + + 696 + + + YES + + + + + + 701 + + + YES + + + + + + 702 + + + @@ -2095,12 +2071,6 @@ 29.ImportedFromIB2 29.WindowOrigin 29.editorWindowContentRectSynchronizationRect - 295.IBPluginDependency - 296.IBEditorWindowLastContentRect - 296.IBPluginDependency - 296.editorWindowContentRectSynchronizationRect - 297.IBPluginDependency - 298.IBPluginDependency 371.IBEditorWindowLastContentRect 371.IBPluginDependency 371.IBWindowTemplateEditedContentRect @@ -2172,6 +2142,10 @@ 677.IBPluginDependency 678.IBPluginDependency 679.IBPluginDependency + 696.IBPluginDependency + 701.IBEditorWindowLastContentRect + 701.IBPluginDependency + 702.IBPluginDependency 75.IBPluginDependency 75.ImportedFromIB2 81.IBEditorWindowLastContentRect @@ -2221,7 +2195,7 @@ com.apple.InterfaceBuilder.CocoaPlugin - {{525, 653}, {160, 183}} + {{541, 653}, {160, 183}} com.apple.InterfaceBuilder.CocoaPlugin {{187, 434}, {243, 243}} @@ -2239,21 +2213,15 @@ com.apple.InterfaceBuilder.CocoaPlugin - {{619, 763}, {194, 73}} + {{641, 763}, {194, 73}} com.apple.InterfaceBuilder.CocoaPlugin {{525, 802}, {197, 73}} - {{380, 836}, {387, 20}} + {{380, 836}, {393, 20}} com.apple.InterfaceBuilder.CocoaPlugin {74, 862} {{6, 978}, {478, 20}} - com.apple.InterfaceBuilder.CocoaPlugin - {{569, 793}, {231, 43}} - com.apple.InterfaceBuilder.CocoaPlugin - {{475, 832}, {234, 43}} - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin {{602, 140}, {585, 396}} com.apple.InterfaceBuilder.CocoaPlugin {{602, 140}, {585, 396}} @@ -2262,7 +2230,7 @@ {3.40282e+38, 3.40282e+38} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{690, 813}, {169, 23}} + {{656, 813}, {169, 23}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -2349,6 +2317,10 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + {{585, 813}, {176, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin {{483, 773}, {178, 63}} com.apple.InterfaceBuilder.CocoaPlugin @@ -2376,7 +2348,7 @@ - 684 + 705 @@ -2409,6 +2381,7 @@ YES makeSearchFieldFirstResponder: menuSelectWorld: + setNextDay: updateItemSearchFilter: worldSelectionChanged: @@ -2418,6 +2391,7 @@ id id id + id @@ -2426,6 +2400,7 @@ YES makeSearchFieldFirstResponder: menuSelectWorld: + setNextDay: updateItemSearchFilter: worldSelectionChanged: @@ -2439,6 +2414,10 @@ menuSelectWorld: id + + setNextDay: + id + updateItemSearchFilter: id