mirror of
https://github.com/keycastr/keycastr.git
synced 2026-05-15 14:15:50 -06:00
Add customization to svelte visualizer
This commit is contained in:
parent
3e1967f013
commit
2bdcb0c44a
4 changed files with 349 additions and 43 deletions
|
|
@ -35,5 +35,6 @@
|
|||
-(void) setImage:(NSImage*)anImage forKey:(NSString*)aKey;
|
||||
-(NSImage*) imageForKey:(NSString*)aKey;
|
||||
|
||||
- (void)removeObjectsWithPrefix:(NSString *)prefix;
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -69,4 +69,18 @@
|
|||
return theImage;
|
||||
}
|
||||
|
||||
- (void)removeObjectsWithPrefix:(NSString *)prefix {
|
||||
NSDictionary *all =
|
||||
[self dictionaryRepresentation];
|
||||
|
||||
for (NSString *key in all) {
|
||||
if ([key hasPrefix:prefix]) {
|
||||
[self removeObjectForKey:key];
|
||||
}
|
||||
}
|
||||
|
||||
// Refresh state for cocoa bindings
|
||||
[[NSUserDefaultsController sharedUserDefaultsController] revert:nil];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="24506" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="24506"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
|
|
@ -13,11 +14,69 @@
|
|||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||
<customView id="8" userLabel="Custom View">
|
||||
<rect key="frame" x="0.0" y="0.0" width="370" height="60"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="387" height="368"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<subviews>
|
||||
<textField focusRingType="none" verticalHuggingPriority="1000" verticalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="VdV-OQ-XtI">
|
||||
<rect key="frame" x="149" y="340" width="90" height="16"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="16" id="yfX-S3-OEW"/>
|
||||
</constraints>
|
||||
<textFieldCell key="cell" lineBreakMode="clipping" allowsUndo="NO" sendsActionOnEndEditing="YES" alignment="right" title="Display Mode:" id="A2X-S0-puu">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="YVO-s7-ndG">
|
||||
<rect key="frame" x="212" y="261" width="96" height="30"/>
|
||||
<buttonCell key="cell" type="check" title="Control (⌃)" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="dDP-mU-wAm">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<binding destination="2Th-Np-O1z" name="value" keyPath="values.svelte.display.control" id="c0B-ZU-J5W"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="57d-0g-uRF">
|
||||
<rect key="frame" x="212" y="306" width="81" height="18"/>
|
||||
<buttonCell key="cell" type="check" title="Shift (⇧)" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="c9C-Dr-fPb">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<binding destination="2Th-Np-O1z" name="value" keyPath="values.svelte.display.shift" id="I5e-ar-pNe"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="749" translatesAutoresizingMaskIntoConstraints="NO" id="ztk-gv-tRO">
|
||||
<rect key="frame" x="58" y="261" width="93" height="30"/>
|
||||
<buttonCell key="cell" type="check" title="Option (⌥)" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="VrV-l7-ZPe">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<binding destination="2Th-Np-O1z" name="value" keyPath="values.svelte.display.option" id="pTO-hT-hLM"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="2bC-mC-eni">
|
||||
<rect key="frame" x="58" y="306" width="114" height="18"/>
|
||||
<buttonCell key="cell" type="check" title="Command (⌘)" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="3PH-uv-00X">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="16" id="6oW-9r-8b8"/>
|
||||
</constraints>
|
||||
<connections>
|
||||
<binding destination="2Th-Np-O1z" name="value" keyPath="values.svelte.display.command" id="r9S-xb-yQQ"/>
|
||||
</connections>
|
||||
</button>
|
||||
<box autoresizesSubviews="NO" verticalHuggingPriority="750" boxType="separator" id="ybo-1P-b0h">
|
||||
<rect key="frame" x="-40" y="243" width="467" height="5"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
|
||||
</box>
|
||||
<button imageHugsTitle="YES" horizontalHuggingPriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="BmP-1Z-8xN">
|
||||
<rect key="frame" x="22" y="23" width="163" height="19"/>
|
||||
<rect key="frame" x="20" y="208" width="163" height="18"/>
|
||||
<buttonCell key="cell" type="check" title="Display All Keystrokes:" bezelStyle="regularSquare" imagePosition="right" alignment="left" state="on" inset="2" id="DWq-JT-zxO">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
|
|
@ -25,19 +84,186 @@
|
|||
<binding destination="2Th-Np-O1z" name="value" keyPath="values.svelte.displayAll" id="FCh-5O-6YO"/>
|
||||
</connections>
|
||||
</buttonCell>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="17" id="KU4-I5-ZJr"/>
|
||||
</constraints>
|
||||
<connections>
|
||||
<binding destination="2Th-Np-O1z" name="value" keyPath="values.svelte.displayAll" id="aF8-FA-7c9"/>
|
||||
</connections>
|
||||
</button>
|
||||
<textField focusRingType="none" verticalHuggingPriority="1000" verticalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="8Hq-WI-E9P">
|
||||
<rect key="frame" x="41" y="168" width="117" height="17"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="17" id="5v6-Yc-bRj"/>
|
||||
</constraints>
|
||||
<textFieldCell key="cell" lineBreakMode="clipping" allowsUndo="NO" sendsActionOnEndEditing="YES" alignment="right" title="Background Color:" id="Jnc-1l-ttR">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<colorWell translatesAutoresizingMaskIntoConstraints="NO" id="OF0-Lz-ole">
|
||||
<rect key="frame" x="161" y="164" width="50" height="26"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="44" id="Jxf-WK-BN8"/>
|
||||
<constraint firstAttribute="height" constant="22" id="O0h-2j-4V5"/>
|
||||
</constraints>
|
||||
<color key="color" red="0.0" green="0.0" blue="0.0" alpha="0.84702690972222228" colorSpace="custom" customColorSpace="calibratedRGB"/>
|
||||
<connections>
|
||||
<binding destination="2Th-Np-O1z" name="value" keyPath="values.svelte.backgroundColor" id="4pB-E7-8UF">
|
||||
<dictionary key="options">
|
||||
<string key="NSValueTransformerName">KCColorValueTransformer</string>
|
||||
</dictionary>
|
||||
</binding>
|
||||
</connections>
|
||||
</colorWell>
|
||||
<textField focusRingType="none" verticalHuggingPriority="1000" verticalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="82r-Ee-gSc">
|
||||
<rect key="frame" x="88" y="135" width="70" height="17"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="17" id="tnI-9K-v2E"/>
|
||||
</constraints>
|
||||
<textFieldCell key="cell" lineBreakMode="clipping" allowsUndo="NO" sendsActionOnEndEditing="YES" alignment="right" title="Text Color:" id="AZF-lB-ul3">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<colorWell translatesAutoresizingMaskIntoConstraints="NO" id="tJG-Pb-F8N">
|
||||
<rect key="frame" x="161" y="131" width="50" height="26"/>
|
||||
<color key="color" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
|
||||
<connections>
|
||||
<binding destination="2Th-Np-O1z" name="value" keyPath="values.svelte.textColor" id="S3S-dK-Vpm">
|
||||
<dictionary key="options">
|
||||
<string key="NSValueTransformerName">KCColorValueTransformer</string>
|
||||
</dictionary>
|
||||
</binding>
|
||||
</connections>
|
||||
</colorWell>
|
||||
<textField focusRingType="none" verticalHuggingPriority="1000" verticalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="Qod-ge-OPi">
|
||||
<rect key="frame" x="13" y="61" width="145" height="17"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="17" id="PEN-cF-Kez"/>
|
||||
</constraints>
|
||||
<textFieldCell key="cell" lineBreakMode="clipping" allowsUndo="NO" sendsActionOnEndEditing="YES" alignment="right" title="Inactive Modifier Color:" id="aYM-KP-vwe">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<colorWell translatesAutoresizingMaskIntoConstraints="NO" id="p2v-OH-1Wq">
|
||||
<rect key="frame" x="161" y="57" width="50" height="26"/>
|
||||
<color key="color" white="1" alpha="0.5" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
<connections>
|
||||
<binding destination="2Th-Np-O1z" name="value" keyPath="values.svelte.inactiveModifierColor" id="xIl-nM-hcM">
|
||||
<dictionary key="options">
|
||||
<string key="NSValueTransformerName">KCColorValueTransformer</string>
|
||||
</dictionary>
|
||||
</binding>
|
||||
</connections>
|
||||
</colorWell>
|
||||
<textField focusRingType="none" verticalHuggingPriority="1000" verticalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="2dT-Xd-wVe">
|
||||
<rect key="frame" x="23" y="28" width="135" height="17"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="17" id="9Pu-Ux-2g4"/>
|
||||
</constraints>
|
||||
<textFieldCell key="cell" lineBreakMode="clipping" allowsUndo="NO" sendsActionOnEndEditing="YES" alignment="right" title="Active Modifier Color:" id="Pn4-dR-6os">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<colorWell translatesAutoresizingMaskIntoConstraints="NO" id="dKW-um-pMQ">
|
||||
<rect key="frame" x="161" y="24" width="50" height="26"/>
|
||||
<color key="color" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
|
||||
<connections>
|
||||
<binding destination="2Th-Np-O1z" name="value" keyPath="values.svelte.activeModifierColor" id="5gL-cq-Opr">
|
||||
<dictionary key="options">
|
||||
<string key="NSValueTransformerName">KCColorValueTransformer</string>
|
||||
</dictionary>
|
||||
</binding>
|
||||
</connections>
|
||||
</colorWell>
|
||||
<textField focusRingType="none" verticalHuggingPriority="1000" verticalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="PHI-fK-BAD">
|
||||
<rect key="frame" x="37" y="102" width="121" height="17"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="17" id="HWQ-wG-31o"/>
|
||||
</constraints>
|
||||
<textFieldCell key="cell" lineBreakMode="clipping" allowsUndo="NO" sendsActionOnEndEditing="YES" alignment="right" title="Text Shadow Color:" id="CPe-qb-zqK">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<colorWell translatesAutoresizingMaskIntoConstraints="NO" id="iH2-aT-pu4">
|
||||
<rect key="frame" x="161" y="98" width="50" height="26"/>
|
||||
<color key="color" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
|
||||
<connections>
|
||||
<binding destination="2Th-Np-O1z" name="value" keyPath="values.svelte.textShadowColor" id="Oig-zk-m1p">
|
||||
<dictionary key="options">
|
||||
<string key="NSValueTransformerName">KCColorValueTransformer</string>
|
||||
</dictionary>
|
||||
</binding>
|
||||
</connections>
|
||||
</colorWell>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ie6-Va-wyE">
|
||||
<rect key="frame" x="315" y="13" width="58" height="27"/>
|
||||
<buttonCell key="cell" type="push" title="Reset" bezelStyle="rounded" alignment="center" controlSize="small" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Ie4-X4-WO6">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="resetPreferences:" target="-2" id="OGO-7q-ckv"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="BmP-1Z-8xN" firstAttribute="leading" secondItem="8" secondAttribute="leading" constant="22" id="1TF-5V-uCv"/>
|
||||
<constraint firstItem="BmP-1Z-8xN" firstAttribute="top" secondItem="8" secondAttribute="top" constant="19" id="R06-0Y-eqt"/>
|
||||
<constraint firstItem="2bC-mC-eni" firstAttribute="centerY" secondItem="57d-0g-uRF" secondAttribute="centerY" id="02v-9J-7dt"/>
|
||||
<constraint firstItem="PHI-fK-BAD" firstAttribute="trailing" secondItem="8Hq-WI-E9P" secondAttribute="trailing" id="0Zi-Cu-7yT"/>
|
||||
<constraint firstItem="BmP-1Z-8xN" firstAttribute="leading" secondItem="8" secondAttribute="leading" constant="20" id="1TF-5V-uCv"/>
|
||||
<constraint firstItem="p2v-OH-1Wq" firstAttribute="trailing" secondItem="OF0-Lz-ole" secondAttribute="trailing" id="286-9e-Pcb"/>
|
||||
<constraint firstItem="2dT-Xd-wVe" firstAttribute="top" secondItem="Qod-ge-OPi" secondAttribute="bottom" constant="16" id="2uv-ly-fvc"/>
|
||||
<constraint firstAttribute="trailing" secondItem="ie6-Va-wyE" secondAttribute="trailing" constant="20" id="3AD-C0-Go8"/>
|
||||
<constraint firstItem="iH2-aT-pu4" firstAttribute="centerY" secondItem="PHI-fK-BAD" secondAttribute="centerY" id="7Zu-b3-Dbq"/>
|
||||
<constraint firstItem="iH2-aT-pu4" firstAttribute="width" secondItem="OF0-Lz-ole" secondAttribute="width" id="8Mx-YS-HHV"/>
|
||||
<constraint firstItem="dKW-um-pMQ" firstAttribute="width" secondItem="OF0-Lz-ole" secondAttribute="width" id="9YK-wz-nBR"/>
|
||||
<constraint firstItem="2dT-Xd-wVe" firstAttribute="trailing" secondItem="8Hq-WI-E9P" secondAttribute="trailing" id="9lI-aI-Cpe"/>
|
||||
<constraint firstItem="iH2-aT-pu4" firstAttribute="trailing" secondItem="OF0-Lz-ole" secondAttribute="trailing" id="9r4-kp-u8i"/>
|
||||
<constraint firstItem="ztk-gv-tRO" firstAttribute="centerY" secondItem="YVO-s7-ndG" secondAttribute="centerY" id="B32-Cd-GEo"/>
|
||||
<constraint firstItem="tJG-Pb-F8N" firstAttribute="centerY" secondItem="82r-Ee-gSc" secondAttribute="centerY" id="B4e-Ej-hXw"/>
|
||||
<constraint firstItem="Qod-ge-OPi" firstAttribute="top" secondItem="PHI-fK-BAD" secondAttribute="bottom" constant="24" id="B8M-hl-UV0"/>
|
||||
<constraint firstItem="82r-Ee-gSc" firstAttribute="top" secondItem="8Hq-WI-E9P" secondAttribute="bottom" constant="16" id="BhJ-d6-OBM"/>
|
||||
<constraint firstItem="tJG-Pb-F8N" firstAttribute="width" secondItem="OF0-Lz-ole" secondAttribute="width" id="BuQ-VH-ouu"/>
|
||||
<constraint firstItem="YVO-s7-ndG" firstAttribute="top" secondItem="57d-0g-uRF" secondAttribute="bottom" constant="17" id="Iek-hl-rkn"/>
|
||||
<constraint firstAttribute="bottom" secondItem="ie6-Va-wyE" secondAttribute="bottom" constant="20" id="JkC-Pa-3EF"/>
|
||||
<constraint firstItem="PHI-fK-BAD" firstAttribute="top" secondItem="82r-Ee-gSc" secondAttribute="bottom" constant="16" id="Kmp-q9-4KY"/>
|
||||
<constraint firstItem="p2v-OH-1Wq" firstAttribute="width" secondItem="OF0-Lz-ole" secondAttribute="width" id="LN2-g5-GLa"/>
|
||||
<constraint firstItem="dKW-um-pMQ" firstAttribute="trailing" secondItem="OF0-Lz-ole" secondAttribute="trailing" id="Lc5-LT-ov5"/>
|
||||
<constraint firstItem="OF0-Lz-ole" firstAttribute="leading" secondItem="8Hq-WI-E9P" secondAttribute="trailing" constant="8" symbolic="YES" id="LjM-sS-N41"/>
|
||||
<constraint firstAttribute="bottom" secondItem="2dT-Xd-wVe" secondAttribute="bottom" constant="28" id="LqE-uQ-n96"/>
|
||||
<constraint firstItem="82r-Ee-gSc" firstAttribute="trailing" secondItem="8Hq-WI-E9P" secondAttribute="trailing" id="Onl-vU-9WX"/>
|
||||
<constraint firstItem="2bC-mC-eni" firstAttribute="top" secondItem="VdV-OQ-XtI" secondAttribute="bottom" constant="17" id="SEN-a6-yIH"/>
|
||||
<constraint firstItem="dKW-um-pMQ" firstAttribute="centerY" secondItem="2dT-Xd-wVe" secondAttribute="centerY" id="TnT-pB-llR"/>
|
||||
<constraint firstItem="tJG-Pb-F8N" firstAttribute="height" secondItem="OF0-Lz-ole" secondAttribute="height" id="TsR-GM-Y5S"/>
|
||||
<constraint firstItem="ybo-1P-b0h" firstAttribute="top" secondItem="ztk-gv-tRO" secondAttribute="bottom" constant="16" id="V6N-Yw-nrP"/>
|
||||
<constraint firstItem="YVO-s7-ndG" firstAttribute="height" secondItem="2bC-mC-eni" secondAttribute="height" multiplier="1.75" id="YcK-Uh-ClH"/>
|
||||
<constraint firstItem="VdV-OQ-XtI" firstAttribute="top" secondItem="8" secondAttribute="top" constant="12" id="fCj-e2-HcE"/>
|
||||
<constraint firstItem="57d-0g-uRF" firstAttribute="height" secondItem="2bC-mC-eni" secondAttribute="height" id="gY8-vI-cSW"/>
|
||||
<constraint firstItem="p2v-OH-1Wq" firstAttribute="centerY" secondItem="Qod-ge-OPi" secondAttribute="centerY" id="hSw-Rc-Yjd"/>
|
||||
<constraint firstItem="8Hq-WI-E9P" firstAttribute="trailing" secondItem="Qod-ge-OPi" secondAttribute="trailing" id="i2S-x7-B5b"/>
|
||||
<constraint firstItem="ztk-gv-tRO" firstAttribute="top" secondItem="2bC-mC-eni" secondAttribute="bottom" constant="17" id="j67-24-ubs"/>
|
||||
<constraint firstItem="OF0-Lz-ole" firstAttribute="centerY" secondItem="8Hq-WI-E9P" secondAttribute="centerY" id="jQX-Z5-tcn"/>
|
||||
<constraint firstItem="2dT-Xd-wVe" firstAttribute="leading" secondItem="8" secondAttribute="leading" constant="25" id="kdf-g6-fct"/>
|
||||
<constraint firstItem="VdV-OQ-XtI" firstAttribute="centerX" secondItem="8" secondAttribute="centerX" id="kzd-6E-JqZ"/>
|
||||
<constraint firstItem="8Hq-WI-E9P" firstAttribute="top" secondItem="BmP-1Z-8xN" secondAttribute="bottom" constant="24" id="ml5-uk-rff"/>
|
||||
<constraint firstItem="ztk-gv-tRO" firstAttribute="height" secondItem="2bC-mC-eni" secondAttribute="height" multiplier="1.75" id="mxB-qR-Xft"/>
|
||||
<constraint firstItem="2bC-mC-eni" firstAttribute="leading" secondItem="8" secondAttribute="leading" constant="60" id="oLL-Bw-crb"/>
|
||||
<constraint firstItem="iH2-aT-pu4" firstAttribute="height" secondItem="OF0-Lz-ole" secondAttribute="height" id="oiW-HT-Jph"/>
|
||||
<constraint firstItem="tJG-Pb-F8N" firstAttribute="trailing" secondItem="OF0-Lz-ole" secondAttribute="trailing" id="ruu-k6-65m"/>
|
||||
<constraint firstItem="2bC-mC-eni" firstAttribute="baseline" secondItem="57d-0g-uRF" secondAttribute="baseline" id="uLP-xT-Lcr"/>
|
||||
<constraint firstItem="YVO-s7-ndG" firstAttribute="leading" secondItem="57d-0g-uRF" secondAttribute="leading" id="wXO-Ce-8XP"/>
|
||||
<constraint firstItem="57d-0g-uRF" firstAttribute="leading" secondItem="2bC-mC-eni" secondAttribute="trailing" constant="42" id="x7E-Jg-MMl"/>
|
||||
<constraint firstItem="dKW-um-pMQ" firstAttribute="height" secondItem="OF0-Lz-ole" secondAttribute="height" id="xYB-PV-IF5"/>
|
||||
<constraint firstItem="ztk-gv-tRO" firstAttribute="leading" secondItem="2bC-mC-eni" secondAttribute="leading" id="yuf-LS-tQt"/>
|
||||
<constraint firstItem="p2v-OH-1Wq" firstAttribute="height" secondItem="OF0-Lz-ole" secondAttribute="height" id="zyJ-mj-33Q"/>
|
||||
</constraints>
|
||||
<point key="canvasLocation" x="244" y="134"/>
|
||||
<point key="canvasLocation" x="252.5" y="4.5"/>
|
||||
</customView>
|
||||
<userDefaultsController representsSharedInstance="YES" id="2Th-Np-O1z"/>
|
||||
</objects>
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
#import "KCKeycastrEvent.h"
|
||||
#import "KCKeystroke.h"
|
||||
#import "KCMouseEvent.h"
|
||||
#import "NSUserDefaults+Utility.h"
|
||||
|
||||
@implementation SvelteVisualizerFactory
|
||||
|
||||
|
|
@ -59,19 +60,35 @@
|
|||
|
||||
-(void) drawRect:(NSRect)rect
|
||||
{
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
NSRect frame = [self frame];
|
||||
[[NSColor clearColor] setFill];
|
||||
NSRectFill(frame);
|
||||
|
||||
BOOL shift = [ud boolForKey:@"svelte.display.shift"];
|
||||
BOOL control = [ud boolForKey:@"svelte.display.control"];
|
||||
BOOL option = [ud boolForKey:@"svelte.display.option"];
|
||||
BOOL command = [ud boolForKey:@"svelte.display.command"];
|
||||
|
||||
float oneQuarter = floorf(frame.size.width / 4);
|
||||
int segmentCount = shift + control + option + command;
|
||||
float oneSegment = floorf(frame.size.width / segmentCount);
|
||||
|
||||
[[NSColor colorWithCalibratedWhite:0 alpha:0.85] setFill];
|
||||
CGFloat rectHeight = segmentCount ? 100 : 70;
|
||||
CGFloat rectY = segmentCount ? 0 : 30;
|
||||
NSRect drawRect = NSMakeRect(frame.origin.x, rectY, frame.size.width, rectHeight);
|
||||
|
||||
[[ud colorForKey:@"svelte.backgroundColor"] setFill];
|
||||
NSBezierPath* bp = [NSBezierPath bezierPath];
|
||||
[bp appendRoundedRect:frame radius:16];
|
||||
[bp appendBezierPathWithRect:NSMakeRect(0,30,frame.size.width,1)];
|
||||
[bp appendBezierPathWithRect:NSMakeRect(oneQuarter*1,0,1,30)];
|
||||
[bp appendBezierPathWithRect:NSMakeRect(oneQuarter*2,0,1,30)];
|
||||
[bp appendBezierPathWithRect:NSMakeRect(oneQuarter*3,0,1,30)];
|
||||
[bp appendRoundedRect:drawRect radius:16];
|
||||
|
||||
if (segmentCount) {
|
||||
[bp appendBezierPathWithRect:NSMakeRect(0,30,frame.size.width,1)];
|
||||
for (int i = 1; i < segmentCount; i++) {
|
||||
[bp appendBezierPathWithRect:NSMakeRect(oneSegment*i,0,1,30)];
|
||||
}
|
||||
}
|
||||
|
||||
[bp fill];
|
||||
|
||||
NSMutableParagraphStyle* ps = [[NSMutableParagraphStyle alloc] init];
|
||||
|
|
@ -82,7 +99,7 @@
|
|||
NSString* altKeyString = [NSString stringWithUTF8String:"\xe2\x8c\xa5\x01"];
|
||||
NSString* commandKeyString = [NSString stringWithUTF8String:"\xe2\x8c\x98\x01"];
|
||||
NSShadow* shadow = [[NSShadow alloc] init];
|
||||
[shadow setShadowColor:[NSColor blackColor]];
|
||||
[shadow setShadowColor:[ud colorForKey:@"svelte.textShadowColor"]];
|
||||
[shadow setShadowBlurRadius:2];
|
||||
[shadow setShadowOffset:NSMakeSize(2,-2)];
|
||||
|
||||
|
|
@ -93,38 +110,54 @@
|
|||
shadow, NSShadowAttributeName,
|
||||
ps, NSParagraphStyleAttributeName,
|
||||
nil];
|
||||
|
||||
NSColor *inactiveModColor = [ud colorForKey:@"svelte.inactiveModifierColor"];
|
||||
NSColor *activeModColor = [ud colorForKey:@"svelte.activeModifierColor"];
|
||||
|
||||
NSMutableArray<NSAttributedString *> *drawModifiers = [@[] mutableCopy];
|
||||
|
||||
if (_flags & NSEventModifierFlagShift)
|
||||
[attr setObject:[NSColor whiteColor] forKey:NSForegroundColorAttributeName];
|
||||
else
|
||||
[attr setObject:[NSColor colorWithCalibratedWhite:1 alpha:0.5] forKey:NSForegroundColorAttributeName];
|
||||
size = [shiftKeyString sizeWithAttributes:attr];
|
||||
[shiftKeyString drawInRect:NSMakeRect(0,(30 - size.height) / 2.0,oneQuarter,size.height) withAttributes:attr];
|
||||
if (shift) {
|
||||
NSMutableDictionary *tmpAttr = [attr mutableCopy];
|
||||
tmpAttr[NSForegroundColorAttributeName] = (_flags & NSEventModifierFlagShift) ? activeModColor : inactiveModColor;
|
||||
|
||||
NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:shiftKeyString attributes:tmpAttr];
|
||||
[drawModifiers addObject:attrString];
|
||||
}
|
||||
|
||||
if (_flags & NSEventModifierFlagControl)
|
||||
[attr setObject:[NSColor whiteColor] forKey:NSForegroundColorAttributeName];
|
||||
else
|
||||
[attr setObject:[NSColor colorWithCalibratedWhite:1 alpha:0.5] forKey:NSForegroundColorAttributeName];
|
||||
size = [controlKeyString sizeWithAttributes:attr];
|
||||
[controlKeyString drawInRect:NSMakeRect(oneQuarter,(30 - size.height) / 2.0,oneQuarter,size.height) withAttributes:attr];
|
||||
if (control) {
|
||||
NSMutableDictionary *tmpAttr = [attr mutableCopy];
|
||||
tmpAttr[NSForegroundColorAttributeName] = (_flags & NSEventModifierFlagControl) ? activeModColor : inactiveModColor;
|
||||
|
||||
NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:controlKeyString attributes:tmpAttr];
|
||||
[drawModifiers addObject:attrString];
|
||||
}
|
||||
|
||||
if (_flags & NSEventModifierFlagOption)
|
||||
[attr setObject:[NSColor whiteColor] forKey:NSForegroundColorAttributeName];
|
||||
else
|
||||
[attr setObject:[NSColor colorWithCalibratedWhite:1 alpha:0.5] forKey:NSForegroundColorAttributeName];
|
||||
size = [altKeyString sizeWithAttributes:attr];
|
||||
[altKeyString drawInRect:NSMakeRect(oneQuarter*2,(30 - size.height) / 2.0,oneQuarter,size.height) withAttributes:attr];
|
||||
if (option) {
|
||||
NSMutableDictionary *tmpAttr = [attr mutableCopy];
|
||||
tmpAttr[NSForegroundColorAttributeName] = (_flags & NSEventModifierFlagOption) ? activeModColor : inactiveModColor;
|
||||
|
||||
NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:altKeyString attributes:tmpAttr];
|
||||
[drawModifiers addObject:attrString];
|
||||
}
|
||||
|
||||
if (_flags & NSEventModifierFlagCommand)
|
||||
[attr setObject:[NSColor whiteColor] forKey:NSForegroundColorAttributeName];
|
||||
else
|
||||
[attr setObject:[NSColor colorWithCalibratedWhite:1 alpha:0.5] forKey:NSForegroundColorAttributeName];
|
||||
size = [commandKeyString sizeWithAttributes:attr];
|
||||
[commandKeyString drawInRect:NSMakeRect(oneQuarter*3,(30 - size.height) / 2.0,oneQuarter,size.height) withAttributes:attr];
|
||||
|
||||
if (command) {
|
||||
NSMutableDictionary *tmpAttr = [attr mutableCopy];
|
||||
tmpAttr[NSForegroundColorAttributeName] = (_flags & NSEventModifierFlagCommand) ? activeModColor : inactiveModColor;
|
||||
|
||||
NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:commandKeyString attributes:tmpAttr];
|
||||
[drawModifiers addObject:attrString];
|
||||
}
|
||||
|
||||
for (int i = 0; i < [drawModifiers count]; i++) {
|
||||
NSAttributedString *modifierString = drawModifiers[i];
|
||||
NSSize size = [modifierString.string sizeWithAttributes:attr];
|
||||
|
||||
[modifierString drawInRect:NSMakeRect(oneSegment*i,(30 - size.height) / 2.0,oneSegment,size.height)];
|
||||
}
|
||||
|
||||
if (_displayedString != nil)
|
||||
{
|
||||
[attr setObject:[NSColor whiteColor] forKey:NSForegroundColorAttributeName];
|
||||
[attr setObject:[ud colorForKey:@"svelte.textColor"] forKey:NSForegroundColorAttributeName];
|
||||
float fontSize = 48;
|
||||
[attr setObject:[NSFont systemFontOfSize:fontSize] forKey:NSFontAttributeName];
|
||||
|
||||
|
|
@ -259,8 +292,40 @@
|
|||
[_visualizerView noteFlagsChanged:flags];
|
||||
}
|
||||
|
||||
- (IBAction)resetPreferences:(id)sender {
|
||||
[[NSUserDefaults standardUserDefaults] removeObjectsWithPrefix:@"svelte."];
|
||||
}
|
||||
|
||||
+ (NSDictionary<NSString *, NSObject *> *)visualizerDefaults {
|
||||
return @{ @"svelte.displayAll": @YES };
|
||||
return @{
|
||||
@"svelte.display.shift" : @YES,
|
||||
@"svelte.display.control" : @YES,
|
||||
@"svelte.display.option" : @YES,
|
||||
@"svelte.display.command" : @YES,
|
||||
@"svelte.displayAll" : @YES,
|
||||
@"svelte.backgroundColor" : [NSKeyedArchiver
|
||||
archivedDataWithRootObject:[NSColor colorWithCalibratedWhite:0
|
||||
alpha:0.85]
|
||||
requiringSecureCoding:NO
|
||||
error:NULL],
|
||||
@"svelte.textColor" :
|
||||
[NSKeyedArchiver archivedDataWithRootObject:[NSColor whiteColor]
|
||||
requiringSecureCoding:NO
|
||||
error:NULL],
|
||||
@"svelte.textShadowColor" :
|
||||
[NSKeyedArchiver archivedDataWithRootObject:[NSColor blackColor]
|
||||
requiringSecureCoding:NO
|
||||
error:NULL],
|
||||
@"svelte.inactiveModifierColor" : [NSKeyedArchiver
|
||||
archivedDataWithRootObject:[NSColor colorWithCalibratedWhite:1
|
||||
alpha:0.5]
|
||||
requiringSecureCoding:NO
|
||||
error:NULL],
|
||||
@"svelte.activeModifierColor" :
|
||||
[NSKeyedArchiver archivedDataWithRootObject:[NSColor whiteColor]
|
||||
requiringSecureCoding:NO
|
||||
error:NULL],
|
||||
};
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue