Add bezelwidth option to default visualizer

This commit is contained in:
Park Hyunwoo 2014-06-19 15:56:01 +09:00
parent 98b9fd8582
commit ddf8ed8f77
3 changed files with 63 additions and 23 deletions

View file

@ -31,6 +31,7 @@
#import "KCKeystrokeTransformer.h"
@implementation KCDefaultVisualizerFactory
-(NSString*) visualizerNibName
@ -80,7 +81,7 @@
{
if (visualizerWindow == nil)
{
NSRect frameRect = NSMakeRect(0,100,200,100);
NSRect frameRect = NSMakeRect(0,100,1600,100);
visualizerWindow = [[[KCDefaultVisualizerWindow alloc]
initWithContentRect:frameRect
styleMask:NSBorderlessWindowMask
@ -147,7 +148,7 @@
NSScreen *screen = [NSScreen mainScreen];
NSRect screenFrame = [screen frame];
NSRect frame = NSMakeRect(screenFrame.size.width-210, 10, contentRect.size.width, contentRect.size.height);
NSRect frame = NSMakeRect(screenFrame.size.width-contentRect.size.width-10, 10, contentRect.size.width, contentRect.size.height);
[self setFrame:frame display:NO];
[self setFrameUsingName:@"KCBezelWindow default.bezelWindow"];
@ -200,7 +201,8 @@
{
NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults];
NSRect frame = [self frame];
CGFloat maxWidth = frame.size.width;
CGFloat maxWidth = [[NSUserDefaults standardUserDefaults] floatForKey:@"default.bezelWidth"];
if (!(maxWidth > 0)) {
NSLog(@"Fixing frame; width not greater than 0: %@", NSStringFromRect(frame));
maxWidth = 200;

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13C64" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6154.17" systemVersion="14A238x" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<deployment version="1050" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5056"/>
<deployment version="1050" defaultVersion="101000" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6154.17"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="KCVisualizer">
@ -13,7 +13,7 @@
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application"/>
<customView id="1" userLabel="Preferences">
<rect key="frame" x="0.0" y="0.0" width="381" height="316"/>
<rect key="frame" x="0.0" y="-7" width="381" height="366"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<button id="56">
@ -37,7 +37,7 @@
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" id="52">
<rect key="frame" x="26" y="254" width="112" height="24"/>
<rect key="frame" x="26" y="304" width="112" height="24"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" controlSize="mini" sendsActionOnEndEditing="YES" alignment="right" title="Size of the keystrokes on the bezel." id="121">
<font key="font" metaFont="miniSystem"/>
@ -64,7 +64,7 @@
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" id="44">
<rect key="frame" x="310" y="117" width="54" height="11"/>
<rect key="frame" x="310" y="176" width="54" height="11"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" controlSize="mini" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Fast-ish" id="118">
<font key="font" metaFont="miniSystem"/>
@ -100,15 +100,6 @@
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" id="37">
<rect key="frame" x="326" y="166" width="38" height="11"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" controlSize="mini" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Long" id="114">
<font key="font" metaFont="miniSystem"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<slider verticalHuggingPriority="750" id="36">
<rect key="frame" x="146" y="180" width="215" height="15"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
@ -148,7 +139,7 @@
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" id="28">
<rect key="frame" x="291" y="267" width="73" height="11"/>
<rect key="frame" x="291" y="317" width="73" height="11"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" controlSize="mini" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Huge" id="109">
<font key="font" metaFont="miniSystem"/>
@ -157,7 +148,7 @@
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" id="26">
<rect key="frame" x="143" y="267" width="38" height="11"/>
<rect key="frame" x="143" y="317" width="38" height="11"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" controlSize="mini" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Tiny" id="108">
<font key="font" metaFont="miniSystem"/>
@ -166,9 +157,9 @@
</textFieldCell>
</textField>
<slider verticalHuggingPriority="750" id="24">
<rect key="frame" x="146" y="279" width="215" height="15"/>
<rect key="frame" x="146" y="329" width="215" height="15"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<sliderCell key="cell" controlSize="small" alignment="left" minValue="8" maxValue="144" doubleValue="14.510000050067902" tickMarkPosition="above" sliderType="linear" id="107">
<sliderCell key="cell" controlSize="small" alignment="left" minValue="8" maxValue="288" doubleValue="16" tickMarkPosition="above" sliderType="linear" id="107">
<font key="font" metaFont="smallSystem"/>
</sliderCell>
<connections>
@ -203,7 +194,7 @@
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" id="16">
<rect key="frame" x="17" y="279" width="124" height="17"/>
<rect key="frame" x="17" y="329" width="124" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Font Size:" id="103">
<font key="font" metaFont="system"/>
@ -211,6 +202,52 @@
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField appearanceType="aqua" verticalHuggingPriority="750" id="Pug-Xz-vEP">
<rect key="frame" x="27" y="254" width="112" height="24"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" controlSize="mini" sendsActionOnEndEditing="YES" alignment="right" title="Max width of bezel" id="Xio-vD-4JQ">
<font key="font" metaFont="miniSystem"/>
<color key="textColor" name="disabledControlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField appearanceType="aqua" verticalHuggingPriority="750" id="bef-A0-P3p">
<rect key="frame" x="292" y="267" width="73" height="11"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" controlSize="mini" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Huge" id="aIR-GJ-Npe">
<font key="font" metaFont="miniSystem"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField appearanceType="aqua" verticalHuggingPriority="750" id="QSY-6s-lpa">
<rect key="frame" x="144" y="267" width="38" height="11"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" controlSize="mini" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Tiny" id="eP3-rd-XAD">
<font key="font" metaFont="miniSystem"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<slider appearanceType="aqua" verticalHuggingPriority="750" id="mj4-eu-4tj">
<rect key="frame" x="147" y="279" width="215" height="15"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<sliderCell key="cell" controlSize="small" alignment="left" minValue="100" maxValue="1600" doubleValue="200" tickMarkPosition="above" sliderType="linear" id="4KJ-vQ-5gh">
<font key="font" metaFont="smallSystem"/>
</sliderCell>
<connections>
<binding destination="9" name="value" keyPath="values.default.bezelWidth" id="EJC-Bu-YgJ"/>
</connections>
</slider>
<textField appearanceType="aqua" verticalHuggingPriority="750" id="gvU-Tn-znw">
<rect key="frame" x="18" y="279" width="124" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Bezel Width:" id="flo-yf-GNO">
<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>
<textField verticalHuggingPriority="750" id="14">
<rect key="frame" x="17" y="45" width="124" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
@ -254,6 +291,7 @@
</textFieldCell>
</textField>
</subviews>
<point key="canvasLocation" x="290.5" y="299"/>
</customView>
<userDefaultsController representsSharedInstance="YES" id="9" userLabel="Shared User Defaults Controller"/>
</objects>

Binary file not shown.