diff --git a/Cocoa/AppDelegate.h b/Cocoa/AppDelegate.h index d4ffe7c..608a50c 100644 --- a/Cocoa/AppDelegate.h +++ b/Cocoa/AppDelegate.h @@ -3,8 +3,13 @@ @interface AppDelegate : NSObject @property IBOutlet NSWindow *preferencesWindow; +@property (strong) IBOutlet NSView *graphicsTab; +@property (strong) IBOutlet NSView *emulationTab; +@property (strong) IBOutlet NSView *audioTab; +@property (strong) IBOutlet NSView *controlsTab; - (IBAction)showPreferences: (id) sender; - (IBAction)toggleDeveloperMode:(id)sender; +- (IBAction)switchPreferencesTab:(id)sender; @end diff --git a/Cocoa/AppDelegate.m b/Cocoa/AppDelegate.m index 44f5683..a9c5a9e 100644 --- a/Cocoa/AppDelegate.m +++ b/Cocoa/AppDelegate.m @@ -6,6 +6,7 @@ @implementation AppDelegate { NSWindow *preferences_window; + NSArray *preferences_tabs; } - (void) applicationDidFinishLaunching:(NSNotification *)notification @@ -44,10 +45,24 @@ [defaults setBool:![defaults boolForKey:@"DeveloperMode"] forKey:@"DeveloperMode"]; } +- (IBAction)switchPreferencesTab:(id)sender +{ + for (NSView *view in preferences_tabs) { + [view removeFromSuperview]; + } + NSView *tab = preferences_tabs[[sender tag]]; + NSRect old = [_preferencesWindow frame]; + NSRect new = [_preferencesWindow frameRectForContentRect:tab.frame]; + new.origin.x = old.origin.x; + new.origin.y = old.origin.y + (old.size.height - new.size.height); + [_preferencesWindow setFrame:new display:YES animate:_preferencesWindow.visible]; + [_preferencesWindow.contentView addSubview:tab]; +} + - (BOOL)validateMenuItem:(NSMenuItem *)anItem { if ([anItem action] == @selector(toggleDeveloperMode:)) { - [(NSMenuItem*)anItem setState:[[NSUserDefaults standardUserDefaults] boolForKey:@"DeveloperMode"]]; + [(NSMenuItem *)anItem setState:[[NSUserDefaults standardUserDefaults] boolForKey:@"DeveloperMode"]]; } return true; @@ -58,6 +73,11 @@ NSArray *objects; if (!_preferencesWindow) { [[NSBundle mainBundle] loadNibNamed:@"Preferences" owner:self topLevelObjects:&objects]; + NSToolbarItem *first_toolbar_item = [_preferencesWindow.toolbar.items firstObject]; + _preferencesWindow.toolbar.selectedItemIdentifier = [first_toolbar_item itemIdentifier]; + preferences_tabs = @[self.emulationTab, self.graphicsTab, self.audioTab, self.controlsTab]; + [self switchPreferencesTab:first_toolbar_item]; + [_preferencesWindow center]; } [_preferencesWindow makeKeyAndOrderFront:self]; } diff --git a/Cocoa/CPU.png b/Cocoa/CPU.png new file mode 100644 index 0000000..7f13621 Binary files /dev/null and b/Cocoa/CPU.png differ diff --git a/Cocoa/CPU@2x.png b/Cocoa/CPU@2x.png new file mode 100644 index 0000000..3c86883 Binary files /dev/null and b/Cocoa/CPU@2x.png differ diff --git a/Cocoa/Display.png b/Cocoa/Display.png new file mode 100644 index 0000000..5753f55 Binary files /dev/null and b/Cocoa/Display.png differ diff --git a/Cocoa/Display@2x.png b/Cocoa/Display@2x.png new file mode 100644 index 0000000..6a71d22 Binary files /dev/null and b/Cocoa/Display@2x.png differ diff --git a/Cocoa/Joypad.png b/Cocoa/Joypad.png new file mode 100644 index 0000000..f30d8f9 Binary files /dev/null and b/Cocoa/Joypad.png differ diff --git a/Cocoa/Joypad@2x.png b/Cocoa/Joypad@2x.png new file mode 100644 index 0000000..d91ee30 Binary files /dev/null and b/Cocoa/Joypad@2x.png differ diff --git a/Cocoa/Preferences.xib b/Cocoa/Preferences.xib index f712a24..ff0df58 100644 --- a/Cocoa/Preferences.xib +++ b/Cocoa/Preferences.xib @@ -8,297 +8,59 @@ + + + + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + @@ -308,7 +70,311 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Cocoa/Speaker.png b/Cocoa/Speaker.png new file mode 100644 index 0000000..1f6b556 Binary files /dev/null and b/Cocoa/Speaker.png differ diff --git a/Cocoa/Speaker@2x.png b/Cocoa/Speaker@2x.png new file mode 100644 index 0000000..41c46ff Binary files /dev/null and b/Cocoa/Speaker@2x.png differ diff --git a/Makefile b/Makefile index 9eeefac..adffbdf 100755 --- a/Makefile +++ b/Makefile @@ -173,7 +173,7 @@ $(OBJ)/%.m.o: %.m # Cocoa Port $(BIN)/SameBoy.app: $(BIN)/SameBoy.app/Contents/MacOS/SameBoy \ - $(shell ls Cocoa/*.icns) \ + $(shell ls Cocoa/*.icns Cocoa/*.png) \ Cocoa/License.html \ Cocoa/Info.plist \ Misc/registers.sym \ @@ -185,7 +185,7 @@ $(BIN)/SameBoy.app: $(BIN)/SameBoy.app/Contents/MacOS/SameBoy \ $(BIN)/SameBoy.qlgenerator \ Shaders $(MKDIR) -p $(BIN)/SameBoy.app/Contents/Resources - cp Cocoa/*.icns Misc/registers.sym $(BIN)/SameBoy.app/Contents/Resources/ + cp Cocoa/*.icns Cocoa/*.png Misc/registers.sym $(BIN)/SameBoy.app/Contents/Resources/ sed s/@VERSION/$(VERSION)/ < Cocoa/Info.plist > $(BIN)/SameBoy.app/Contents/Info.plist cp Cocoa/License.html $(BIN)/SameBoy.app/Contents/Resources/Credits.html $(MKDIR) -p $(BIN)/SameBoy.app/Contents/Resources/Shaders