Skip to content

Commit

Permalink
Merge pull request #14 from kentya6/v0.5.1
Browse files Browse the repository at this point in the history
v0.5.1
  • Loading branch information
kentya6 authored Jul 15, 2018
2 parents a9cdfcf + 39601cc commit 4e019c8
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 16 deletions.
4 changes: 4 additions & 0 deletions Fuwari.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
BE6D5E771E12CF5E005492B2 /* AboutWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BE6D5E751E12CF5E005492B2 /* AboutWindowController.xib */; };
BE7E825B1DF74A2D00F3F2F8 /* FloatWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE7E825A1DF74A2D00F3F2F8 /* FloatWindow.swift */; };
BE85482020F975E00035BC60 /* NSMenu+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE85481F20F975E00035BC60 /* NSMenu+Extension.swift */; };
BE85482420FB5C640035BC60 /* FloatView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE85482320FB5C640035BC60 /* FloatView.swift */; };
BE9777ED1E0E613700E5934F /* UserDefaults+ArchiveData.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE9777EC1E0E613700E5934F /* UserDefaults+ArchiveData.swift */; };
BE9777EF1E0EB4D900E5934F /* KeyHolder.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE9777EE1E0EB4D900E5934F /* KeyHolder.framework */; };
BE9777F01E0EC24F00E5934F /* ShortcutsPreferenceViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BE9777F21E0EC24F00E5934F /* ShortcutsPreferenceViewController.xib */; };
Expand Down Expand Up @@ -54,6 +55,7 @@
BE6D5E751E12CF5E005492B2 /* AboutWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AboutWindowController.xib; sourceTree = "<group>"; };
BE7E825A1DF74A2D00F3F2F8 /* FloatWindow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FloatWindow.swift; sourceTree = "<group>"; };
BE85481F20F975E00035BC60 /* NSMenu+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSMenu+Extension.swift"; sourceTree = "<group>"; };
BE85482320FB5C640035BC60 /* FloatView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FloatView.swift; sourceTree = "<group>"; };
BE9777EC1E0E613700E5934F /* UserDefaults+ArchiveData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UserDefaults+ArchiveData.swift"; sourceTree = "<group>"; };
BE9777EE1E0EB4D900E5934F /* KeyHolder.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = KeyHolder.framework; path = Carthage/Build/Mac/KeyHolder.framework; sourceTree = "<group>"; };
BE9777F31E0EC25500E5934F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/ShortcutsPreferenceViewController.xib; sourceTree = "<group>"; };
Expand Down Expand Up @@ -128,6 +130,7 @@
BEC844F61DED859300A4A57A /* AppDelegate.swift */,
BEC844F81DED859300A4A57A /* ViewController.swift */,
BE7E825A1DF74A2D00F3F2F8 /* FloatWindow.swift */,
BE85482320FB5C640035BC60 /* FloatView.swift */,
BEAFC2D220E8FC2E00F12911 /* ScreenshotManager.swift */,
BE5BE7A31E065D7800820201 /* HotKeyManager.swift */,
BE9777F71E100D1F00E5934F /* MenuManager.swift */,
Expand Down Expand Up @@ -308,6 +311,7 @@
BE85482020F975E00035BC60 /* NSMenu+Extension.swift in Sources */,
BEF57FEF1DFD58D4006595B6 /* NSColor+Fuwari.swift in Sources */,
BEC844F91DED859300A4A57A /* ViewController.swift in Sources */,
BE85482420FB5C640035BC60 /* FloatView.swift in Sources */,
BE6D5E761E12CF5E005492B2 /* AboutWindowController.swift in Sources */,
BE5BE7A41E065D7800820201 /* HotKeyManager.swift in Sources */,
BE5896A11DFCED26007CE7AC /* LocalizedString.swift in Sources */,
Expand Down
3 changes: 1 addition & 2 deletions Fuwari/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ import Sparkle

@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {

private var eventMonitor: Any?

private let defaults = UserDefaults.standard
private var screenshotManager: ScreenshotManager?

Expand Down
23 changes: 23 additions & 0 deletions Fuwari/FloatView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// FloatView.swift
// Fuwari
//
// Created by Kengo Yokoyama on 2018/07/15.
// Copyright © 2018年 AppKnop. All rights reserved.
//

import Cocoa

class FloatView: NSView {
override func acceptsFirstMouse(for event: NSEvent?) -> Bool {
return true
}

override func mouseDown(with event: NSEvent) {
window?.alphaValue = 0.4
}

override func mouseUp(with event: NSEvent) {
window?.alphaValue = 1.0
}
}
10 changes: 1 addition & 9 deletions Fuwari/FloatWindow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class FloatWindow: NSWindow {

init(contentRect: NSRect, styleMask style: NSWindow.StyleMask = .borderless, backing bufferingType: NSWindow.BackingStoreType = .buffered, defer flag: Bool = false, image: CGImage) {
super.init(contentRect: contentRect, styleMask: style, backing: bufferingType, defer: flag)

contentView = FloatView(frame: contentRect)
originalRect = contentRect
level = .floating
isMovableByWindowBackground = true
Expand Down Expand Up @@ -88,14 +88,6 @@ class FloatWindow: NSWindow {
}
}

override func mouseDown(with event: NSEvent) {
alphaValue = 0.4
}

override func mouseUp(with event: NSEvent) {
alphaValue = 1.0
}

override func rightMouseDown(with event: NSEvent) {
if let menu = menu, let contentView = contentView {
NSMenu.popUpContextMenu(menu, with: event, for: contentView)
Expand Down
4 changes: 2 additions & 2 deletions Fuwari/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.5.0</string>
<string>0.5.1</string>
<key>CFBundleVersion</key>
<string>0.50</string>
<string>0.51</string>
<key>Fabric</key>
<dict>
<key>APIKey</key>
Expand Down
4 changes: 2 additions & 2 deletions Fuwari/MenuManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class MenuManager: NSObject {
}

func udpateCpatureMenuItem() {
statusItem.menu?.items[2].keyEquivalent = HotKeyManager.shared.captureKeyCombo.characters.lowercased()
statusItem.menu?.items[2].keyEquivalentModifierMask = KeyTransformer.cocoaFlags(from: HotKeyManager.shared.captureKeyCombo.modifiers)
captureItem.keyEquivalent = HotKeyManager.shared.captureKeyCombo.characters.lowercased()
captureItem.keyEquivalentModifierMask = KeyTransformer.cocoaFlags(from: HotKeyManager.shared.captureKeyCombo.modifiers)
}
}
4 changes: 3 additions & 1 deletion Fuwari/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ extension ViewController: FloatDelegate {
if !isCancelled {
if windowControllers.filter({ $0 === floatWindow }).first != nil {
floatWindow.fadeWindow(isIn: false) {
floatWindow.close()
guard let index = self.windowControllers.index(where: {$0 === floatWindow}) else { return }
self.windowControllers.remove(at: index)
self.windowControllers.last?.makeKey()
}
}
}
Expand Down

0 comments on commit 4e019c8

Please # to comment.