Skip to content

Commit

Permalink
Merge branch 'release/V1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
uclort committed Dec 31, 2019
2 parents 7d37803 + 2748fb6 commit 5a0b166
Show file tree
Hide file tree
Showing 58 changed files with 2,755 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
@@ -0,0 +1,4 @@
Pods
Podfile.lock
OpenFile.xcworkspace/xcuserdata/HouMeng.xcuserdatad/UserInterfaceState.xcuserstate
*.xcuserstate
577 changes: 577 additions & 0 deletions OpenFile.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid = "6EAADDEA-4FAD-4347-B5F2-82AE5C062ED5"
type = "0"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "2B90020E-FBA7-44EA-99A5-E36C1A6E3D52"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "../OpenFile/Popover/HmPopoverController.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "76"
endingLineNumber = "76"
landmarkName = "collectionView(_:itemForRepresentedObjectAt:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>OpenFile.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>5</integer>
</dict>
</dict>
</dict>
</plist>
10 changes: 10 additions & 0 deletions OpenFile.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions OpenFile.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid = "6F75D40C-F9AF-4DB0-9EDD-B979816E181D"
type = "0"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
<BreakpointContent
uuid = "1DEDB4FE-A068-40FC-8047-D01B3D72D324"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
scope = "1"
stopOnStyle = "0">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
24 changes: 24 additions & 0 deletions OpenFile/AppDelegate.swift
@@ -0,0 +1,24 @@
//
// AppDelegate.swift
// OpenFile
//
// Created by 侯猛 on 2019/12/23.
// Copyright © 2019 侯猛. All rights reserved.
//

import Cocoa

@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {

func applicationDidFinishLaunching(_ aNotification: Notification) {
// Insert code here to initialize your application
}

func applicationWillTerminate(_ aNotification: Notification) {
// Insert code here to tear down your application
}


}

68 changes: 68 additions & 0 deletions OpenFile/Assets.xcassets/AppIcon.appiconset/Contents.json
@@ -0,0 +1,68 @@
{
"images" : [
{
"size" : "16x16",
"idiom" : "mac",
"filename" : "mac-16x16.png",
"scale" : "1x"
},
{
"size" : "16x16",
"idiom" : "mac",
"filename" : "mac-16x16@2x.png",
"scale" : "2x"
},
{
"size" : "32x32",
"idiom" : "mac",
"filename" : "mac-32x32.png",
"scale" : "1x"
},
{
"size" : "32x32",
"idiom" : "mac",
"filename" : "mac-32x32@2x.png",
"scale" : "2x"
},
{
"size" : "128x128",
"idiom" : "mac",
"filename" : "mac-128x128.png",
"scale" : "1x"
},
{
"size" : "128x128",
"idiom" : "mac",
"filename" : "mac-128x128@2x.png",
"scale" : "2x"
},
{
"size" : "256x256",
"idiom" : "mac",
"filename" : "mac-256x256.png",
"scale" : "1x"
},
{
"size" : "256x256",
"idiom" : "mac",
"filename" : "mac-256x256@2x.png",
"scale" : "2x"
},
{
"size" : "512x512",
"idiom" : "mac",
"filename" : "mac-512x512.png",
"scale" : "1x"
},
{
"size" : "512x512",
"idiom" : "mac",
"filename" : "mac-512x512@2x.png",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions OpenFile/Assets.xcassets/Contents.json
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
26 changes: 26 additions & 0 deletions OpenFile/Assets.xcassets/StatusBar.imageset/Contents.json
@@ -0,0 +1,26 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "StatusBar.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "StatusBar@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "StatusBar@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
90 changes: 90 additions & 0 deletions OpenFile/CustomControl/HmButton.swift
@@ -0,0 +1,90 @@
//
// HmButton.swift
// OpenFile
//
// Created by 侯猛 on 2019/12/27.
// Copyright © 2019 侯猛. All rights reserved.
//

import Cocoa

enum MouseType {
case leftDown
case leftUp
case rightDown
case rightUp
case entered
case exited
}

class HmButton: NSButton {

private var trackingArea: NSTrackingArea?

var mouseClickTypeHandler: ((MouseType) -> Void)?

override func updateTrackingAreas() {
super.updateTrackingAreas()
removeTrackingArea()
let options : NSTrackingArea.Options = [.mouseEnteredAndExited, .activeInKeyWindow]
let newBounds = NSRect(x: 5, y: 5, width: bounds.width - 10, height: bounds.height - 10)
trackingArea = NSTrackingArea(rect: newBounds, options: options, owner: self, userInfo: nil)
addTrackingArea(trackingArea!)

guard var mouseLocation = window?.mouseLocationOutsideOfEventStream else {
return
}
mouseLocation = convert(mouseLocation, from: nil)
if NSPointInRect(mouseLocation, bounds) {
mouseEntered(with: NSEvent())
} else {
mouseExited(with: NSEvent())
}
}

private func removeTrackingArea() {
if trackingArea != nil {
removeTrackingArea(trackingArea!)
}
}

override func draw(_ dirtyRect: NSRect) {
super.draw(dirtyRect)

// Drawing code here.
}

override func mouseDown(with event: NSEvent) {
// super.mouseDown(with: event)
mouseClickTypeHandler?(.leftDown)
}

override func mouseUp(with event: NSEvent) {
// super.mouseUp(with: event)
mouseClickTypeHandler?(.leftUp)
}

override func rightMouseDown(with event: NSEvent) {
super.rightMouseDown(with: event)
mouseClickTypeHandler?(.rightDown)
}

override func rightMouseUp(with event: NSEvent) {
// super.rightMouseUp(with: event)
mouseClickTypeHandler?(.rightUp)
}

override func mouseEntered(with event: NSEvent) {
// super.mouseEntered(with: event)
mouseClickTypeHandler?(.entered)
}

override func mouseExited(with event: NSEvent) {
// super.mouseExited(with: event)
mouseClickTypeHandler?(.exited)
}




}
54 changes: 54 additions & 0 deletions OpenFile/CustomControl/HmLabel.swift
@@ -0,0 +1,54 @@
//
// HistoryThumbnailLabel.swift
// uPic
//
// Created by 侯猛 on 2019/11/26.
// Copyright © 2019 Svend Jin. All rights reserved.
//

import Cocoa

class HmLabel: NSTextField {

private var oldStringValue: String?

private var oldTextColor: NSColor?

override func awakeFromNib() {
super.awakeFromNib()
initializeView()
}

func initializeView() {
oldStringValue = stringValue
oldTextColor = textColor
cell = VerticalCenteringCell()
backgroundColor = .clear
canDrawSubviewsIntoLayer = true
alignment = .center
isEditable = false
stringValue = oldStringValue ?? ""
textColor = oldTextColor
oldStringValue = nil
oldTextColor = nil
}

}


class VerticalCenteringCell: NSTextFieldCell {
override func titleRect(forBounds rect: NSRect) -> NSRect {
var rect = super.titleRect(forBounds: rect)
rect.origin.y += (rect.height - cellSize.height) / 2
return rect
}

override func drawInterior(withFrame cellFrame: NSRect, in controlView: NSView) {
super.drawInterior(withFrame: titleRect(forBounds: cellFrame), in: controlView)
}

override func select(withFrame rect: NSRect, in controlView: NSView, editor textObj: NSText, delegate: Any?, start selStart: Int, length selLength: Int) {
super.select(withFrame: titleRect(forBounds: rect), in: controlView, editor: textObj, delegate: delegate, start: selStart, length: selLength)
}

}

0 comments on commit 5a0b166

Please sign in to comment.