Codechange: [OSX] Simplify touchbar button data definition.

This commit is contained in:
Michael Lutz
2021-12-31 01:18:12 +01:00
parent b351cbe490
commit 69c8ed9965
2 changed files with 50 additions and 61 deletions

View File

@@ -11,8 +11,6 @@
#define COCOA_WND_H
#import <Cocoa/Cocoa.h>
#include "toolbar_gui.h"
#include "table/sprites.h"
#ifdef MAC_OS_X_VERSION_10_12_2
# define HAVE_TOUCHBAR_SUPPORT
@@ -34,58 +32,6 @@ extern NSString *OTTDMainLaunchGameEngine;
+ (NSCursor *) clearCocoaCursor;
@end
#ifdef HAVE_TOUCHBAR_SUPPORT
/* 9 items can be displayed on the touch bar when using default buttons. */
static NSArray *touchBarButtonIdentifiers = @[
@"openttd.pause",
@"openttd.fastforward",
@"openttd.zoom_in",
@"openttd.zoom_out",
@"openttd.build_rail",
@"openttd.build_road",
@"openttd.build_tram",
@"openttd.build_docks",
@"openttd.build_airport",
NSTouchBarItemIdentifierOtherItemsProxy
];
static NSDictionary *touchBarButtonSprites = @{
@"openttd.pause": [NSNumber numberWithInt:SPR_IMG_PAUSE],
@"openttd.fastforward": [NSNumber numberWithInt:SPR_IMG_FASTFORWARD],
@"openttd.zoom_in": [NSNumber numberWithInt:SPR_IMG_ZOOMIN],
@"openttd.zoom_out": [NSNumber numberWithInt:SPR_IMG_ZOOMOUT],
@"openttd.build_rail": [NSNumber numberWithInt:SPR_IMG_BUILDRAIL],
@"openttd.build_road": [NSNumber numberWithInt:SPR_IMG_BUILDROAD],
@"openttd.build_tram": [NSNumber numberWithInt:SPR_IMG_BUILDTRAMS],
@"openttd.build_docks": [NSNumber numberWithInt:SPR_IMG_BUILDWATER],
@"openttd.build_airport": [NSNumber numberWithInt:SPR_IMG_BUILDAIR],
};
static NSDictionary *touchBarButtonActions = @{
@"openttd.pause": [NSNumber numberWithInt:MTHK_PAUSE],
@"openttd.fastforward": [NSNumber numberWithInt:MTHK_FASTFORWARD],
@"openttd.zoom_in": [NSNumber numberWithInt:MTHK_ZOOM_IN],
@"openttd.zoom_out": [NSNumber numberWithInt:MTHK_ZOOM_OUT],
@"openttd.build_rail": [NSNumber numberWithInt:MTHK_BUILD_RAIL],
@"openttd.build_road": [NSNumber numberWithInt:MTHK_BUILD_ROAD],
@"openttd.build_tram": [NSNumber numberWithInt:MTHK_BUILD_TRAM],
@"openttd.build_docks": [NSNumber numberWithInt:MTHK_BUILD_DOCKS],
@"openttd.build_airport": [NSNumber numberWithInt:MTHK_BUILD_AIRPORT],
};
static NSDictionary *touchBarFallbackText = @{
@"openttd.pause": @"Pause",
@"openttd.fastforward": @"Fast Forward",
@"openttd.zoom_in": @"Zoom In",
@"openttd.zoom_out": @"Zoom Out",
@"openttd.build_rail": @"Rail",
@"openttd.build_road": @"Road",
@"openttd.build_tram": @"Tram",
@"openttd.build_docks": @"Docks",
@"openttd.build_airport": @"Airport",
};
#endif
/** Subclass of NSWindow to cater our special needs */
@interface OTTD_CocoaWindow : NSWindow
#ifdef HAVE_TOUCHBAR_SUPPORT