Skip to content

Commit

Permalink
Version 4.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
daizhirui committed Jul 12, 2019
1 parent f75ed80 commit 33ddfc3
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 14 deletions.
38 changes: 30 additions & 8 deletions macOS/CSXCodeView/CSXCodeView/AutoCompleterView.xib
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14313.18"/>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
Expand All @@ -18,21 +19,21 @@
<rect key="frame" x="0.0" y="0.0" width="300" height="100"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<scrollView fixedFrame="YES" autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="thl-5q-jjg">
<scrollView fixedFrame="YES" borderType="none" autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="thl-5q-jjg">
<rect key="frame" x="0.0" y="0.0" width="300" height="100"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<clipView key="contentView" ambiguous="YES" id="iOM-IR-qQC">
<rect key="frame" x="1" y="1" width="298" height="98"/>
<clipView key="contentView" ambiguous="YES" drawsBackground="NO" id="iOM-IR-qQC">
<rect key="frame" x="0.0" y="0.0" width="300" height="100"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" id="sRX-4A-HgO">
<rect key="frame" x="0.0" y="0.0" width="298" height="98"/>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" typeSelect="NO" rowSizeStyle="automatic" viewBased="YES" id="sRX-4A-HgO">
<rect key="frame" x="0.0" y="0.0" width="300" height="100"/>
<autoresizingMask key="autoresizingMask"/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<tableColumns>
<tableColumn editable="NO" width="295" minWidth="40" maxWidth="1000" id="EA5-9g-sqg">
<tableColumn identifier="autocompletion" editable="NO" width="297" minWidth="40" maxWidth="1000" id="EA5-9g-sqg">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
Expand All @@ -44,10 +45,31 @@
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="Hr5-HJ-kSm">
<rect key="frame" x="1" y="1" width="297" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="EtW-Nt-KCG">
<rect key="frame" x="0.0" y="0.0" width="297" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="rlv-XD-A1o">
<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>
</subviews>
<connections>
<outlet property="textField" destination="EtW-Nt-KCG" id="QFx-CC-EPC"/>
</connections>
</tableCellView>
</prototypeCellViews>
</tableColumn>
</tableColumns>
</tableView>
</subviews>
<nil key="backgroundColor"/>
</clipView>
<scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="XFY-v0-vXR">
<rect key="frame" x="-100" y="-100" width="298" height="16"/>
Expand Down
54 changes: 51 additions & 3 deletions macOS/CSXCodeView/CSXCodeView/AutoCompleterViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,28 @@ class AutoCompleterViewController: NSViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do view setup here.
self.view.wantsLayer = true
self.view.shadow = NSShadow()
self.view.layer?.shadowColor = NSColor.black.cgColor
self.view.layer?.shadowOpacity = 0.8
self.view.layer?.shadowOffset = CGSize(width: 3, height: -3)
self.view.layer?.shadowRadius = 8
self.view.layer?.backgroundColor = NSColor.windowBackgroundColor.cgColor
self.view.layer?.cornerRadius = 5.0

self.tableView.wantsLayer = true
self.tableView.layer?.backgroundColor = NSColor.windowBackgroundColor.cgColor
self.tableView.layer?.cornerRadius = 5.0
self.tableView.backgroundColor = NSColor.clear
self.tableView.dataSource = self
self.tableView.delegate = self
self.tableView.doubleAction = #selector(self.insertSelection)
}

override func updateViewConstraints() {
super.updateViewConstraints()
self.view.layer?.backgroundColor = NSColor.windowBackgroundColor.cgColor
self.tableView.layer?.backgroundColor = NSColor.windowBackgroundColor.cgColor
}

func selectLastPossibleWord() {
Expand All @@ -54,7 +75,7 @@ class AutoCompleterViewController: NSViewController {
}
}

func insertSelection() {
@objc func insertSelection() {
guard let codeView = self.csxCodeView else { return }
if self.tableView.selectedRow >= 0 && self.tableView.selectedRow < self.possibleWords.count {
let selectedWord = self.possibleWords[self.tableView.selectedRow]
Expand Down Expand Up @@ -105,8 +126,8 @@ extension AutoCompleterViewController: AutoCompleterDelegate {
self.view.setFrameOrigin(NSPoint(x: x, y: y))
if let longestWord = self.possibleWords.max(by: {s1, s2 in return s1.count < s2.count}) {
let textSize = longestWord.size(withAttributes: self.tableView.attributedStringValue.attributes(at: 0, effectiveRange: nil))
let width = textSize.width > 300 ? 300 : textSize.width + 20
var height = CGFloat(self.tableView.numberOfRows) * (self.tableView.rowHeight + 2.0)
let width = textSize.width > 600 ? 600 : textSize.width + 20
var height = CGFloat(self.tableView.numberOfRows) * (self.tableView.rowHeight + 3.0)
height = height > 100 ? 100 : height
self.view.setFrameSize(NSSize(width: width, height: height))
}
Expand All @@ -129,3 +150,30 @@ extension AutoCompleterViewController: NSTableViewDataSource {
}
}

extension AutoCompleterViewController: NSTableViewDelegate {
func tableView(_ tableView: NSTableView, heightOfRow row: Int) -> CGFloat {
return 18
}

func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
guard let cellView = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "autocompletion"),
owner: nil) as? NSTableCellView
else { return nil }
guard let textField = cellView.textField else { return nil }
textField.stringValue = self.possibleWords[row]
return cellView
}

func tableView(_ tableView: NSTableView, didClick tableColumn: NSTableColumn) {
self.insertSelection()
}

func tableViewSelectionIsChanging(_ notification: Notification) {
self.tableView.rowView(atRow: self.tableView.selectedRow, makeIfNecessary: false)?.isEmphasized = false
}

func tableViewSelectionDidChange(_ notification: Notification) {
self.tableView.rowView(atRow: self.tableView.selectedRow, makeIfNecessary: false)?.isEmphasized = true
}
}

8 changes: 8 additions & 0 deletions macOS/CSXCodeView/CSXCodeView/CSXCodeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,14 @@ public class CSXCodeView: NSTextView {
}
}
}

public override func mouseDown(with event: NSEvent) {
super.mouseDown(with: event)
if !self.autoCompleterViewController.view.frame.contains(event.locationInWindow) {
self.autoCompleterViewController.hideView()
}

}
}

struct CharacterRegx {
Expand Down
Binary file not shown.
4 changes: 2 additions & 2 deletions macOS/CamelStudioX/CamelStudioX/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>4.1.4</string>
<string>4.1.5</string>
<key>CFBundleVersion</key>
<string>59</string>
<string>60</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.developer-tools</string>
<key>LSMinimumSystemVersion</key>
Expand Down
9 changes: 8 additions & 1 deletion macOS/appcast.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
<title>4.1.4</title>
<pubDate>Fri, 12 Jul 2019 17:26:20 +0800</pubDate>
<sparkle:minimumSystemVersion>10.12.2</sparkle:minimumSystemVersion>
<enclosure url="https://github.com/daizhirui/CamelStudioX/releases/download/v/CamelStudioX_4.1.4_Build59.zip" sparkle:version="59" sparkle:shortVersionString="4.1.4" length="81174892" type="application/octet-stream" sparkle:dsaSignature="MCwCFFkTNywV8KpBhsUywnFI2npLRg2XAhQvcND2m6Dna3oXNIMvm02INxe6QA=="/>
<enclosure url="https://github.com/daizhirui/CamelStudioX/releases/download/v/CamelStudioX_4.1.4_Build59.zip" sparkle:version="59" sparkle:shortVersionString="4.1.4" length="81174892" type="application/octet-stream" sparkle:dsaSignature="MC0CFQC2SRfCS0HxuypZ5WTjcRQ1c9odxwIUB1z6qnrhICa1zRMxjIxEYBfK7hM="/>
</item>
<item>
<title>4.1.5</title>
<pubDate>Sat, 13 Jul 2019 01:46:09 +0800</pubDate>
<sparkle:minimumSystemVersion>10.12.2</sparkle:minimumSystemVersion>
<enclosure url="https://github.com/daizhirui/CamelStudioX/releases/download/v/CamelStudioX_4.1.5_Build60.zip" sparkle:version="60" sparkle:shortVersionString="4.1.5" length="81180211" type="application/octet-stream" sparkle:dsaSignature="MC0CFDc/pncO2e1c/4JHF1163XMJ9E49AhUAvdbt6LNpj9dHBD5JG+xOMA1zvkg="/>
</item>

</channel></rss>

0 comments on commit 33ddfc3

Please sign in to comment.