Permalink
Browse files

Drop layout excange shortcuts and add simple pref pane

  • Loading branch information...
youknowone committed Nov 28, 2017
1 parent 1df68fd commit 550e5b84f5d976f8428b7a3a0e4f76039ccb5c55
@@ -34,7 +34,7 @@ FOUNDATION_EXTERN NSString *CIMOptionKeyBehavior;
FOUNDATION_EXTERN NSString *CIMHangulCombinationModeComposing;
FOUNDATION_EXTERN NSString *CIMHangulCombinationModeCommiting;
#define CIMConfigurationBoolItemCount 5
#define CIMConfigurationBoolItemCount 4
/* Common */
FOUNDATION_EXTERN NSString *CIMSharedInputManager;
/* Gureum */
@@ -71,8 +71,8 @@ - (id)initWithUserDefaults:(NSUserDefaults *)aUserDefaults {
{ CIMRightCommandKeyShortcutBehavior, &self->rightCommandKeyShortcutBehavior, 1 },
{ CIMRightOptionKeyShortcutBehavior, &self->rightOptionKeyShortcutBehavior, 2 },
{ CIMRightControlKeyShortcutBehavior, &self->rightControlKeyShortcutBehavior, 0 },
{ CIMInputModeExchangeKeyModifier, &self->inputModeExchangeKeyModifier, NSShiftKeyMask },
{ CIMInputModeExchangeKeyCode, &self->inputModeExchangeKeyCode, 0x31 },
{ CIMInputModeExchangeKeyModifier, &self->inputModeExchangeKeyModifier, 0 }, // NSShiftKeyMask
{ CIMInputModeExchangeKeyCode, &self->inputModeExchangeKeyCode, 0 }, // 0x31
{ CIMInputModeHanjaKeyModifier, &self->inputModeHanjaKeyModifier, NSAlternateKeyMask },
{ CIMInputModeHanjaKeyCode, &self->inputModeHanjaKeyCode, 0x24 },
{ CIMInputModeEnglishKeyModifier, &self->inputModeEnglishKeyModifier, 0 },
@@ -17,8 +17,8 @@
38162E0F141264EB0077AA2D /* HangulComposer.m in Sources */ = {isa = PBXBuildFile; fileRef = 38162D7B140F64B70077AA2D /* HangulComposer.m */; };
38162E1514126ACE0077AA2D /* CIMComposer.m in Sources */ = {isa = PBXBuildFile; fileRef = 38162E1314126ACE0077AA2D /* CIMComposer.m */; };
38162E4814128A740077AA2D /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 38162E4914128A740077AA2D /* MainMenu.xib */; };
382E68691A1314D900031D1D /* Preferences.h in Headers */ = {isa = PBXBuildFile; fileRef = 382E68681A1314D900031D1D /* Preferences.h */; };
382E686B1A1314D900031D1D /* Preferences.m in Sources */ = {isa = PBXBuildFile; fileRef = 382E686A1A1314D900031D1D /* Preferences.m */; };
381CA2EF1FCE16EA00DDB81D /* Preferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = 381CA2EE1FCE16EA00DDB81D /* Preferences.swift */; };
381CA2F11FCE208A00DDB81D /* Example.png in Resources */ = {isa = PBXBuildFile; fileRef = 381CA2F01FCE208A00DDB81D /* Example.png */; };
382E686D1A1314D900031D1D /* Preferences.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 382E686C1A1314D900031D1D /* Preferences.tiff */; };
382E68701A1314D900031D1D /* Preferences.xib in Resources */ = {isa = PBXBuildFile; fileRef = 382E686E1A1314D900031D1D /* Preferences.xib */; };
382E68761A13156700031D1D /* Preferences.prefPane in Resources */ = {isa = PBXBuildFile; fileRef = 382E68641A1314D900031D1D /* Preferences.prefPane */; };
@@ -216,10 +216,11 @@
38162E451412866F0077AA2D /* ko */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ko; path = ko.lproj/InfoPlist.strings; sourceTree = "<group>"; };
38162E4914128A740077AA2D /* MainMenu.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainMenu.xib; sourceTree = "<group>"; };
381B32731DA826B100EA1975 /* Bridge.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Bridge.h; sourceTree = "<group>"; };
381CA2ED1FCE16EA00DDB81D /* Preferences-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Preferences-Bridging-Header.h"; sourceTree = "<group>"; };
381CA2EE1FCE16EA00DDB81D /* Preferences.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Preferences.swift; sourceTree = "<group>"; };
381CA2F01FCE208A00DDB81D /* Example.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Example.png; sourceTree = "<group>"; };
382E68641A1314D900031D1D /* Preferences.prefPane */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Preferences.prefPane; sourceTree = BUILT_PRODUCTS_DIR; };
382E68671A1314D900031D1D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
382E68681A1314D900031D1D /* Preferences.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Preferences.h; sourceTree = "<group>"; };
382E686A1A1314D900031D1D /* Preferences.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Preferences.m; sourceTree = "<group>"; };
382E686C1A1314D900031D1D /* Preferences.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = Preferences.tiff; sourceTree = "<group>"; };
382E686F1A1314D900031D1D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/Preferences.xib; sourceTree = "<group>"; };
383562EB18B9F2D900F8B8B9 /* han2@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "han2@2x.png"; path = "Icons/han2@2x.png"; sourceTree = "<group>"; };
@@ -381,11 +382,12 @@
382E68651A1314D900031D1D /* Preferences */ = {
isa = PBXGroup;
children = (
382E68681A1314D900031D1D /* Preferences.h */,
382E686A1A1314D900031D1D /* Preferences.m */,
381CA2EE1FCE16EA00DDB81D /* Preferences.swift */,
382E686C1A1314D900031D1D /* Preferences.tiff */,
382E686E1A1314D900031D1D /* Preferences.xib */,
381CA2F01FCE208A00DDB81D /* Example.png */,
382E68661A1314D900031D1D /* Supporting Files */,
381CA2ED1FCE16EA00DDB81D /* Preferences-Bridging-Header.h */,
);
path = Preferences;
sourceTree = "<group>";
@@ -613,7 +615,6 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
382E68691A1314D900031D1D /* Preferences.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -705,7 +706,7 @@
382E68631A1314D900031D1D = {
CreatedOnToolsVersion = 6.1;
DevelopmentTeam = 9384JEL3M9;
LastSwiftMigration = 0800;
LastSwiftMigration = 0900;
};
38BFE7F918B45419004B2B2E = {
LastSwiftMigration = 0800;
@@ -800,6 +801,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
381CA2F11FCE208A00DDB81D /* Example.png in Resources */,
382E68701A1314D900031D1D /* Preferences.xib in Resources */,
382E686D1A1314D900031D1D /* Preferences.tiff in Resources */,
);
@@ -934,7 +936,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
382E686B1A1314D900031D1D /* Preferences.m in Sources */,
381CA2EF1FCE16EA00DDB81D /* Preferences.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1108,10 +1110,13 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
INFOPLIST_FILE = Preferences/Info.plist;
INSTALL_PATH = "$(HOME)/Library/PreferencePanes";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
MTL_ENABLE_DEBUG_INFO = YES;
PRODUCT_BUNDLE_IDENTIFIER = org.youknowone.inputmethod.Korean.Preferences;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
SWIFT_OBJC_BRIDGING_HEADER = "Preferences/Preferences-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
WRAPPER_EXTENSION = prefPane;
};
@@ -1135,10 +1140,12 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
INFOPLIST_FILE = Preferences/Info.plist;
INSTALL_PATH = "$(HOME)/Library/PreferencePanes";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = org.youknowone.inputmethod.Korean.Preferences;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
SWIFT_OBJC_BRIDGING_HEADER = "Preferences/Preferences-Bridging-Header.h";
SWIFT_VERSION = 3.0;
WRAPPER_EXTENSION = prefPane;
};
View
@@ -158,18 +158,18 @@ - (CIMInputTextProcessResult)inputController:(CIMInputController *)controller co
dlog(DEBUG_SHORTCUT, @"**** Reset modifier ****");
self->lastModifier = 0;
if (inputModifier == CIMSharedConfiguration->inputModeExchangeKeyModifier && keyCode == CIMSharedConfiguration->inputModeExchangeKeyCode) {
dlog(DEBUG_SHORTCUT, @"**** Layout exchange by exchange shortcut ****");
need_exchange = YES;
}
else if (self.delegate == self->hangulComposer && inputModifier == CIMSharedConfiguration->inputModeEnglishKeyModifier && keyCode == CIMSharedConfiguration->inputModeEnglishKeyCode) {
dlog(DEBUG_SHORTCUT, @"**** Layout exchange by change to english shortcut ****");
need_exchange = YES;
}
else if (self.delegate == self->romanComposer && inputModifier == CIMSharedConfiguration->inputModeKoreanKeyModifier && keyCode == CIMSharedConfiguration->inputModeKoreanKeyCode) {
dlog(DEBUG_SHORTCUT, @"**** Layout exchange by change to korean shortcut ****");
need_exchange = YES;
}
// if (inputModifier == CIMSharedConfiguration->inputModeExchangeKeyModifier && keyCode == CIMSharedConfiguration->inputModeExchangeKeyCode) {
// dlog(DEBUG_SHORTCUT, @"**** Layout exchange by exchange shortcut ****");
// need_exchange = YES;
// }
// else if (self.delegate == self->hangulComposer && inputModifier == CIMSharedConfiguration->inputModeEnglishKeyModifier && keyCode == CIMSharedConfiguration->inputModeEnglishKeyCode) {
// dlog(DEBUG_SHORTCUT, @"**** Layout exchange by change to english shortcut ****");
// need_exchange = YES;
// }
// else if (self.delegate == self->romanComposer && inputModifier == CIMSharedConfiguration->inputModeKoreanKeyModifier && keyCode == CIMSharedConfiguration->inputModeKoreanKeyCode) {
// dlog(DEBUG_SHORTCUT, @"**** Layout exchange by change to korean shortcut ****");
// need_exchange = YES;
// }
if (inputModifier == CIMSharedConfiguration->inputModeHanjaKeyModifier && keyCode == CIMSharedConfiguration->inputModeHanjaKeyCode) {
dlog(DEBUG_SHORTCUT, @"**** Layout exchange by hanja shortcut ****");
View
@@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleGetInfoString</key>
<string>${VERSION}, Copyright 2011-2016 Jeong YunWon</string>
<string>${VERSION}, Copyright 2011-2017 Jeong YunWon</string>
<key>CFBundleIconFile</key>
<string>Gureum.icns</string>
<key>CFBundleIdentifier</key>
@@ -526,7 +526,7 @@
<true/>
</dict>
<key>NSHumanReadableCopyright</key>
<string>Copyright 2011-2014 Jeong YunWon</string>
<string>Copyright 2011-2017 Jeong YunWon</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
@@ -1,36 +1,60 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6250" systemVersion="14A389" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13196" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6250"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13196"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSPreferencePane">
<customObject id="-2" userLabel="File's Owner" customClass="GureumPreferencePane" customModule="Preferences" customModuleProvider="target">
<connections>
<outlet property="_window" destination="F0z-JX-Cv5" id="gIp-Ho-8D9"/>
<outlet property="_window" destination="F0z-JX-Cv5" id="KJ8-tk-g3I"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="≪ do not localize ≫" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" deferred="NO" oneShot="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="F0z-JX-Cv5" userLabel="PrefPane">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="176" y="715" width="668" height="368"/>
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1177"/>
<rect key="contentRect" x="176" y="715" width="400" height="326"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
<view key="contentView" id="se5-gp-TjO">
<rect key="frame" x="0.0" y="0.0" width="668" height="368"/>
<rect key="frame" x="0.0" y="0.0" width="400" height="326"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="kC8-kH-2z7">
<rect key="frame" x="53" y="311" width="38" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Label" id="Ndr-tA-evW">
<font key="font" metaFont="system"/>
<rect key="frame" x="8" y="238" width="355" height="68"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" id="Ndr-tA-evW">
<font key="font" size="13" name=".AppleSDGothicNeoI-Regular"/>
<string key="title">단축키 설정
시스템 환경설정 -&gt; 키보드 -&gt; 단축키 -&gt; 인풋 소스 에서 설정
 ⇧스페이스 와 같이 ⇧가 포함된 단축키로 설정하려면 Fn 키와 함께
 눌러주세요. (예: Fn+⇧+스페이스)</string>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Qqz-db-kKD">
<rect key="frame" x="0.0" y="0.0" width="400" height="230"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="Example" id="bEo-nG-ni3"/>
</imageView>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="tMq-UC-GBP">
<rect key="frame" x="262" y="279" width="134" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" title="설정하러 이동하기" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="OPL-eq-ykB">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" size="13" name=".AppleSDGothicNeoI-Regular"/>
</buttonCell>
<connections>
<action selector="openKeyboardPreferenceWithSender:" target="-2" id="c3x-ba-1Q5"/>
</connections>
</button>
</subviews>
</view>
<point key="canvasLocation" x="48" y="171"/>
</window>
</objects>
<resources>
<image name="Example" width="675" height="352.5"/>
</resources>
</document>
View
Binary file not shown.
View
@@ -21,7 +21,7 @@
<key>CFBundleVersion</key>
<string>1</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2014년 youknowone.org. All rights reserved.</string>
<string>Copyright © 2011-2017 youknowone.org. All rights reserved.</string>
<key>NSMainNibFile</key>
<string>Preferences</string>
<key>NSPrefPaneIconFile</key>
@@ -0,0 +1,4 @@
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
@@ -0,0 +1,25 @@
//
// Preferences.swift
// Preferences
//
// Created by Jeong YunWon on 2017. 11. 29..
// Copyright © 2017 youknowone.org. All rights reserved.
//
import Foundation
import PreferencePanes
class GureumPreferencePane: NSPreferencePane {
// @IBOutlet var _window: UIWindow documented in NSPreferencePane but not automatically supported by IB
@IBAction func openKeyboardPreference(sender: NSControl) {
let myAppleScript = "reveal anchor \"ShortcutsTab\" of pane id \"com.apple.preference.keyboard\""
var error: NSDictionary?
if let scriptObject = NSAppleScript(source: myAppleScript) {
let output: NSAppleEventDescriptor = scriptObject.executeAndReturnError(
&error)
print(output.stringValue)
}
}
}

0 comments on commit 550e5b8

Please sign in to comment.