forked from qfish/XAlign
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add shortcut setting, rock & roll ~~~
- Loading branch information
Showing
17 changed files
with
495 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,5 +17,6 @@ | |
|
||
- (IBAction)format:(id)sender; | ||
- (IBAction)selectFormatter:(id)sender; | ||
- (IBAction)showSetting:(id)sender; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// SettingWindowController.h | ||
// XAlign | ||
// | ||
// Created by QFish on 12/3/13. | ||
// Copyright (c) 2013 net.qfish. All rights reserved. | ||
// | ||
|
||
#import <Cocoa/Cocoa.h> | ||
|
||
@interface SettingWindowController : NSWindowController<NSTextFieldDelegate> | ||
|
||
@property (nonatomic, strong) IBOutlet NSTextField * key; | ||
@property (nonatomic, strong) IBOutlet NSTextField * mask; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// | ||
// SettingWindowController.m | ||
// XAlign | ||
// | ||
// Created by QFish on 12/3/13. | ||
// Copyright (c) 2013 net.qfish. All rights reserved. | ||
// | ||
|
||
//#import "XAlignPluginConfig.h" | ||
#import "SettingWindowController.h" | ||
|
||
@interface SettingWindowController () | ||
|
||
@end | ||
|
||
@implementation SettingWindowController | ||
|
||
- (BOOL)control:(NSControl *)control textShouldEndEditing:(NSText *)fieldEditor | ||
{ | ||
NSLog( @"\ntextShouldEndEditing:%@", fieldEditor.string ); | ||
|
||
return YES; | ||
} | ||
|
||
- (void)windowDidLoad | ||
{ | ||
[super windowDidLoad]; | ||
// | ||
// NSDictionary * shortcut = [XAlignPluginConfig keyShortcut]; | ||
|
||
// self.key.stringValue = shortcut[kMenuShortcutKey]; | ||
// self.mask.stringValue = shortcut[kMenuShortcutMask]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="4511" systemVersion="13A603" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES"> | ||
<dependencies> | ||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="4511"/> | ||
</dependencies> | ||
<objects> | ||
<customObject id="-2" userLabel="File's Owner" customClass="SettingWindowController"> | ||
<connections> | ||
<outlet property="key" destination="p5K-Et-nA0" id="lQT-oo-2qd"/> | ||
<outlet property="mask" destination="ghy-uR-ecW" id="PCL-5X-ou1"/> | ||
<outlet property="window" destination="1" id="3"/> | ||
</connections> | ||
</customObject> | ||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/> | ||
<customObject id="-3" userLabel="Application"/> | ||
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" wantsToBeColor="NO" animationBehavior="default" id="1"> | ||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/> | ||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/> | ||
<rect key="contentRect" x="196" y="240" width="347" height="138"/> | ||
<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="347" height="138"/> | ||
<autoresizingMask key="autoresizingMask"/> | ||
<subviews> | ||
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ghy-uR-ecW"> | ||
<rect key="frame" x="73" y="101" width="173" height="22"/> | ||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> | ||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="center" placeholderString="[ cmd | shift | ctrl | alt ]" drawsBackground="YES" id="McV-xA-DNJ"> | ||
<font key="font" metaFont="system"/> | ||
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/> | ||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> | ||
</textFieldCell> | ||
<connections> | ||
<outlet property="delegate" destination="-2" id="hPS-nD-AvX"/> | ||
</connections> | ||
</textField> | ||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="hHx-7U-Kg1"> | ||
<rect key="frame" x="4" y="104" width="66" height="17"/> | ||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> | ||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Shortcut :" id="EBz-hG-EqB"> | ||
<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 horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Jya-9H-Yhn"> | ||
<rect key="frame" x="251" y="104" width="15" height="17"/> | ||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> | ||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="+" id="YGg-1K-Rpw"> | ||
<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" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="p5K-Et-nA0"> | ||
<rect key="frame" x="270" y="101" width="68" height="22"/> | ||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> | ||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="center" placeholderString="[a-z]" drawsBackground="YES" id="kdW-x6-djU"> | ||
<font key="font" metaFont="system"/> | ||
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/> | ||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> | ||
</textFieldCell> | ||
<connections> | ||
<outlet property="delegate" destination="-2" id="yyr-Lc-5fV"/> | ||
</connections> | ||
</textField> | ||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="pjR-TN-4Pk"> | ||
<rect key="frame" x="5" y="4" width="337" height="82"/> | ||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> | ||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="left" id="7hp-yr-uaj"> | ||
<font key="font" metaFont="system"/> | ||
<string key="title">1. cmd, ctrl, shift, alt connected with '+' or '-' 2. if dosen't work, it may conflict with Xcode default. please check the keybinds of Xcode. 3. enter return to apply</string> | ||
<color key="textColor" white="0.0" alpha="0.67000000000000004" colorSpace="deviceWhite"/> | ||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> | ||
</textFieldCell> | ||
</textField> | ||
</subviews> | ||
</view> | ||
<connections> | ||
<outlet property="delegate" destination="-2" id="4"/> | ||
</connections> | ||
</window> | ||
</objects> | ||
</document> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// SettingWindowController.h | ||
// XAlign | ||
// | ||
// Created by QFish on 12/3/13. | ||
// Copyright (c) 2013 net.qfish. All rights reserved. | ||
// | ||
|
||
#import <Cocoa/Cocoa.h> | ||
|
||
@interface SettingWindowController : NSWindowController<NSTextFieldDelegate> | ||
|
||
@property (nonatomic, strong) IBOutlet NSTextField * key; | ||
@property (nonatomic, strong) IBOutlet NSTextField * mask; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// | ||
// SettingWindowController.m | ||
// XAlign | ||
// | ||
// Created by QFish on 12/3/13. | ||
// Copyright (c) 2013 net.qfish. All rights reserved. | ||
// | ||
|
||
#import "XAlignPluginConfig.h" | ||
#import "SettingWindowController.h" | ||
|
||
@interface SettingWindowController () | ||
|
||
@end | ||
|
||
@implementation SettingWindowController | ||
|
||
- (BOOL)control:(NSControl *)control textShouldEndEditing:(NSText *)fieldEditor | ||
{ | ||
NSString * key = self.key.stringValue; | ||
NSString * mask = self.mask.stringValue; | ||
|
||
if ( key && mask ) | ||
{ | ||
NSDictionary * shortcut = @{ @"mask": mask, @"key": key }; | ||
[XAlignPluginConfig setKeyShortcut:shortcut]; | ||
} | ||
|
||
return YES; | ||
} | ||
|
||
- (void)windowDidLoad | ||
{ | ||
[super windowDidLoad]; | ||
|
||
NSDictionary * shortcut = [XAlignPluginConfig keyShortcut]; | ||
|
||
self.key.stringValue = shortcut[kMenuShortcutKey]; | ||
self.mask.stringValue = shortcut[kMenuShortcutMask]; | ||
} | ||
|
||
@end |
Oops, something went wrong.