Permalink
Browse files

Fixed keyboard editor

Removed unneeded stuff
  • Loading branch information...
0xe1f committed Apr 11, 2016
1 parent 64dc6ae commit d993b732eb5d8901892375ba75954303eddcf1bd
@@ -34,13 +34,6 @@
@end
@interface CMKeyboardManager : NSObject
-{
- IOHIDManagerRef keyboardHidManager;
- NSMutableArray *observers;
-
- @private
- NSObject *observerLock;
-}
+ (CMKeyboardManager *)sharedInstance;
@@ -36,6 +36,11 @@ - (void)keyStateDidChange:(NSInteger)scanCode
@end
@implementation CMKeyboardManager
+{
+ IOHIDManagerRef keyboardHidManager;
+ NSMutableArray *observers;
+ NSObject *observerLock;
+}
+ (CMKeyboardManager *)sharedInstance
{
View
@@ -1,42 +0,0 @@
-/*****************************************************************************
- **
- ** CocoaMSX: MSX Emulator for Mac OS X
- ** http://www.cocoamsx.com
- ** Copyright (C) 2012-2016 Akop Karapetyan
- **
- ** This program is free software; you can redistribute it and/or modify
- ** it under the terms of the GNU General Public License as published by
- ** the Free Software Foundation; either version 2 of the License, or
- ** (at your option) any later version.
- **
- ** This program is distributed in the hope that it will be useful,
- ** but WITHOUT ANY WARRANTY; without even the implied warranty of
- ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ** GNU General Public License for more details.
- **
- ** You should have received a copy of the GNU General Public License
- ** along with this program; if not, write to the Free Software
- ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- **
- ******************************************************************************
- */
-#import <Foundation/Foundation.h>
-
-enum
-{
- CMMSXJoystickUnknown = 0,
- CMMSXJoystickTwoButton = 1,
-};
-
-typedef NSUInteger CMMSXJoystickLayout;
-
-@interface CMMSXJoystick : NSObject
-{
- NSMutableDictionary *virtualCodeToButtonInfoMap;
-}
-
-- (NSString *)presentationLabelForVirtualCode:(NSInteger)keyCode;
-
-+ (CMMSXJoystick *)joystickWithLayout:(CMMSXJoystickLayout)layout;
-
-@end
View
@@ -1,135 +0,0 @@
-/*****************************************************************************
- **
- ** CocoaMSX: MSX Emulator for Mac OS X
- ** http://www.cocoamsx.com
- ** Copyright (C) 2012-2016 Akop Karapetyan
- **
- ** This program is free software; you can redistribute it and/or modify
- ** it under the terms of the GNU General Public License as published by
- ** the Free Software Foundation; either version 2 of the License, or
- ** (at your option) any later version.
- **
- ** This program is distributed in the hope that it will be useful,
- ** but WITHOUT ANY WARRANTY; without even the implied warranty of
- ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ** GNU General Public License for more details.
- **
- ** You should have received a copy of the GNU General Public License
- ** along with this program; if not, write to the Free Software
- ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- **
- ******************************************************************************
- */
-#import "CMMSXJoystick.h"
-
-#include "InputEvent.h"
-
-#pragma mark - CMJoystickButton
-
-@interface CMJoystickButton : NSObject
-
-@property (nonatomic, assign) NSInteger portOneVirtualCode;
-@property (nonatomic, assign) NSInteger portTwoVirtualCode;
-@property (nonatomic, strong) NSString *label;
-
-- (NSString *)presentationLabel;
-
-@end
-
-@implementation CMJoystickButton
-
-- (NSString *)presentationLabel
-{
- return [self label];
-}
-
-@end
-
-#pragma mark - CMMSXJoystick
-
-@interface CMMSXJoystick ()
-
-- (CMJoystickButton *)mapButtonWithPortOneVirtualCode:(NSInteger)portOneVirtualCode
- portTwoVirtualCode:(NSInteger)portTwoVirtualCode
- label:(NSString *)label;
-
-+ (CMMSXJoystick *)twoButtonJoystick;
-
-@end
-
-static NSDictionary *layoutToJoystickMap;
-
-@implementation CMMSXJoystick
-
-+ (void)initialize
-{
- layoutToJoystickMap = [[NSDictionary alloc] initWithObjectsAndKeys:
- [self twoButtonJoystick], @(CMMSXJoystickTwoButton),
-
- nil];
-}
-
-- (id)init
-{
- if ((self = [super init]))
- {
- virtualCodeToButtonInfoMap = [[NSMutableDictionary alloc] init];
- }
-
- return self;
-}
-
-- (CMJoystickButton *)mapButtonWithPortOneVirtualCode:(NSInteger)portOneVirtualCode
- portTwoVirtualCode:(NSInteger)portTwoVirtualCode
- label:(NSString *)label
-{
- CMJoystickButton *button = [[CMJoystickButton alloc] init];
-
- [button setPortOneVirtualCode:portOneVirtualCode];
- [button setPortTwoVirtualCode:portTwoVirtualCode];
- [button setLabel:label];
-
- [virtualCodeToButtonInfoMap setObject:button forKey:@(portOneVirtualCode)];
- [virtualCodeToButtonInfoMap setObject:button forKey:@(portTwoVirtualCode)];
-
- return button;
-}
-
-- (NSString *)presentationLabelForVirtualCode:(NSInteger)keyCode
-{
- return [[virtualCodeToButtonInfoMap objectForKey:@(keyCode)] presentationLabel];
-}
-
-+ (CMMSXJoystick *)joystickWithLayout:(CMMSXJoystickLayout)layout
-{
- return [layoutToJoystickMap objectForKey:@(layout)];
-}
-
-+ (CMMSXJoystick *)twoButtonJoystick
-{
- CMMSXJoystick *joystick = [[CMMSXJoystick alloc] init];
-
- [joystick mapButtonWithPortOneVirtualCode:EC_JOY1_BUTTON1
- portTwoVirtualCode:EC_JOY2_BUTTON1
- label:CMLoc(@"Button 1", @"Joystick button")];
- [joystick mapButtonWithPortOneVirtualCode:EC_JOY1_BUTTON2
- portTwoVirtualCode:EC_JOY2_BUTTON2
- label:CMLoc(@"Button 2", @"Joystick button")];
-
- [joystick mapButtonWithPortOneVirtualCode:EC_JOY1_UP
- portTwoVirtualCode:EC_JOY2_UP
- label:CMLoc(@"Up", @"Joystick button")];
- [joystick mapButtonWithPortOneVirtualCode:EC_JOY1_DOWN
- portTwoVirtualCode:EC_JOY2_DOWN
- label:CMLoc(@"Down", @"Joystick button")];
- [joystick mapButtonWithPortOneVirtualCode:EC_JOY1_LEFT
- portTwoVirtualCode:EC_JOY2_LEFT
- label:CMLoc(@"Left", @"Joystick button")];
- [joystick mapButtonWithPortOneVirtualCode:EC_JOY1_RIGHT
- portTwoVirtualCode:EC_JOY2_RIGHT
- label:CMLoc(@"Right", @"Joystick button")];
-
- return joystick;
-}
-
-@end
@@ -356,7 +356,6 @@
FEA4548D1679B65300AAECB7 /* DiskDocument.icns in Resources */ = {isa = PBXBuildFile; fileRef = FEA4548C1679B65300AAECB7 /* DiskDocument.icns */; };
FEA454901679BAF700AAECB7 /* CassetteDocument.icns in Resources */ = {isa = PBXBuildFile; fileRef = FEA4548F1679BAF700AAECB7 /* CassetteDocument.icns */; };
FEA6E8A416EB0A2800A580CF /* CMMSXKeyboard.m in Sources */ = {isa = PBXBuildFile; fileRef = FEA6E8A316EB0A2800A580CF /* CMMSXKeyboard.m */; };
- FEA6E8A716EB223100A580CF /* CMMSXJoystick.m in Sources */ = {isa = PBXBuildFile; fileRef = FEA6E8A616EB223100A580CF /* CMMSXJoystick.m */; };
FEA74EFD16FC14B60033E2DE /* Data in Resources */ = {isa = PBXBuildFile; fileRef = FEA74EFC16FC14B60033E2DE /* Data */; };
FEAAF3EF167283C500D371CD /* CMInputDeviceLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = FEAAF3EE167283C500D371CD /* CMInputDeviceLayout.m */; };
FEAAF3F81672942700D371CD /* CMInputMethod.m in Sources */ = {isa = PBXBuildFile; fileRef = FEAAF3F71672942700D371CD /* CMInputMethod.m */; };
@@ -1113,8 +1112,6 @@
FEA6277A16A0CAD70048C05C /* cbios.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = cbios.txt; sourceTree = "<group>"; };
FEA6E8A216EB0A2800A580CF /* CMMSXKeyboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CMMSXKeyboard.h; sourceTree = "<group>"; };
FEA6E8A316EB0A2800A580CF /* CMMSXKeyboard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CMMSXKeyboard.m; sourceTree = "<group>"; };
- FEA6E8A516EB223100A580CF /* CMMSXJoystick.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CMMSXJoystick.h; sourceTree = "<group>"; };
- FEA6E8A616EB223100A580CF /* CMMSXJoystick.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CMMSXJoystick.m; sourceTree = "<group>"; };
FEA74EFC16FC14B60033E2DE /* Data */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Data; sourceTree = "<group>"; };
FEA841B0187FCD8000F5CD6D /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
FEA841B2187FCD8000F5CD6D /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
@@ -2248,8 +2245,6 @@
FEAAF3EE167283C500D371CD /* CMInputDeviceLayout.m */,
6B1C25AA1672972F004DD618 /* CMKeyboardInput.h */,
6B1C25AB1672972F004DD618 /* CMKeyboardInput.m */,
- FEA6E8A516EB223100A580CF /* CMMSXJoystick.h */,
- FEA6E8A616EB223100A580CF /* CMMSXJoystick.m */,
FEA6E8A216EB0A2800A580CF /* CMMSXKeyboard.h */,
FEA6E8A316EB0A2800A580CF /* CMMSXKeyboard.m */,
FE2E1961164085A000BCFD53 /* CMPreferences.h */,
@@ -2768,7 +2763,6 @@
FE2D857D16E33140003EFB3F /* CMIsZero.m in Sources */,
FE2D858016E3480C003EFB3F /* CMAsString.m in Sources */,
FEA6E8A416EB0A2800A580CF /* CMMSXKeyboard.m in Sources */,
- FEA6E8A716EB223100A580CF /* CMMSXJoystick.m in Sources */,
FE81439016F797CC000FABC7 /* CMGamepadManager.m in Sources */,
FE81439316F7A191000FABC7 /* CMGamepad.m in Sources */,
FE05CAD4176CD21200D6CAC0 /* CMConfigureJoystickController.m in Sources */,
@@ -32,7 +32,6 @@
#import "MGScopeBar.h"
-#import "CMMSXJoystick.h"
#import "CMKeyboardInput.h"
#import "CMMachine.h"
#import "CMMixerChannel.h"
@@ -1321,7 +1320,7 @@ - (id) outlineView:(NSOutlineView *) outlineView
return nil;
} else if ([[tableColumn identifier] isEqualToString:@"CMKeyAssignmentColumn"]) {
CMKeyboardInput *keyInput = (CMKeyboardInput *)[[theEmulator keyboardLayout] inputMethodForVirtualCode:virtualCode];
- return [CMKeyCaptureView descriptionForKeyCode:@([keyInput keyCode])];
+ return [CMKeyCaptureView descriptionForKeyCode:[keyInput keyCode]];
}
}
@@ -17,49 +17,21 @@
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" animationBehavior="default" id="1">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
- <rect key="contentRect" x="196" y="240" width="430" height="300"/>
+ <rect key="contentRect" x="196" y="240" width="430" height="278"/>
<rect key="screenRect" x="0.0" y="0.0" width="1280" height="778"/>
<view key="contentView" id="2">
- <rect key="frame" x="0.0" y="0.0" width="430" height="300"/>
+ <rect key="frame" x="0.0" y="0.0" width="430" height="278"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
- <button verticalHuggingPriority="750" id="13">
- <rect key="frame" x="320" y="13" width="96" height="32"/>
- <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
- <buttonCell key="cell" type="push" title="Save" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="14">
- <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
- <font key="font" metaFont="system"/>
- <string key="keyEquivalent" base64-UTF8="YES">
-DQ
-</string>
- </buttonCell>
- <connections>
- <action selector="saveChanges:" target="-2" id="8Bg-PB-bSw"/>
- </connections>
- </button>
- <button verticalHuggingPriority="750" id="16">
- <rect key="frame" x="224" y="13" width="96" height="32"/>
- <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
- <buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="17">
- <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
- <font key="font" metaFont="system"/>
- <string key="keyEquivalent" base64-UTF8="YES">
-Gw
-</string>
- </buttonCell>
- <connections>
- <action selector="cancelChanges:" target="-2" id="Vhc-2b-ZIx"/>
- </connections>
- </button>
<scrollView autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" id="jFC-Qi-mc5">
- <rect key="frame" x="20" y="104" width="390" height="176"/>
+ <rect key="frame" x="20" y="101" width="390" height="157"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<clipView key="contentView" id="LvQ-rO-mxP">
- <rect key="frame" x="1" y="23" width="388" height="152"/>
+ <rect key="frame" x="1" y="0.0" width="388" height="156"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" headerView="Ekf-s2-NvB" id="Icy-7g-75c">
- <rect key="frame" x="0.0" y="0.0" width="322" height="19"/>
+ <rect key="frame" x="0.0" y="0.0" width="388" height="133"/>
<autoresizingMask key="autoresizingMask"/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
@@ -113,14 +85,21 @@ Gw
</tableHeaderView>
</scrollView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="RsH-JI-az6">
- <rect key="frame" x="18" y="49" width="394" height="47"/>
+ <rect key="frame" x="18" y="61" width="394" height="32"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Currently editing input" id="pN7-Kt-rbe">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
+ <box verticalHuggingPriority="750" title="Box" boxType="separator" titlePosition="noTitle" id="rXa-Ou-Abl">
+ <rect key="frame" x="20" y="50" width="390" height="5"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+ <color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
+ <color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
+ <font key="titleFont" metaFont="system"/>
+ </box>
<button verticalHuggingPriority="750" id="BLD-wX-CL8">
<rect key="frame" x="14" y="13" width="115" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
@@ -132,12 +111,40 @@ Gw
<action selector="resetToDefault:" target="-2" id="wiM-D5-QVl"/>
</connections>
</button>
+ <button verticalHuggingPriority="750" id="16">
+ <rect key="frame" x="224" y="13" width="96" height="32"/>
+ <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
+ <buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="17">
+ <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+ <font key="font" metaFont="system"/>
+ <string key="keyEquivalent" base64-UTF8="YES">
+Gw
+</string>
+ </buttonCell>
+ <connections>
+ <action selector="cancelChanges:" target="-2" id="Vhc-2b-ZIx"/>
+ </connections>
+ </button>
+ <button verticalHuggingPriority="750" id="13">
+ <rect key="frame" x="320" y="13" width="96" height="32"/>
+ <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
+ <buttonCell key="cell" type="push" title="Save" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="14">
+ <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+ <font key="font" metaFont="system"/>
+ <string key="keyEquivalent" base64-UTF8="YES">
+DQ
+</string>
+ </buttonCell>
+ <connections>
+ <action selector="saveChanges:" target="-2" id="8Bg-PB-bSw"/>
+ </connections>
+ </button>
</subviews>
</view>
<connections>
<outlet property="delegate" destination="-2" id="11"/>
</connections>
- <point key="canvasLocation" x="443" y="570"/>
+ <point key="canvasLocation" x="443" y="559"/>
</window>
</objects>
</document>
Oops, something went wrong.

0 comments on commit d993b73

Please sign in to comment.