From 3bbb6b7d9d7e433d1781e2ab97c20299b9b3194d Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Sat, 17 May 2025 09:53:44 -0500 Subject: [PATCH] Fix the longstanding xib bug keeping me from editor preferences on mac fix #496 --- src/game/boe.menus.mac.mm | 6 +++++- src/pcedit/pc.menus.mac.mm | 6 +++++- src/scenedit/scen.menus.mac.mm | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/game/boe.menus.mac.mm b/src/game/boe.menus.mac.mm index 2617916e..0b3ecbad 100644 --- a/src/game/boe.menus.mac.mm +++ b/src/game/boe.menus.mac.mm @@ -137,8 +137,12 @@ void init_menubar() { MenuHandler* handler = [[[MenuHandler alloc] init] retain]; setMenuCallback([apple_menu itemWithTitle: @"About Blades of Exile"], handler, @selector(menuChoice:), int(eMenu::ABOUT)); - setMenuCallback([apple_menu itemWithTitle: @"Preferences…"], handler, @selector(menuChoice:), int(eMenu::PREFS)); setMenuCallback([apple_menu itemWithTitle: @"Quit Blades of Exile"], handler, @selector(menuChoice:), int(eMenu::QUIT)); + + // An inscrutable bug is making the apple menu not localize this element for some of the apps on some computers. + // Attaching the event to a nonexistent item should be harmless. + setMenuCallback([apple_menu itemWithTitle: @"Preferences…"], handler, @selector(menuChoice:), int(eMenu::PREFS)); + setMenuCallback([apple_menu itemWithTitle: @"Settings…"], handler, @selector(menuChoice:), int(eMenu::PREFS)); int i = 0; for(eMenu opt : file_choices) diff --git a/src/pcedit/pc.menus.mac.mm b/src/pcedit/pc.menus.mac.mm index 55838005..158973e9 100644 --- a/src/pcedit/pc.menus.mac.mm +++ b/src/pcedit/pc.menus.mac.mm @@ -64,9 +64,13 @@ void init_menubar() { MenuHandler* handler = [[[MenuHandler alloc] init] retain]; setMenuCallback([apple_menu itemWithTitle: @"About BoE Character Editor"], handler, @selector(menuChoice:), int(eMenu::ABOUT)); - setMenuCallback([apple_menu itemWithTitle: @"Preferences…"], handler, @selector(menuChoice:), int(eMenu::PREFS)); setMenuCallback([apple_menu itemWithTitle: @"Quit BoE Character Editor"], handler, @selector(menuChoice:), int(eMenu::QUIT)); setMenuCallback([[[menu_bar_handle itemWithTitle: @"Help"] submenu] itemAtIndex: 0], handler, @selector(menuChoice:), int(eMenu::HELP_TOC)); + + // An inscrutable bug is making the apple menu not localize this element for some of the apps on some computers. + // Attaching the event to a nonexistent item should be harmless. + setMenuCallback([apple_menu itemWithTitle: @"Preferences…"], handler, @selector(menuChoice:), int(eMenu::PREFS)); + setMenuCallback([apple_menu itemWithTitle: @"Settings…"], handler, @selector(menuChoice:), int(eMenu::PREFS)); int i = 0; for(eMenu opt : file_choices) diff --git a/src/scenedit/scen.menus.mac.mm b/src/scenedit/scen.menus.mac.mm index 32c93836..0c5fe706 100644 --- a/src/scenedit/scen.menus.mac.mm +++ b/src/scenedit/scen.menus.mac.mm @@ -80,9 +80,13 @@ void init_menubar() { MenuHandler* handler = [[[MenuHandler alloc] init] retain]; setMenuCallback([app_menu itemWithTitle: @"About BoE Scenario Editor"], handler, @selector(menuChoice:), int(eMenu::ABOUT)); - setMenuCallback([app_menu itemWithTitle: @"Preferences…"], handler, @selector(menuChoice:), int(eMenu::PREFS)); setMenuCallback([app_menu itemWithTitle: @"Quit BoE Scenario Editor"], handler, @selector(menuChoice:), int(eMenu::QUIT)); + // An inscrutable bug is making the apple menu not localize this element for some of the apps on some computers. + // Attaching the event to a nonexistent item should be harmless. + setMenuCallback([app_menu itemWithTitle: @"Preferences…"], handler, @selector(menuChoice:), int(eMenu::PREFS)); + setMenuCallback([app_menu itemWithTitle: @"Settings…"], handler, @selector(menuChoice:), int(eMenu::PREFS)); + int i = 0; for(eMenu opt : file_choices) setMenuCallback([file_menu itemAtIndex: i++], handler, @selector(menuChoice:), int(opt));