mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-01-31 17:31:53 +00:00
refactor pref menu
This commit is contained in:
parent
7f8ddaeacf
commit
0e06d9358b
@ -41,13 +41,6 @@ void disable_SDL2_macosx_menu_bar_keyboard_shortcuts() {
|
||||
for (NSMenuItem * menu_item in [NSApp mainMenu].itemArray) {
|
||||
if (menu_item.hasSubmenu) {
|
||||
for (NSMenuItem * sub_item in menu_item.submenu.itemArray) {
|
||||
#ifdef SHEEPSHAVER
|
||||
if ([sub_item.title isEqualToString:@"Preferences…"]) {
|
||||
extern id gSheepShaverMain;
|
||||
sub_item.target = gSheepShaverMain;
|
||||
sub_item.action = @selector(openPreferences:);
|
||||
}
|
||||
#endif
|
||||
sub_item.keyEquivalent = @"";
|
||||
sub_item.keyEquivalentModifierMask = 0;
|
||||
}
|
||||
|
@ -108,25 +108,21 @@
|
||||
* Initialization
|
||||
*/
|
||||
|
||||
void prefs_init(void)
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
#if SDL_VERSION_ATLEAST(2,0,0)
|
||||
|
||||
id gSheepShaverMain;
|
||||
|
||||
void prefs_init(void)
|
||||
{
|
||||
gSheepShaverMain = [[SheepShaverMain alloc] init];
|
||||
}
|
||||
|
||||
for (NSMenuItem *sub_item in [NSApp mainMenu].itemArray[0].submenu.itemArray) {
|
||||
if ([sub_item.title isEqualToString:@"Preferences…"]) {
|
||||
sub_item.target = [[SheepShaverMain alloc] init];
|
||||
sub_item.action = @selector(openPreferences:);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
||||
void prefs_init(void)
|
||||
{
|
||||
NSAutoreleasePool *pool;
|
||||
NSMenu *appMenu;
|
||||
NSMenuItem *menuItem;
|
||||
|
||||
pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
appMenu = [[[NSApp mainMenu] itemAtIndex:0] submenu];
|
||||
menuItem = [[NSMenuItem alloc] initWithTitle:@"Preferences..." action:@selector(openPreferences:) keyEquivalent:@","];
|
||||
[appMenu insertItem:menuItem atIndex:2];
|
||||
@ -134,12 +130,10 @@ void prefs_init(void)
|
||||
[menuItem release];
|
||||
|
||||
[NSApp setDelegate:[[SheepShaverMain alloc] init]];
|
||||
|
||||
#endif
|
||||
[pool release];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Deinitialization
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user