mirror of
https://github.com/coteditor/CotEditor.git
synced 2024-09-11 11:25:57 +03:00
Improve font field in preferences
This commit is contained in:
parent
259f4de230
commit
685d73814e
@ -13,6 +13,7 @@ develop
|
||||
### Improvements
|
||||
|
||||
- [beta] Add option “Unescape replacement string” to find panel (On by default).
|
||||
- [beta] Improve drawing of font fields in preferences.
|
||||
|
||||
|
||||
### Fixes
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11129.15" systemVersion="15F34" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11201" systemVersion="16A320" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11129.15"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11201"/>
|
||||
<capability name="box content view" minToolsVersion="7.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
@ -37,7 +37,7 @@
|
||||
<constraint firstAttribute="height" constant="22" id="4zH-Fv-QUF"/>
|
||||
<constraint firstAttribute="width" constant="280" id="vyL-3O-dlj"/>
|
||||
</constraints>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="center" title="Font Name 12" drawsBackground="YES" id="3288">
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="center" title="Font Name 12" drawsBackground="YES" id="3288" customClass="CenteringTextFieldCell" customModule="CotEditor" customModuleProvider="target">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
@ -149,7 +149,6 @@
|
||||
</connections>
|
||||
</tableView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</clipView>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="160" id="vKO-UD-LeX"/>
|
||||
@ -242,7 +241,7 @@
|
||||
</menu>
|
||||
</popUpButtonCell>
|
||||
</popUpButton>
|
||||
<box autoresizesSubviews="NO" title="Box" boxType="custom" borderType="line" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="htB-OO-KPY">
|
||||
<box autoresizesSubviews="NO" boxType="custom" borderType="line" title="Box" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="htB-OO-KPY">
|
||||
<rect key="frame" x="188" y="53" width="342" height="291"/>
|
||||
<view key="contentView" id="qHH-O2-P8t">
|
||||
<rect key="frame" x="1" y="1" width="340" height="289"/>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11129.15" systemVersion="15F34" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11201" systemVersion="16A320" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11129.15"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11201"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="PrintPaneController" customModule="CotEditor" customModuleProvider="target">
|
||||
@ -119,7 +119,7 @@
|
||||
<constraint firstAttribute="width" constant="240" id="OeK-6f-UNf"/>
|
||||
<constraint firstAttribute="height" constant="22" id="OfU-j2-cBT"/>
|
||||
</constraints>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="center" title="Font Name 12" drawsBackground="YES" id="3384">
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="center" title="Font Name 12" drawsBackground="YES" id="3384" customClass="CenteringTextFieldCell" customModule="CotEditor" customModuleProvider="target">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
|
@ -110,6 +110,8 @@
|
||||
2A4682B31D2F6B580005410E /* FIleDropComposer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A4682B11D2F6B580005410E /* FIleDropComposer.swift */; };
|
||||
2A476CAE1D09C8C80088E37A /* URLExtensionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A476CAD1D09C8C80088E37A /* URLExtensionsTests.swift */; };
|
||||
2A476CB11D09D0500088E37A /* FontExtensionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A476CB01D09D0500088E37A /* FontExtensionTests.swift */; };
|
||||
2A479C821D8C15A600EEEFC2 /* CenteringTextFieldCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A479C811D8C15A600EEEFC2 /* CenteringTextFieldCell.swift */; };
|
||||
2A479C831D8C15A600EEEFC2 /* CenteringTextFieldCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A479C811D8C15A600EEEFC2 /* CenteringTextFieldCell.swift */; };
|
||||
2A48103E1D4D210300F7D34C /* Crypto.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A48103D1D4D210300F7D34C /* Crypto.swift */; };
|
||||
2A48103F1D4D210300F7D34C /* Crypto.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A48103D1D4D210300F7D34C /* Crypto.swift */; };
|
||||
2A4CB9921D79F38A000D6ADA /* DocumentToolbar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A4CB9911D79F38A000D6ADA /* DocumentToolbar.swift */; };
|
||||
@ -640,6 +642,7 @@
|
||||
2A4682B11D2F6B580005410E /* FIleDropComposer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FIleDropComposer.swift; sourceTree = "<group>"; };
|
||||
2A476CAD1D09C8C80088E37A /* URLExtensionsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = URLExtensionsTests.swift; sourceTree = "<group>"; };
|
||||
2A476CB01D09D0500088E37A /* FontExtensionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FontExtensionTests.swift; sourceTree = "<group>"; };
|
||||
2A479C811D8C15A600EEEFC2 /* CenteringTextFieldCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CenteringTextFieldCell.swift; sourceTree = "<group>"; };
|
||||
2A4810391D4D1ADF00F7D34C /* ColorCode.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ColorCode.framework; path = ../Carthage/Build/Mac/ColorCode.framework; sourceTree = "<group>"; };
|
||||
2A48103D1D4D210300F7D34C /* Crypto.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Crypto.swift; sourceTree = "<group>"; };
|
||||
2A4CB9911D79F38A000D6ADA /* DocumentToolbar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DocumentToolbar.swift; sourceTree = "<group>"; };
|
||||
@ -1145,6 +1148,7 @@
|
||||
2ACDC0991D172CDE009B72D6 /* AntialiasingTextField.swift */,
|
||||
2A5DCE4E1D185F1B00D5D74C /* CharacterField.swift */,
|
||||
2ACDC0931D1727D9009B72D6 /* OutlineMenuButtonCell.swift */,
|
||||
2A479C811D8C15A600EEEFC2 /* CenteringTextFieldCell.swift */,
|
||||
2ACDC0961D172B2A009B72D6 /* PaddingTextFieldCell.swift */,
|
||||
2A12C7FE1D1843B50069C60B /* SeparatorTextFieldCell.swift */,
|
||||
);
|
||||
@ -2123,6 +2127,7 @@
|
||||
2A9082EA1D32539A00228F50 /* EditorTextView+Scaling.swift in Sources */,
|
||||
2A64F2491D26327C001B229F /* KeyBindingManager.swift in Sources */,
|
||||
2A33D0821D1C7935005977B9 /* SyntaxTermsEditViewController.swift in Sources */,
|
||||
2A479C831D8C15A600EEEFC2 /* CenteringTextFieldCell.swift in Sources */,
|
||||
2AAD61ED1D2A4CE5008FE772 /* Shortcut.swift in Sources */,
|
||||
2A6416A41D2F9F7200FA9E1A /* LineNumberView.swift in Sources */,
|
||||
2AA45A4F1D2E8EE700A1A401 /* EditorScrollView.swift in Sources */,
|
||||
@ -2265,6 +2270,7 @@
|
||||
2A12C7FF1D1843B50069C60B /* SeparatorTextFieldCell.swift in Sources */,
|
||||
2AD7B9AF1D3E832E00E5D6D7 /* DocumentAnalyzer.swift in Sources */,
|
||||
2A6FD9EA1D3A819500A59784 /* EditorTextView+Commenting.swift in Sources */,
|
||||
2A479C821D8C15A600EEEFC2 /* CenteringTextFieldCell.swift in Sources */,
|
||||
2AFB5AE81D597ABB003895A7 /* DefaultEncodings.swift in Sources */,
|
||||
2A33D07E1D1C75B8005977B9 /* SyntaxValidationViewController.swift in Sources */,
|
||||
2A4CB9921D79F38A000D6ADA /* DocumentToolbar.swift in Sources */,
|
||||
|
@ -31,7 +31,12 @@ final class AntialiasingTextField: NSTextField {
|
||||
|
||||
// MARK: Public Properties
|
||||
|
||||
var disablesAntialiasing = false
|
||||
var disablesAntialiasing = false {
|
||||
|
||||
didSet {
|
||||
self.needsDisplay = true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
51
CotEditor/Sources/CenteringTextFieldCell.swift
Normal file
51
CotEditor/Sources/CenteringTextFieldCell.swift
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
|
||||
CenteringTextFieldCell.swift
|
||||
|
||||
CotEditor
|
||||
https://coteditor.com
|
||||
|
||||
Created by 1024jp on 2016-09-16.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
© 2016 1024jp
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
*/
|
||||
|
||||
import Cocoa
|
||||
|
||||
final class CenteringTextFieldCell: NSTextFieldCell {
|
||||
|
||||
/// rect of content text
|
||||
override func titleRect(forBounds rect: NSRect) -> NSRect {
|
||||
|
||||
var titleRect = super.titleRect(forBounds: rect)
|
||||
let titleSize = self.attributedStringValue.size()
|
||||
|
||||
titleRect.origin.y = floor(rect.minY + (rect.height - titleSize.height) / 2)
|
||||
titleRect.size.height = rect.height - titleRect.origin.y
|
||||
|
||||
return titleRect
|
||||
}
|
||||
|
||||
|
||||
/// draw inside of field
|
||||
override func drawInterior(withFrame cellFrame: NSRect, in controlView: NSView) {
|
||||
|
||||
self.attributedStringValue.draw(in: self.titleRect(forBounds: cellFrame))
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user