mirror of
https://github.com/qvacua/vimr.git
synced 2024-11-28 11:35:35 +03:00
GH-314 Merge branch '314-mapping' into develop
This commit is contained in:
commit
d246b60f82
1
Cartfile
1
Cartfile
@ -10,5 +10,6 @@ github "sindresorhus/github-markdown-css" == 3.0.1
|
||||
github "httpswift/swifter" == 1.4.5
|
||||
github "a2/MessagePack.swift" == 3.0.0
|
||||
github "elegantchaos/DictionaryCoding" == 1.0.6
|
||||
github "qvacua/ShortcutRecorder" "store-empty"
|
||||
|
||||
github "Quick/Nimble" == 7.3.4
|
||||
|
@ -11,5 +11,6 @@ github "qvacua/CocoaMarkdown" "7756ad96d5fb390c66531004868e828bb54d3609"
|
||||
github "qvacua/RxMessagePort" "v0.0.5"
|
||||
github "qvacua/RxMsgpackRpc" "v0.0.7"
|
||||
github "qvacua/RxNeovimApi" "0.3.4"
|
||||
github "qvacua/ShortcutRecorder" "ce38019d6c44e8ab46f462c279e5b42b1b92d491"
|
||||
github "sindresorhus/github-markdown-css" "v3.0.1"
|
||||
github "sparkle-project/Sparkle" "1.21.3"
|
||||
|
@ -7,14 +7,17 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
1929B0244BD7111E168726CF /* DefaultShortcuts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B93256AF7F9137223E36 /* DefaultShortcuts.swift */; };
|
||||
1929B04CE8ECBD75CBBB0991 /* StringCommonsTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B5D45C9792BBE76B8AFF /* StringCommonsTest.swift */; };
|
||||
1929B05B9D664052EC2D23EF /* FileOutlineView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929BCE3E156C06EDF1F2806 /* FileOutlineView.swift */; };
|
||||
1929B08C6230B9C5AB72DAF1 /* Pref128ToCurrentConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B5046239709E33516F5C /* Pref128ToCurrentConverter.swift */; };
|
||||
1929B0C7150100A84FBDB8BF /* ShortcutItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929BF230875DED6CD7AB3EB /* ShortcutItem.swift */; };
|
||||
1929B0E0C3BC59F52713D5A2 /* FoundationCommons.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B9AF20D7BD6E5C975128 /* FoundationCommons.swift */; };
|
||||
1929B0F599D1F62C7BE53D2C /* HttpServerMiddleware.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B1DC584C89C477E83FA2 /* HttpServerMiddleware.swift */; };
|
||||
1929B1837C750CADB3A5BCB9 /* OpenQuicklyFileViewRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B1558455B3A74D93EF2A /* OpenQuicklyFileViewRow.swift */; };
|
||||
1929B20CE35B43BB1CE023BA /* Theme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929BC2F05E9A5C0DB039739 /* Theme.swift */; };
|
||||
1929B29B95AD176D57942E08 /* UiRootReducer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B457B9D0FA4D21F3751E /* UiRootReducer.swift */; };
|
||||
1929B2D56C4652E251C23AD4 /* DefaultShortcuts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B93256AF7F9137223E36 /* DefaultShortcuts.swift */; };
|
||||
1929B3217A7A3D79E28C80DB /* PrefWindowReducer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B49E6924847AD085C8C9 /* PrefWindowReducer.swift */; };
|
||||
1929B333855A5406C400DA92 /* OpenQuicklyFilterOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929BEDE7F92BC7B49E802AF /* OpenQuicklyFilterOperation.swift */; };
|
||||
1929B3557317755A43513B17 /* OpenQuicklyWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B71A92C24FEFE79A851E /* OpenQuicklyWindow.swift */; };
|
||||
@ -54,6 +57,7 @@
|
||||
1929B94083273D4B321AD848 /* FileItemUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B56C8ED31834BA9D8543 /* FileItemUtils.swift */; };
|
||||
1929B98F94536E3912AD9F3B /* ArrayCommonsTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929BAF13FAD5DA8D3762367 /* ArrayCommonsTest.swift */; };
|
||||
1929B990A143763A56CFCED0 /* PrefMiddleware.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B364460D86F17E80943C /* PrefMiddleware.swift */; };
|
||||
1929BA269EBD68251410A08E /* ShortcutsTableSubviews.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B07F0085B7AE10413346 /* ShortcutsTableSubviews.swift */; };
|
||||
1929BA715337FE26155B2071 /* BufferList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929BA43449BA41666CD55ED /* BufferList.swift */; };
|
||||
1929BA76A1D97D8226F7CFB1 /* Debouncer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B6AD3396160AA2C46919 /* Debouncer.swift */; };
|
||||
1929BAAD7336FDFF1F78E749 /* ScorerTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929BF69B01107F358CF7EAD /* ScorerTest.swift */; };
|
||||
@ -61,13 +65,16 @@
|
||||
1929BAFF1E011321D3186EE6 /* UiRoot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929BD4149D5A25C82064DD8 /* UiRoot.swift */; };
|
||||
1929BB4A9B2FA42A64CCCC76 /* MainWindowReducer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929BD83A13BF133741766CC /* MainWindowReducer.swift */; };
|
||||
1929BB67CAAD4F6CBD38DF0A /* RxRedux.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B66A5E2D00EA143AFD86 /* RxRedux.swift */; };
|
||||
1929BB85B2D30E548A32663D /* ShortcutsPref.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B0E9B2F018D3E31D4B0B /* ShortcutsPref.swift */; };
|
||||
1929BBE28654E4307AF1E2FD /* Theme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929BC2F05E9A5C0DB039739 /* Theme.swift */; };
|
||||
1929BC682EA78BF50D1E0890 /* ShortcutsTableSubviews.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B07F0085B7AE10413346 /* ShortcutsTableSubviews.swift */; };
|
||||
1929BCC7908DD899999B70BE /* AppearancePrefReducer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929BED01F5D94BFCA4CF80F /* AppearancePrefReducer.swift */; };
|
||||
1929BCC9D3604933DFF07E2E /* FileBrowser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929BA5C7099CDEB04B76BA4 /* FileBrowser.swift */; };
|
||||
1929BCF7F7B9CC5499A3F506 /* AdvancedPrefReducer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B7039C5689CE45F53888 /* AdvancedPrefReducer.swift */; };
|
||||
1929BD2F41D93ADFF43C1C98 /* NetUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 1929B02440BC99C42F9EBD45 /* NetUtils.m */; };
|
||||
1929BD3878A3A47B8D685CD2 /* AppDelegateReducer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B7A68B7109CEFAF105E8 /* AppDelegateReducer.swift */; };
|
||||
1929BD3F9E609BFADB27584B /* Scorer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B9D510177918080BE39B /* Scorer.swift */; };
|
||||
1929BDC69A5F9D1661423488 /* ShortcutItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929BF230875DED6CD7AB3EB /* ShortcutItem.swift */; };
|
||||
1929BDFDBDA7180D02ACB37E /* RxSwiftCommonsTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B6C215ACCBE12672A8D7 /* RxSwiftCommonsTest.swift */; };
|
||||
1929BE0DAEE9664C5BCFA211 /* States.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929BB6608B4F0E037CA0F4C /* States.swift */; };
|
||||
1929BE0F64A6CE5BCE2A5092 /* MainWindow+Delegates.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B714EB137AE448CE8ABD /* MainWindow+Delegates.swift */; };
|
||||
@ -194,6 +201,9 @@
|
||||
4BDA50B52160BE76004D10A9 /* Socket.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4B0A1AA72120C35100F1E02F /* Socket.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
4BDF500C1D760A3500D8FBC3 /* FileUtilsTest in Resources */ = {isa = PBXBuildFile; fileRef = 4BDF500B1D760A3500D8FBC3 /* FileUtilsTest */; };
|
||||
4BDF50171D77540900D8FBC3 /* OpenQuicklyWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4BDF50191D77540900D8FBC3 /* OpenQuicklyWindow.xib */; };
|
||||
4BE34B832225BAC7002F57D3 /* ShortcutRecorder.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BE34B822225BAC7002F57D3 /* ShortcutRecorder.framework */; };
|
||||
4BE34B842225BAD2002F57D3 /* ShortcutRecorder.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 4BE34B822225BAC7002F57D3 /* ShortcutRecorder.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
4BE34B852225BB56002F57D3 /* RxNeovimApi.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B17E54C209E3EA400265C1D /* RxNeovimApi.framework */; };
|
||||
4BE45C1D1FD2DBD2005C0A95 /* Logger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BE45C1C1FD2DBD2005C0A95 /* Logger.swift */; };
|
||||
4BEBA5091CFF374B00673FDF /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BEBA5081CFF374B00673FDF /* AppDelegate.swift */; };
|
||||
4BEBA50B1CFF374B00673FDF /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4BEBA50A1CFF374B00673FDF /* Assets.xcassets */; };
|
||||
@ -244,6 +254,7 @@
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
4BE34B842225BAD2002F57D3 /* ShortcutRecorder.framework in Embed Frameworks */,
|
||||
4BB1F5D22097706700EC394A /* MessagePack.framework in Embed Frameworks */,
|
||||
4BB1F5CF2097704D00EC394A /* RxMsgpackRpc.framework in Embed Frameworks */,
|
||||
4BF18C411FD2E2C900DF95D1 /* CocoaFontAwesome.framework in Embed Frameworks */,
|
||||
@ -289,6 +300,8 @@
|
||||
1929B04EC69F616EEFAF5F96 /* FileMonitorReducer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileMonitorReducer.swift; sourceTree = "<group>"; };
|
||||
1929B067B3247675BCD09218 /* MainWindow+Actions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "MainWindow+Actions.swift"; sourceTree = "<group>"; };
|
||||
1929B07A4A9209C88380E015 /* PrefPane.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PrefPane.swift; sourceTree = "<group>"; };
|
||||
1929B07F0085B7AE10413346 /* ShortcutsTableSubviews.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShortcutsTableSubviews.swift; sourceTree = "<group>"; };
|
||||
1929B0E9B2F018D3E31D4B0B /* ShortcutsPref.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShortcutsPref.swift; sourceTree = "<group>"; };
|
||||
1929B0EB3F49C42A57D083AF /* GeneralPrefReducer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneralPrefReducer.swift; sourceTree = "<group>"; };
|
||||
1929B0FBFB766042CF06E463 /* AppearancePref.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppearancePref.swift; sourceTree = "<group>"; };
|
||||
1929B11D672134E52A256A7F /* UrlCommonsTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UrlCommonsTest.swift; sourceTree = "<group>"; };
|
||||
@ -325,6 +338,7 @@
|
||||
1929B85023B042C485409CE1 /* HtmlPreviewTool.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HtmlPreviewTool.swift; sourceTree = "<group>"; };
|
||||
1929B88B5FA08E897A3C2168 /* KeysPrefReducer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeysPrefReducer.swift; sourceTree = "<group>"; };
|
||||
1929B8EF9A9F5ACC175452BD /* PreviewUtils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PreviewUtils.swift; sourceTree = "<group>"; };
|
||||
1929B93256AF7F9137223E36 /* DefaultShortcuts.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DefaultShortcuts.swift; sourceTree = "<group>"; };
|
||||
1929B9355C892BEBA7496C71 /* DictionaryCommonsTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DictionaryCommonsTest.swift; sourceTree = "<group>"; };
|
||||
1929B9AF20D7BD6E5C975128 /* FoundationCommons.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FoundationCommons.swift; sourceTree = "<group>"; };
|
||||
1929B9D510177918080BE39B /* Scorer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Scorer.swift; sourceTree = "<group>"; };
|
||||
@ -352,6 +366,7 @@
|
||||
1929BED01F5D94BFCA4CF80F /* AppearancePrefReducer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppearancePrefReducer.swift; sourceTree = "<group>"; };
|
||||
1929BEDE7F92BC7B49E802AF /* OpenQuicklyFilterOperation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OpenQuicklyFilterOperation.swift; sourceTree = "<group>"; };
|
||||
1929BEEB33113B0E33C3830F /* Matcher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Matcher.swift; sourceTree = "<group>"; };
|
||||
1929BF230875DED6CD7AB3EB /* ShortcutItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShortcutItem.swift; sourceTree = "<group>"; };
|
||||
1929BF69B01107F358CF7EAD /* ScorerTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScorerTest.swift; sourceTree = "<group>"; };
|
||||
1929BFB0F294F3714D5E095F /* PreviewToolReducer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PreviewToolReducer.swift; sourceTree = "<group>"; };
|
||||
1929BFC0A5A9C6DB09BE1368 /* Types.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Types.swift; sourceTree = "<group>"; };
|
||||
@ -448,6 +463,7 @@
|
||||
4BC1642B1FD2DEE1001903BE /* NvimView.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = NvimView.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
4BDF500B1D760A3500D8FBC3 /* FileUtilsTest */ = {isa = PBXFileReference; lastKnownFileType = folder; path = FileUtilsTest; sourceTree = "<group>"; };
|
||||
4BDF50181D77540900D8FBC3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/OpenQuicklyWindow.xib; sourceTree = "<group>"; };
|
||||
4BE34B822225BAC7002F57D3 /* ShortcutRecorder.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ShortcutRecorder.framework; path = ../Carthage/Build/Mac/ShortcutRecorder.framework; sourceTree = "<group>"; };
|
||||
4BE45C1C1FD2DBD2005C0A95 /* Logger.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Logger.swift; sourceTree = "<group>"; };
|
||||
4BEBA5051CFF374B00673FDF /* VimR.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = VimR.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
4BEBA5081CFF374B00673FDF /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
@ -483,8 +499,10 @@
|
||||
4BF18C3E1FD2E2AB00DF95D1 /* RxSwift.framework in Frameworks */,
|
||||
4B9E5E1E20990E09006455C3 /* RxMessagePort.framework in Frameworks */,
|
||||
4BF18C3F1FD2E2AB00DF95D1 /* Sparkle.framework in Frameworks */,
|
||||
4BE34B852225BB56002F57D3 /* RxNeovimApi.framework in Frameworks */,
|
||||
4B9DF286209C8A8B00DF2AAD /* Swifter.framework in Frameworks */,
|
||||
4BF18C401FD2E2AB00DF95D1 /* RxCocoa.framework in Frameworks */,
|
||||
4BE34B832225BAC7002F57D3 /* ShortcutRecorder.framework in Frameworks */,
|
||||
4BC164281FD2DEE1001903BE /* NvimView.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@ -528,6 +546,17 @@
|
||||
name = Utils;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1929B2C6D0242153758A138A /* Shortcuts */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1929B0E9B2F018D3E31D4B0B /* ShortcutsPref.swift */,
|
||||
1929B07F0085B7AE10413346 /* ShortcutsTableSubviews.swift */,
|
||||
1929B93256AF7F9137223E36 /* DefaultShortcuts.swift */,
|
||||
1929BF230875DED6CD7AB3EB /* ShortcutItem.swift */,
|
||||
);
|
||||
name = Shortcuts;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1929B32401E8914DE9BF76CA /* Components */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@ -631,6 +660,7 @@
|
||||
1929BBE0A534F2F6009D31BE /* AdvencedPref.swift */,
|
||||
1929BB2AD21A10A0ECA66A5E /* ToolsPref.swift */,
|
||||
1929B14A5949FB64C4B2646F /* KeysPref.swift */,
|
||||
1929B2C6D0242153758A138A /* Shortcuts */,
|
||||
);
|
||||
name = Preferences;
|
||||
sourceTree = "<group>";
|
||||
@ -670,6 +700,7 @@
|
||||
4B5012001EBA791000F76C46 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4BE34B822225BAC7002F57D3 /* ShortcutRecorder.framework */,
|
||||
4B0A1AA72120C35100F1E02F /* Socket.framework */,
|
||||
4B004BA920FBA6700043A396 /* DictionaryCoding.framework */,
|
||||
4B17E54C209E3EA400265C1D /* RxNeovimApi.framework */,
|
||||
@ -1147,6 +1178,10 @@
|
||||
1929B8F498D1E7C53F572CE2 /* KeysPref.swift in Sources */,
|
||||
1929B5A2EE366F79ED32744C /* KeysPrefReducer.swift in Sources */,
|
||||
1929BB67CAAD4F6CBD38DF0A /* RxRedux.swift in Sources */,
|
||||
1929BB85B2D30E548A32663D /* ShortcutsPref.swift in Sources */,
|
||||
1929BA269EBD68251410A08E /* ShortcutsTableSubviews.swift in Sources */,
|
||||
1929B2D56C4652E251C23AD4 /* DefaultShortcuts.swift in Sources */,
|
||||
1929B0C7150100A84FBDB8BF /* ShortcutItem.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -1178,6 +1213,9 @@
|
||||
1929B8E90A1378E494D481E7 /* PrefUtilsTest.swift in Sources */,
|
||||
1929B20CE35B43BB1CE023BA /* Theme.swift in Sources */,
|
||||
1929B9318D32146D58BB38EC /* AppKitCommons.swift in Sources */,
|
||||
1929BC682EA78BF50D1E0890 /* ShortcutsTableSubviews.swift in Sources */,
|
||||
1929B0244BD7111E168726CF /* DefaultShortcuts.swift in Sources */,
|
||||
1929BDC69A5F9D1661423488 /* ShortcutItem.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -9,6 +9,8 @@ import PureLayout
|
||||
import Sparkle
|
||||
import CocoaFontAwesome
|
||||
|
||||
let debugMenuItemIdentifier = NSUserInterfaceItemIdentifier("debug-menu-item")
|
||||
|
||||
@NSApplicationMain
|
||||
class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDelegate {
|
||||
|
||||
@ -60,12 +62,41 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
|
||||
self.openNewMainWindowOnReactivation = initialAppState.openNewMainWindowOnReactivation
|
||||
self.useSnapshot = initialAppState.useSnapshotUpdate
|
||||
|
||||
let source = self.context.stateSource
|
||||
self.uiRoot = UiRoot(source: source, emitter: self.context.actionEmitter, state: initialAppState)
|
||||
|
||||
super.init()
|
||||
|
||||
NSUserNotificationCenter.default.delegate = self
|
||||
// FIXME: GH-611: https://github.com/qvacua/vimr/issues/611
|
||||
// Check whether FontAwesome can be loaded. If not, show a warning.
|
||||
// We don't know yet why this happens to some users.
|
||||
DispatchQueue.main.async {
|
||||
guard NSFont.fontAwesome(ofSize: 13) == nil else {
|
||||
return
|
||||
}
|
||||
|
||||
let notification = NSUserNotification()
|
||||
notification.title = "FontAwesome could not be loaded."
|
||||
notification.subtitle = "Unfortunately we don't know yet what is causing this."
|
||||
notification.informativeText = """
|
||||
We use the FontAwesome font for icons in the tools, e.g. the file browser. Those icons are now shown as ?.
|
||||
You can track the progress on this issue at GitHub issue 611.
|
||||
"""
|
||||
NSUserNotificationCenter.default.deliver(notification)
|
||||
}
|
||||
}
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
|
||||
let source = self.context.stateSource
|
||||
|
||||
// We want to build the menu items tree at some point, eg in the init() of
|
||||
// ShortcutsPref. We have to do that *after* the MainMenu.xib is loaded.
|
||||
// Therefore, we use optional var for the self.uiRoot. Ugly, but, well...
|
||||
self.uiRoot = UiRoot(
|
||||
source: source,
|
||||
emitter: self.context.actionEmitter,
|
||||
state: self.context.state
|
||||
)
|
||||
|
||||
source
|
||||
.observeOn(MainScheduler.instance)
|
||||
@ -86,30 +117,12 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
|
||||
}
|
||||
})
|
||||
.disposed(by: self.disposeBag)
|
||||
|
||||
// FIXME: GH-611: https://github.com/qvacua/vimr/issues/611
|
||||
// Check whether FontAwesome can be loaded. If not, show a warning.
|
||||
// We don't know yet why this happens to some users.
|
||||
DispatchQueue.main.async {
|
||||
guard NSFont.fontAwesome(ofSize: 13) == nil else {
|
||||
return
|
||||
}
|
||||
|
||||
let notification = NSUserNotification()
|
||||
notification.title = "FontAwesome could not be loaded."
|
||||
notification.subtitle = "Unfortunately we don't know yet what is causing this."
|
||||
notification.informativeText = """
|
||||
We use the FontAwesome font for icons in the tools, e.g. the file browser. Those icons are now shown as ?.
|
||||
You can track the progress on this issue at GitHub issue 611.
|
||||
"""
|
||||
NSUserNotificationCenter.default.deliver(notification)
|
||||
}
|
||||
}
|
||||
|
||||
private let context: Context
|
||||
private let emit: (Action) -> Void
|
||||
|
||||
private let uiRoot: UiRoot
|
||||
private var uiRoot: UiRoot?
|
||||
|
||||
private var hasDirtyWindows = false
|
||||
private var hasMainWindows = false
|
||||
@ -151,9 +164,9 @@ extension AppDelegate {
|
||||
func applicationDidFinishLaunching(_: Notification) {
|
||||
self.launching = false
|
||||
|
||||
#if DEBUG
|
||||
#if DEBUG
|
||||
NSApp.mainMenu?.items.first { $0.identifier == debugMenuItemIdentifier }?.isHidden = false
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
func applicationOpenUntitledFile(_ sender: NSApplication) -> Bool {
|
||||
@ -186,7 +199,7 @@ extension AppDelegate {
|
||||
|
||||
if alert.runModal() == .alertSecondButtonReturn {
|
||||
self.updateMainWindowTemplateBeforeQuitting()
|
||||
self.uiRoot.prepareQuit()
|
||||
self.uiRoot?.prepareQuit()
|
||||
return .terminateNow
|
||||
}
|
||||
|
||||
@ -195,7 +208,7 @@ extension AppDelegate {
|
||||
|
||||
if self.hasMainWindows {
|
||||
self.updateMainWindowTemplateBeforeQuitting()
|
||||
self.uiRoot.prepareQuit()
|
||||
self.uiRoot?.prepareQuit()
|
||||
return .terminateNow
|
||||
}
|
||||
|
||||
@ -414,8 +427,6 @@ private enum VimRUrlAction: String {
|
||||
|
||||
private let updater = SUUpdater()
|
||||
|
||||
private let debugMenuItemIdentifier = NSUserInterfaceItemIdentifier("debug-menu-item")
|
||||
|
||||
// Keep in sync with QueryParamKey in the `vimr` Python script.
|
||||
private let filePrefix = "file="
|
||||
private let cwdPrefix = "cwd="
|
||||
|
@ -1,5 +1,5 @@
|
||||
{\rtf1\ansi\ansicpg1252\cocoartf1561\cocoasubrtf600
|
||||
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
|
||||
{\rtf1\ansi\ansicpg1252\cocoartf1671\cocoasubrtf200
|
||||
{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fswiss\fcharset0 Helvetica-Bold;}
|
||||
{\colortbl;\red255\green255\blue255;}
|
||||
{\*\expandedcolortbl;;}
|
||||
\paperw11900\paperh16840\vieww10960\viewh15520\viewkind0
|
||||
@ -9,106 +9,107 @@
|
||||
\f0\fs24 \
|
||||
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0
|
||||
{\field{\*\fldinst{HYPERLINK "https://github.com/qvacua/vimr"}}{\fldrslt \cf0 https://github.com/qvacua/vimr}}
|
||||
\b \
|
||||
\f1\b \
|
||||
\
|
||||
By:
|
||||
\b0 \
|
||||
\f0\b0 \
|
||||
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\partightenfactor0
|
||||
\cf0
|
||||
\b Tae Won Ha
|
||||
\b0 \'95 {\field{\*\fldinst{HYPERLINK "http://twitter.com/hataewon"}}{\fldrslt @hataewon}}\
|
||||
\f1\b Tae Won Ha
|
||||
\f0\b0 \'95 {\field{\*\fldinst{HYPERLINK "http://twitter.com/hataewon"}}{\fldrslt @hataewon}}\
|
||||
{\field{\*\fldinst{HYPERLINK "mailto:h@taewon.de"}}{\fldrslt h@taewon.de}}\
|
||||
\
|
||||
|
||||
\b App icon by:\
|
||||
\f1\b App icon by:\
|
||||
Andrew Yeaton
|
||||
\b0 \'95 {\field{\*\fldinst{HYPERLINK "https://twitter.com/xeeton"}}{\fldrslt @xeeton}}\
|
||||
\f0\b0 \'95 {\field{\*\fldinst{HYPERLINK "https://twitter.com/xeeton"}}{\fldrslt @xeeton}}\
|
||||
{\field{\*\fldinst{HYPERLINK "mailto:xeeton@gmail.com"}}{\fldrslt xeeton@gmail.com}}\
|
||||
\
|
||||
|
||||
\b Contributors:
|
||||
\b0 \
|
||||
\f1\b Contributors:
|
||||
\f0\b0 \
|
||||
{\field{\*\fldinst{HYPERLINK "https://github.com/qvacua/vimr/graphs/contributors"}}{\fldrslt https://github.com/qvacua/vimr/graphs/contributors}}\
|
||||
{\field{\*\fldinst{HYPERLINK "https://github.com/qvacua/vimr/issues"}}{\fldrslt https://github.com/qvacua/vimr/issues}}\
|
||||
\
|
||||
|
||||
\b Backers
|
||||
\b0 \
|
||||
\f1\b Backers
|
||||
\f0\b0 \
|
||||
{\field{\*\fldinst{HYPERLINK "https://www.bountysource.com/teams/vimr/backers"}}{\fldrslt https://www.bountysource.com/teams/vimr/backers}}\
|
||||
\
|
||||
|
||||
\b Using stuff from:\
|
||||
\f1\b Using stuff from:\
|
||||
Neovim\
|
||||
{\field{\*\fldinst{HYPERLINK "https://github.com/neovim/neovim"}}{\fldrslt
|
||||
\b0 https://github.com/neovim/neovim}}
|
||||
\b0 \
|
||||
\f0\b0 https://github.com/neovim/neovim}}
|
||||
\f0\b0 \
|
||||
\
|
||||
|
||||
\b MacVim
|
||||
\b0 \
|
||||
\f1\b MacVim
|
||||
\f0\b0 \
|
||||
{\field{\*\fldinst{HYPERLINK "https://github.com/macvim-dev"}}{\fldrslt https://github.com/macvim-dev}}
|
||||
\b \
|
||||
\f1\b \
|
||||
\
|
||||
RxSwift
|
||||
\b0 \
|
||||
\f0\b0 \
|
||||
{\field{\*\fldinst{HYPERLINK "https://github.com/ReactiveX/RxSwift"}}{\fldrslt https://github.com/ReactiveX/RxSwift}}\
|
||||
\
|
||||
|
||||
\b PureLayout
|
||||
\b0 \
|
||||
\f1\b PureLayout
|
||||
\f0\b0 \
|
||||
{\field{\*\fldinst{HYPERLINK "https://github.com/smileyborg/PureLayout"}}{\fldrslt https://github.com/smileyborg/PureLayout}}\
|
||||
\
|
||||
|
||||
\b EonilFileSystemEvents
|
||||
\b0 \
|
||||
\f1\b EonilFileSystemEvents
|
||||
\f0\b0 \
|
||||
{\field{\*\fldinst{HYPERLINK "https://github.com/eonil/FileSystemEvents"}}{\fldrslt https://github.com/eonil/FileSystemEvents}}\
|
||||
\
|
||||
|
||||
\b Sparkle
|
||||
\b0 \
|
||||
\f1\b Sparkle
|
||||
\f0\b0 \
|
||||
{\field{\*\fldinst{HYPERLINK "https://sparkle-project.org"}}{\fldrslt https://sparkle-project.org}}\
|
||||
\
|
||||
|
||||
\b CocoaFontAwesome
|
||||
\b0 \
|
||||
{\field{\*\fldinst{HYPERLINK "https://github.com/qvacua/CocoaFontAwesome"}}{\fldrslt https://github.com/qvacua/CocoaFontAwesome}}\
|
||||
Port of
|
||||
\b FontAwesome.swift
|
||||
\b0 to macOS\
|
||||
\f1\b FontAwesome.swift
|
||||
\f0\b0 \
|
||||
{\field{\*\fldinst{HYPERLINK "https://github.com/thii/FontAwesome.swift"}}{\fldrslt https://github.com/thii/FontAwesome.swift}}\
|
||||
\
|
||||
|
||||
\b CocoaMarkdown\
|
||||
\f1\b CocoaMarkdown\
|
||||
|
||||
\b0 {\field{\*\fldinst{HYPERLINK "https://github.com/indragiek/CocoaMarkdown"}}{\fldrslt https://github.com/indragiek/CocoaMarkdown}}\
|
||||
\f0\b0 {\field{\*\fldinst{HYPERLINK "https://github.com/indragiek/CocoaMarkdown"}}{\fldrslt https://github.com/indragiek/CocoaMarkdown}}\
|
||||
\
|
||||
|
||||
\b Swifter\
|
||||
\f1\b Swifter\
|
||||
|
||||
\b0 {\field{\*\fldinst{HYPERLINK "https://github.com/httpswift/swifter"}}{\fldrslt https://github.com/httpswift/swifter}}\
|
||||
\f0\b0 {\field{\*\fldinst{HYPERLINK "https://github.com/httpswift/swifter"}}{\fldrslt https://github.com/httpswift/swifter}}\
|
||||
\
|
||||
|
||||
\b github-markdown-css\
|
||||
\f1\b github-markdown-css\
|
||||
|
||||
\b0 {\field{\*\fldinst{HYPERLINK "https://github.com/sindresorhus/github-markdown-css"}}{\fldrslt https://github.com/sindresorhus/github-markdown-css}}\
|
||||
\f0\b0 {\field{\*\fldinst{HYPERLINK "https://github.com/sindresorhus/github-markdown-css"}}{\fldrslt https://github.com/sindresorhus/github-markdown-css}}\
|
||||
\
|
||||
|
||||
\b MessagePack.swift\
|
||||
\f1\b MessagePack.swift\
|
||||
{\field{\*\fldinst{HYPERLINK "https://github.com/a2/MessagePack.swift"}}{\fldrslt
|
||||
\b0 https://github.com/a2/MessagePack.swift}}
|
||||
\b0 \
|
||||
\f0\b0 https://github.com/a2/MessagePack.swift}}
|
||||
\f0\b0 \
|
||||
\
|
||||
|
||||
\b DictionaryCoding
|
||||
\b0 \
|
||||
\f1\b DictionaryCoding
|
||||
\f0\b0 \
|
||||
{\field{\*\fldinst{HYPERLINK "https://github.com/elegantchaos/DictionaryCoding"}}{\fldrslt https://github.com/elegantchaos/DictionaryCoding}}\
|
||||
\
|
||||
|
||||
\b Nimble
|
||||
\b0 \
|
||||
\f1\b ShortcutRecorder
|
||||
\f0\b0 \
|
||||
{\field{\*\fldinst{HYPERLINK "https://github.com/Kentzo/ShortcutRecorder"}}{\fldrslt https://github.com/Kentzo/ShortcutRecorder}}\
|
||||
\
|
||||
|
||||
\f1\b Nimble
|
||||
\f0\b0 \
|
||||
{\field{\*\fldinst{HYPERLINK "https://github.com/Quick/Nimble"}}{\fldrslt https://github.com/Quick/Nimble}}\
|
||||
\
|
||||
|
||||
\b Carthage
|
||||
\b0 \
|
||||
\f1\b Carthage
|
||||
\f0\b0 \
|
||||
{\field{\*\fldinst{HYPERLINK "https://github.com/Carthage/Carthage"}}{\fldrslt https://github.com/Carthage/Carthage}}}
|
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13771" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13771"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14460.31"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="Application" customModule="VimR" customModuleProvider="target">
|
||||
@ -73,45 +73,45 @@
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="File" id="bib-Uj-vzu">
|
||||
<items>
|
||||
<menuItem title="New" keyEquivalent="n" id="Was-JA-tGl">
|
||||
<menuItem title="New" keyEquivalent="n" identifier="com.qvacua.vimr.menuitems.file.new" id="Was-JA-tGl">
|
||||
<connections>
|
||||
<action selector="newDocument:" target="-1" id="4Si-XN-c54"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="New Tab" keyEquivalent="t" id="TX9-92-Oe2">
|
||||
<menuItem title="New Tab" keyEquivalent="t" identifier="com.qvacua.vimr.menuitems.file.new-tab" id="TX9-92-Oe2">
|
||||
<connections>
|
||||
<action selector="newTab:" target="-1" id="RfK-C0-Bu9"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="t9v-Ee-SaA"/>
|
||||
<menuItem title="Open…" keyEquivalent="o" id="IAo-SY-fd9">
|
||||
<menuItem title="Open…" keyEquivalent="o" identifier="com.qvacua.vimr.menuitems.file.open" id="IAo-SY-fd9">
|
||||
<connections>
|
||||
<action selector="openDocument:" target="-1" id="zbe-h0-oBM"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Open In New Window…" keyEquivalent="o" id="c6W-bD-wRy">
|
||||
<menuItem title="Open In New Window…" keyEquivalent="o" identifier="com.qvacua.vimr.menuitems.file.open-in-new-window" id="c6W-bD-wRy">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="openInNewWindow:" target="-1" id="2ZC-Rl-rjR"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Open Quickly…" keyEquivalent="O" id="0V2-yi-P2z">
|
||||
<menuItem title="Open Quickly…" keyEquivalent="O" identifier="com.qvacua.vimr.menuitems.file.open-quickly" id="0V2-yi-P2z">
|
||||
<connections>
|
||||
<action selector="openQuickly:" target="-1" id="FSA-7W-F0m"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="Lje-kE-tCa"/>
|
||||
<menuItem title="Close" keyEquivalent="w" id="DVo-aG-piG">
|
||||
<menuItem title="Close" keyEquivalent="w" identifier="com.qvacua.vimr.menuitems.file.close" id="DVo-aG-piG">
|
||||
<connections>
|
||||
<action selector="performClose:" target="-1" id="HmO-Ls-i7Q"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Save..." keyEquivalent="s" id="Pgi-pt-dWC">
|
||||
<menuItem title="Save..." keyEquivalent="s" identifier="com.qvacua.vimr.menuitems.file.save" id="Pgi-pt-dWC">
|
||||
<connections>
|
||||
<action selector="saveDocument:" target="-1" id="Qhz-Mg-Anr"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Save As…" keyEquivalent="S" id="01H-3e-ZCV">
|
||||
<menuItem title="Save As…" keyEquivalent="S" identifier="com.qvacua.vimr.menuitems.file.save-as" id="01H-3e-ZCV">
|
||||
<connections>
|
||||
<action selector="saveDocumentAs:" target="-1" id="2iM-rb-3fJ"/>
|
||||
</connections>
|
||||
@ -123,39 +123,39 @@
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Edit" id="W48-6f-4Dl">
|
||||
<items>
|
||||
<menuItem title="Undo" keyEquivalent="z" id="dRJ-4n-Yzg">
|
||||
<menuItem title="Undo" keyEquivalent="z" identifier="com.qvacua.vimr.menuitems.edit.undo" id="dRJ-4n-Yzg">
|
||||
<connections>
|
||||
<action selector="undo:" target="-1" id="M6e-cu-g7V"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Redo" keyEquivalent="Z" id="6dh-zS-Vam">
|
||||
<menuItem title="Redo" keyEquivalent="Z" identifier="com.qvacua.vimr.menuitems.edit.redo" id="6dh-zS-Vam">
|
||||
<connections>
|
||||
<action selector="redo:" target="-1" id="oIA-Rs-6OD"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="WRV-NI-Exz"/>
|
||||
<menuItem title="Cut" keyEquivalent="x" id="uRl-iY-unG">
|
||||
<menuItem title="Cut" keyEquivalent="x" identifier="com.qvacua.vimr.menuitems.edit.cut" id="uRl-iY-unG">
|
||||
<connections>
|
||||
<action selector="cut:" target="-1" id="YJe-68-I9s"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Copy" keyEquivalent="c" id="x3v-GG-iWU">
|
||||
<menuItem title="Copy" keyEquivalent="c" identifier="com.qvacua.vimr.menuitems.edit.copy" id="x3v-GG-iWU">
|
||||
<connections>
|
||||
<action selector="copy:" target="-1" id="G1f-GL-Joy"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Paste" keyEquivalent="v" id="gVA-U4-sdL">
|
||||
<menuItem title="Paste" keyEquivalent="v" identifier="com.qvacua.vimr.menuitems.edit.paste" id="gVA-U4-sdL">
|
||||
<connections>
|
||||
<action selector="paste:" target="-1" id="UvS-8e-Qdg"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Delete" id="pa3-QI-u2k">
|
||||
<menuItem title="Delete" identifier="com.qvacua.vimr.menuitems.edit.delete" id="pa3-QI-u2k">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="delete:" target="-1" id="0Mk-Ml-PaM"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Select All" keyEquivalent="a" id="Ruw-6m-B2m">
|
||||
<menuItem title="Select All" keyEquivalent="a" identifier="com.qvacua.vimr.menuitems.edit.select-all" id="Ruw-6m-B2m">
|
||||
<connections>
|
||||
<action selector="selectAll:" target="-1" id="VNm-Mi-diN"/>
|
||||
</connections>
|
||||
@ -171,17 +171,17 @@
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Font" systemMenu="font" id="Wj0-kR-IJp">
|
||||
<items>
|
||||
<menuItem title="Reset To Default Size" keyEquivalent="0" id="dmv-1c-kFU">
|
||||
<menuItem title="Reset To Default Size" keyEquivalent="0" identifier="com.qvacua.vimr.menuitems.view.font.reset-to-default-size" id="dmv-1c-kFU">
|
||||
<connections>
|
||||
<action selector="resetFontSize:" target="-1" id="8Rb-Wd-iZH"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Bigger" tag="3" keyEquivalent="+" id="FIs-h6-uga">
|
||||
<menuItem title="Bigger" tag="3" keyEquivalent="+" identifier="com.qvacua.vimr.menuitems.view.font.bigger" id="FIs-h6-uga">
|
||||
<connections>
|
||||
<action selector="makeFontBigger:" target="-1" id="FVE-Cp-LhT"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Smaller" tag="4" keyEquivalent="-" id="BHh-O4-8m0">
|
||||
<menuItem title="Smaller" tag="4" keyEquivalent="-" identifier="com.qvacua.vimr.menuitems.view.font.smaller" id="BHh-O4-8m0">
|
||||
<connections>
|
||||
<action selector="makeFontSmaller:" target="-1" id="nqo-sN-9tq"/>
|
||||
</connections>
|
||||
@ -190,7 +190,7 @@
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="NXP-NG-aHV"/>
|
||||
<menuItem title="Enter Full Screen" keyEquivalent="f" id="Co5-Y0-sqo">
|
||||
<menuItem title="Enter Full Screen" keyEquivalent="f" identifier="com.qvacua.vimr.menuitems.view.enter-full-screen" id="Co5-Y0-sqo">
|
||||
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="toggleFullScreen:" target="-1" id="b4d-vv-b5h"/>
|
||||
@ -203,25 +203,25 @@
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Tools" id="7MO-P5-uU3">
|
||||
<items>
|
||||
<menuItem title="Toggle All Tools" keyEquivalent="\" id="Lb6-TZ-LgL">
|
||||
<menuItem title="Toggle All Tools" keyEquivalent="\" identifier="com.qvacua.vimr.menuitems.tools.toggle-all-tools" id="Lb6-TZ-LgL">
|
||||
<connections>
|
||||
<action selector="toggleAllTools:" target="-1" id="V97-0e-bES"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Toggle Tool Buttons" keyEquivalent="\" id="oK0-ZG-w1f">
|
||||
<menuItem title="Toggle Tool Buttons" keyEquivalent="\" identifier="com.qvacua.vimr.menuitems.tools.toggle-tool-buttons" id="oK0-ZG-w1f">
|
||||
<modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="toggleToolButtons:" target="-1" id="bxj-O1-Vo9"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="UAq-9D-Jex"/>
|
||||
<menuItem title="Toggle File Browser" keyEquivalent="1" id="PWx-V8-0cQ">
|
||||
<menuItem title="Toggle File Browser" keyEquivalent="1" identifier="com.qvacua.vimr.menuitems.tools.toggle-file-browser" id="PWx-V8-0cQ">
|
||||
<connections>
|
||||
<action selector="toggleFileBrowser:" target="-1" id="Ggq-4w-iN7"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="XHW-5e-Vad"/>
|
||||
<menuItem title="Focus Neovim View" keyEquivalent="." id="TtL-Gg-pCj">
|
||||
<menuItem title="Focus Neovim View" keyEquivalent="." identifier="com.qvacua.vimr.menuitems.tools.focus-neovim-view" id="TtL-Gg-pCj">
|
||||
<connections>
|
||||
<action selector="focusNvimView:" target="-1" id="obY-Kb-RxK"/>
|
||||
</connections>
|
||||
@ -233,19 +233,19 @@
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Window" systemMenu="window" id="Td7-aD-5lo">
|
||||
<items>
|
||||
<menuItem title="Minimize" keyEquivalent="m" id="OY7-WF-poV">
|
||||
<menuItem title="Minimize" keyEquivalent="m" identifier="com.qvacua.vimr.menuitems.window.minimize" id="OY7-WF-poV">
|
||||
<connections>
|
||||
<action selector="performMiniaturize:" target="-1" id="VwT-WD-YPe"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Zoom" id="R4o-n2-Eq4">
|
||||
<menuItem title="Zoom" identifier="com.qvacua.vimr.menuitems.window.zoom" id="R4o-n2-Eq4">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="performZoom:" target="-1" id="DIl-cC-cCs"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="eu3-7i-yIM"/>
|
||||
<menuItem title="Bring All to Front" id="LE2-aR-0XJ">
|
||||
<menuItem title="Bring All to Front" identifier="com.qvacua.vimr.menuitems.window.bring-all-to-front" id="LE2-aR-0XJ">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="arrangeInFront:" target="-1" id="DRN-fu-gQh"/>
|
||||
@ -276,7 +276,7 @@
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Help" systemMenu="help" id="F2S-fz-NVQ">
|
||||
<items>
|
||||
<menuItem title="VimR Help" keyEquivalent="?" id="FKE-Sm-Kum">
|
||||
<menuItem title="VimR Help" keyEquivalent="?" identifier="com.qvacua.vimr.menuitems.help.vimr-help" id="FKE-Sm-Kum">
|
||||
<connections>
|
||||
<action selector="showHelp:" target="-1" id="y7X-2Q-9no"/>
|
||||
</connections>
|
||||
|
152
VimR/VimR/DefaultShortcuts.swift
Normal file
152
VimR/VimR/DefaultShortcuts.swift
Normal file
@ -0,0 +1,152 @@
|
||||
/**
|
||||
* Tae Won Ha - http://taewon.de - @hataewon
|
||||
* See LICENSE
|
||||
*/
|
||||
|
||||
import Foundation
|
||||
import ShortcutRecorder
|
||||
|
||||
let defaultShortcuts: [String: [String: Any]] = [
|
||||
"com.qvacua.vimr.menuitems.edit.copy": [
|
||||
SRShortcutCharacters: "c",
|
||||
SRShortcutCharactersIgnoringModifiers: "c",
|
||||
SRShortcutKeyCode: 8,
|
||||
SRShortcutModifierFlagsKey: 1048840,
|
||||
],
|
||||
"com.qvacua.vimr.menuitems.edit.cut": [
|
||||
SRShortcutCharacters: "x",
|
||||
SRShortcutCharactersIgnoringModifiers: "x",
|
||||
SRShortcutKeyCode: 7,
|
||||
SRShortcutModifierFlagsKey: 1048840,
|
||||
],
|
||||
"com.qvacua.vimr.menuitems.edit.delete": [String: Any](),
|
||||
"com.qvacua.vimr.menuitems.edit.paste": [
|
||||
SRShortcutCharacters: "v",
|
||||
SRShortcutCharactersIgnoringModifiers: "v",
|
||||
SRShortcutKeyCode: 9,
|
||||
SRShortcutModifierFlagsKey: 1048840,
|
||||
],
|
||||
"com.qvacua.vimr.menuitems.edit.redo": [
|
||||
SRShortcutCharacters: "z",
|
||||
SRShortcutCharactersIgnoringModifiers: "Z",
|
||||
SRShortcutKeyCode: 6,
|
||||
SRShortcutModifierFlagsKey: 1179914,
|
||||
],
|
||||
"com.qvacua.vimr.menuitems.edit.select-all": [
|
||||
SRShortcutCharacters: "a",
|
||||
SRShortcutCharactersIgnoringModifiers: "a",
|
||||
SRShortcutKeyCode: 0,
|
||||
SRShortcutModifierFlagsKey: 1048840,
|
||||
],
|
||||
"com.qvacua.vimr.menuitems.edit.undo": [
|
||||
SRShortcutCharacters: "z",
|
||||
SRShortcutCharactersIgnoringModifiers: "z",
|
||||
SRShortcutKeyCode: 6,
|
||||
SRShortcutModifierFlagsKey: 1048840,
|
||||
],
|
||||
"com.qvacua.vimr.menuitems.file.close": [
|
||||
SRShortcutCharacters: "w",
|
||||
SRShortcutCharactersIgnoringModifiers: "w",
|
||||
SRShortcutKeyCode: 13,
|
||||
SRShortcutModifierFlagsKey: 1048840,
|
||||
],
|
||||
"com.qvacua.vimr.menuitems.file.new": [
|
||||
SRShortcutCharacters: "n",
|
||||
SRShortcutCharactersIgnoringModifiers: "n",
|
||||
SRShortcutKeyCode: 45,
|
||||
SRShortcutModifierFlagsKey: 1048840,
|
||||
],
|
||||
"com.qvacua.vimr.menuitems.file.new-tab": [
|
||||
SRShortcutCharacters: "t",
|
||||
SRShortcutCharactersIgnoringModifiers: "t",
|
||||
SRShortcutKeyCode: 17,
|
||||
SRShortcutModifierFlagsKey: 1048840,
|
||||
],
|
||||
"com.qvacua.vimr.menuitems.file.open-in-new-window": [
|
||||
SRShortcutCharacters: "ø",
|
||||
SRShortcutCharactersIgnoringModifiers: "o",
|
||||
SRShortcutKeyCode: 31,
|
||||
SRShortcutModifierFlagsKey: 1573160,
|
||||
],
|
||||
"com.qvacua.vimr.menuitems.file.open-quickly": [
|
||||
SRShortcutCharacters: "o",
|
||||
SRShortcutCharactersIgnoringModifiers: "O",
|
||||
SRShortcutKeyCode: 31,
|
||||
SRShortcutModifierFlagsKey: 1179914,
|
||||
],
|
||||
"com.qvacua.vimr.menuitems.file.open": [
|
||||
SRShortcutCharacters: "o",
|
||||
SRShortcutCharactersIgnoringModifiers: "o",
|
||||
SRShortcutKeyCode: 31,
|
||||
SRShortcutModifierFlagsKey: 1048840,
|
||||
],
|
||||
"com.qvacua.vimr.menuitems.file.save-as": [
|
||||
SRShortcutCharacters: "s",
|
||||
SRShortcutCharactersIgnoringModifiers: "S",
|
||||
SRShortcutKeyCode: 1,
|
||||
SRShortcutModifierFlagsKey: 1179914,
|
||||
],
|
||||
"com.qvacua.vimr.menuitems.file.save": [
|
||||
SRShortcutCharacters: "s",
|
||||
SRShortcutCharactersIgnoringModifiers: "s",
|
||||
SRShortcutKeyCode: 1,
|
||||
SRShortcutModifierFlagsKey: 1048840,
|
||||
],
|
||||
"com.qvacua.vimr.menuitems.help.vimr-help": [String: Any](),
|
||||
"com.qvacua.vimr.menuitems.tools.focus-neovim-view": [
|
||||
SRShortcutCharacters: ".",
|
||||
SRShortcutCharactersIgnoringModifiers: ".",
|
||||
SRShortcutKeyCode: 47,
|
||||
SRShortcutModifierFlagsKey: 1048576,
|
||||
],
|
||||
"com.qvacua.vimr.menuitems.tools.toggle-all-tools": [
|
||||
SRShortcutCharacters: "\\",
|
||||
SRShortcutCharactersIgnoringModifiers: "\\",
|
||||
SRShortcutKeyCode: 42,
|
||||
SRShortcutModifierFlagsKey: 1048840,
|
||||
],
|
||||
"com.qvacua.vimr.menuitems.tools.toggle-file-browser": [
|
||||
SRShortcutCharacters: "1",
|
||||
SRShortcutCharactersIgnoringModifiers: "1",
|
||||
SRShortcutKeyCode: 18,
|
||||
SRShortcutModifierFlagsKey: 1048840,
|
||||
],
|
||||
"com.qvacua.vimr.menuitems.tools.toggle-tool-buttons": [
|
||||
SRShortcutCharacters: "\\",
|
||||
SRShortcutCharactersIgnoringModifiers: "|",
|
||||
SRShortcutKeyCode: 42,
|
||||
SRShortcutModifierFlagsKey: 1179914,
|
||||
],
|
||||
"com.qvacua.vimr.menuitems.view.enter-full-screen": [
|
||||
SRShortcutCharacters: "\006",
|
||||
SRShortcutCharactersIgnoringModifiers: "f",
|
||||
SRShortcutKeyCode: 3,
|
||||
SRShortcutModifierFlagsKey: 1319176,
|
||||
],
|
||||
"com.qvacua.vimr.menuitems.view.font.bigger": [
|
||||
SRShortcutCharacters: "=",
|
||||
SRShortcutCharactersIgnoringModifiers: "=",
|
||||
SRShortcutKeyCode: 24,
|
||||
SRShortcutModifierFlagsKey: 1048840,
|
||||
],
|
||||
"com.qvacua.vimr.menuitems.view.font.reset-to-default-size": [
|
||||
SRShortcutCharacters: "0",
|
||||
SRShortcutCharactersIgnoringModifiers: "0",
|
||||
SRShortcutKeyCode: 29,
|
||||
SRShortcutModifierFlagsKey: 1048840,
|
||||
],
|
||||
"com.qvacua.vimr.menuitems.view.font.smaller": [
|
||||
SRShortcutCharacters: "-",
|
||||
SRShortcutCharactersIgnoringModifiers: "-",
|
||||
SRShortcutKeyCode: 27,
|
||||
SRShortcutModifierFlagsKey: 1048840,
|
||||
],
|
||||
"com.qvacua.vimr.menuitems.window.bring-all-to-front": [String: Any](),
|
||||
"com.qvacua.vimr.menuitems.window.minimize": [
|
||||
SRShortcutCharacters: "m",
|
||||
SRShortcutCharactersIgnoringModifiers: "m",
|
||||
SRShortcutKeyCode: 46,
|
||||
SRShortcutModifierFlagsKey: 1048840,
|
||||
],
|
||||
"com.qvacua.vimr.menuitems.window.zoom": [String: Any](),
|
||||
]
|
@ -30,6 +30,7 @@ class PrefWindow: NSObject,
|
||||
ToolsPref(source: source, emitter: emitter, state: state),
|
||||
AppearancePref(source: source, emitter: emitter, state: state),
|
||||
KeysPref(source: source, emitter: emitter, state: state),
|
||||
ShortcutsPref(source: source, emitter: emitter, state: state),
|
||||
AdvancedPref(source: source, emitter: emitter, state: state),
|
||||
]
|
||||
|
||||
|
50
VimR/VimR/ShortcutItem.swift
Normal file
50
VimR/VimR/ShortcutItem.swift
Normal file
@ -0,0 +1,50 @@
|
||||
/**
|
||||
* Tae Won Ha - http://taewon.de - @hataewon
|
||||
* See LICENSE
|
||||
*/
|
||||
|
||||
import Cocoa
|
||||
|
||||
class ShortcutItem: NSObject, Comparable {
|
||||
|
||||
static func <(lhs: ShortcutItem, rhs: ShortcutItem) -> Bool {
|
||||
return lhs.title < rhs.title
|
||||
}
|
||||
|
||||
@objc dynamic var title: String
|
||||
@objc dynamic var isLeaf: Bool
|
||||
|
||||
@objc dynamic var childrenCount: Int {
|
||||
return self.children?.count ?? -1
|
||||
}
|
||||
|
||||
var identifier: String? {
|
||||
return self.item?.identifier?.rawValue
|
||||
}
|
||||
|
||||
var isContainer: Bool {
|
||||
return !self.isLeaf
|
||||
}
|
||||
|
||||
override var description: String {
|
||||
return "<ShortcutItem: \(title), " +
|
||||
"id: '\(self.identifier ?? "")', " +
|
||||
"isLeaf: \(self.isLeaf), " +
|
||||
"childrenCount: \(self.children?.count ?? -1)" +
|
||||
">"
|
||||
}
|
||||
|
||||
let item: NSMenuItem?
|
||||
@objc dynamic var children: [ShortcutItem]?
|
||||
|
||||
init(
|
||||
title: String,
|
||||
isLeaf: Bool,
|
||||
item: NSMenuItem?
|
||||
) {
|
||||
self.title = title
|
||||
self.isLeaf = isLeaf
|
||||
self.item = item
|
||||
self.children = isLeaf ? nil : []
|
||||
}
|
||||
}
|
355
VimR/VimR/ShortcutsPref.swift
Normal file
355
VimR/VimR/ShortcutsPref.swift
Normal file
@ -0,0 +1,355 @@
|
||||
/**
|
||||
* Tae Won Ha - http://taewon.de - @hataewon
|
||||
* See LICENSE
|
||||
*/
|
||||
|
||||
import Cocoa
|
||||
import PureLayout
|
||||
import RxSwift
|
||||
import ShortcutRecorder
|
||||
|
||||
class ShortcutsPref: PrefPane,
|
||||
UiComponent,
|
||||
NSOutlineViewDelegate,
|
||||
SRRecorderControlDelegate {
|
||||
|
||||
typealias StateType = AppState
|
||||
|
||||
@objc dynamic var content = [ShortcutItem]()
|
||||
|
||||
override var displayName: String {
|
||||
return "Shortcuts"
|
||||
}
|
||||
|
||||
override var pinToContainer: Bool {
|
||||
return true
|
||||
}
|
||||
|
||||
required init(
|
||||
source: Observable<StateType>,
|
||||
emitter: ActionEmitter,
|
||||
state: StateType
|
||||
) {
|
||||
self.shortcutsDefaultsController = NSUserDefaultsController(
|
||||
defaults: self.shortcutsUserDefaults,
|
||||
initialValues: nil
|
||||
)
|
||||
|
||||
super.init(frame: .zero)
|
||||
|
||||
initShortcutUserDefaults()
|
||||
|
||||
self.addViews()
|
||||
|
||||
self.initShortcutItems()
|
||||
if let children = self.shortcutItemsRoot.children {
|
||||
self.content.append(contentsOf: children)
|
||||
}
|
||||
|
||||
self.initMenuItemsBindings()
|
||||
self.initOutlineViewBindings()
|
||||
|
||||
self.shortcutList.expandItem(nil, expandChildren: true)
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
private let shortcutList = NSOutlineView.standardOutlineView()
|
||||
private let shortcutScrollView = NSScrollView.standardScrollView()
|
||||
private let resetButton = NSButton(forAutoLayout: ())
|
||||
|
||||
private let treeController = NSTreeController()
|
||||
private let shortcutItemsRoot = ShortcutItem(
|
||||
title: "root", isLeaf: false, item: nil
|
||||
)
|
||||
|
||||
private let keyEqTransformer = SRKeyEquivalentTransformer()
|
||||
private let keyEqModTransformer = SRKeyEquivalentModifierMaskTransformer()
|
||||
|
||||
private let shortcutsUserDefaults = UserDefaults(
|
||||
suiteName: "com.qvacua.VimR.menuitems"
|
||||
)
|
||||
private let shortcutsDefaultsController: NSUserDefaultsController
|
||||
|
||||
private func initShortcutUserDefaults() {
|
||||
defaultShortcuts.forEach { identifier, shortcutData in
|
||||
if self.shortcutsUserDefaults?.value(forKey: identifier) == nil {
|
||||
self.shortcutsUserDefaults?.set(shortcutData, forKey: identifier)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func initOutlineViewBindings() {
|
||||
self.treeController.childrenKeyPath = "children"
|
||||
self.treeController.leafKeyPath = "isLeaf"
|
||||
self.treeController.countKeyPath = "childrenCount"
|
||||
self.treeController.objectClass = ShortcutItem.self
|
||||
self.treeController.avoidsEmptySelection = false
|
||||
self.treeController.preservesSelection = true
|
||||
self.treeController.sortDescriptors = [
|
||||
NSSortDescriptor(key: "title", ascending: true)
|
||||
]
|
||||
self.treeController.bind(.contentArray, to: self, withKeyPath: "content")
|
||||
self.shortcutList.bind(.content,
|
||||
to: self.treeController,
|
||||
withKeyPath: "arrangedObjects")
|
||||
self.shortcutList.bind(.selectionIndexPaths,
|
||||
to: self.treeController,
|
||||
withKeyPath: "selectionIndexPaths")
|
||||
}
|
||||
|
||||
private func traverseMenuItems(with fn: (String, NSMenuItem) -> Void) {
|
||||
var queue = self.shortcutItemsRoot.children ?? []
|
||||
while (!queue.isEmpty) {
|
||||
guard let item = queue.popLast() else { break }
|
||||
if item.isContainer, let children = item.children {
|
||||
queue.append(contentsOf: children)
|
||||
continue
|
||||
}
|
||||
|
||||
guard let menuItem = item.item, let identifier = item.identifier else {
|
||||
continue
|
||||
}
|
||||
|
||||
fn(identifier, menuItem)
|
||||
}
|
||||
}
|
||||
|
||||
private func initMenuItemsBindings() {
|
||||
self.traverseMenuItems { identifier, menuItem in
|
||||
menuItem.bind(
|
||||
NSBindingName("keyEquivalent"),
|
||||
to: self.shortcutsDefaultsController,
|
||||
withKeyPath: "values.\(identifier)",
|
||||
options: [.valueTransformer: self.keyEqTransformer]
|
||||
)
|
||||
menuItem.bind(
|
||||
NSBindingName("keyEquivalentModifierMask"),
|
||||
to: self.shortcutsDefaultsController,
|
||||
withKeyPath: "values.\(identifier)",
|
||||
options: [.valueTransformer: self.keyEqModTransformer]
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private func initShortcutItems() {
|
||||
guard let mainMenu = NSApplication.shared.mainMenu else { return }
|
||||
let firstLevel = mainMenu.items
|
||||
.suffix(from: 1)
|
||||
.filter { $0.identifier != debugMenuItemIdentifier }
|
||||
|
||||
var queue = firstLevel.map {
|
||||
(
|
||||
parent: self.shortcutItemsRoot,
|
||||
shortcutItem: ShortcutItem(title: $0.title, isLeaf: false, item: $0)
|
||||
)
|
||||
}
|
||||
while (!queue.isEmpty) {
|
||||
guard let entry = queue.popLast() else { break }
|
||||
|
||||
if !entry.shortcutItem.isLeaf
|
||||
|| entry.shortcutItem
|
||||
.identifier?
|
||||
.hasPrefix("com.qvacua.vimr.menuitems.") == true {
|
||||
|
||||
entry.parent.children?.append(entry.shortcutItem)
|
||||
}
|
||||
|
||||
if entry.shortcutItem.isContainer,
|
||||
let childMenuItems = entry.shortcutItem.item?.submenu?.items {
|
||||
|
||||
let shortcutChildItems = childMenuItems
|
||||
.filter { !$0.title.isEmpty }
|
||||
.map { menuItem in
|
||||
(
|
||||
parent: entry.shortcutItem,
|
||||
shortcutItem: ShortcutItem(title: menuItem.title,
|
||||
isLeaf: !menuItem.hasSubmenu,
|
||||
item: menuItem)
|
||||
)
|
||||
}
|
||||
queue.append(contentsOf: shortcutChildItems)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func addViews() {
|
||||
let paneTitle = self.paneTitleTextField(title: "Shortcuts")
|
||||
|
||||
let shortcutList = self.shortcutList
|
||||
shortcutList.delegate = self
|
||||
|
||||
let shortcutScrollView = self.shortcutScrollView
|
||||
shortcutScrollView.documentView = shortcutList
|
||||
|
||||
let reset = self.resetButton
|
||||
reset.title = "Reset All to Default"
|
||||
reset.bezelStyle = .rounded
|
||||
reset.isBordered = true
|
||||
reset.setButtonType(.momentaryPushIn)
|
||||
reset.target = self
|
||||
reset.action = #selector(ShortcutsPref.resetToDefault)
|
||||
|
||||
self.addSubview(paneTitle)
|
||||
self.addSubview(shortcutScrollView)
|
||||
self.addSubview(reset)
|
||||
|
||||
paneTitle.autoPinEdge(toSuperviewEdge: .top, withInset: 18)
|
||||
paneTitle.autoPinEdge(toSuperviewEdge: .left, withInset: 18)
|
||||
paneTitle.autoPinEdge(
|
||||
toSuperviewEdge: .right, withInset: 18, relation: .greaterThanOrEqual
|
||||
)
|
||||
|
||||
shortcutScrollView.autoPinEdge(
|
||||
.top, to: .bottom, of: paneTitle, withOffset: 18
|
||||
)
|
||||
shortcutScrollView.autoPinEdge(.left, to: .left, of: paneTitle)
|
||||
shortcutScrollView.autoPinEdge(toSuperviewEdge: .right, withInset: 18)
|
||||
|
||||
reset.autoPinEdge(.left, to: .left, of: paneTitle)
|
||||
reset.autoPinEdge(.top, to: .bottom, of: shortcutScrollView, withOffset: 18)
|
||||
reset.autoPinEdge(toSuperviewEdge: .bottom, withInset: 18)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Actions
|
||||
extension ShortcutsPref {
|
||||
|
||||
@objc func resetToDefault(_ sender: NSButton) {
|
||||
guard let window = self.window else { return }
|
||||
|
||||
let alert = NSAlert()
|
||||
alert.addButton(withTitle: "Cancel")
|
||||
alert.addButton(withTitle: "Reset")
|
||||
|
||||
alert.messageText = "Do you want to reset all shortcuts to their default values?"
|
||||
alert.alertStyle = .warning
|
||||
alert.beginSheetModal(for: window, completionHandler: { response in
|
||||
guard response == .alertSecondButtonReturn else { return }
|
||||
self.traverseMenuItems { identifier, _ in
|
||||
self.shortcutsDefaultsController.setValue(
|
||||
defaultShortcuts[identifier],
|
||||
forKeyPath: "values.\(identifier)"
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - NSOutlineViewDelegate
|
||||
extension ShortcutsPref {
|
||||
|
||||
private func isUppercase(_ str: String) -> Bool {
|
||||
for c in str.unicodeScalars {
|
||||
if !CharacterSet.uppercaseLetters.contains(c) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func outlineView(
|
||||
_ outlineView: NSOutlineView,
|
||||
rowViewForItem item: Any
|
||||
) -> NSTableRowView? {
|
||||
let view = self.shortcutList.makeView(
|
||||
withIdentifier: NSUserInterfaceItemIdentifier("shortcut-row-view"),
|
||||
owner: self
|
||||
) as? ShortcutTableRow
|
||||
?? ShortcutTableRow(withIdentifier: "shortcut-row-view")
|
||||
|
||||
return view
|
||||
}
|
||||
|
||||
func outlineView(
|
||||
_: NSOutlineView,
|
||||
viewFor tableColumn: NSTableColumn?,
|
||||
item: Any
|
||||
) -> NSView? {
|
||||
let cellView = self.shortcutList.makeView(
|
||||
withIdentifier: NSUserInterfaceItemIdentifier("shortcut-cell-view"),
|
||||
owner: self
|
||||
) as? ShortcutTableCell
|
||||
?? ShortcutTableCell(withIdentifier: "shortcut-cell-view")
|
||||
|
||||
let repObj = (item as? NSTreeNode)?.representedObject
|
||||
guard let item = repObj as? ShortcutItem else { return nil }
|
||||
guard let identifier = item.identifier else { return cellView }
|
||||
|
||||
cellView.isDir = !item.isLeaf
|
||||
cellView.text = item.title
|
||||
|
||||
if item.isContainer {
|
||||
cellView.customized = false
|
||||
cellView.layoutViews()
|
||||
return cellView
|
||||
}
|
||||
|
||||
cellView.customized = !self.shortcutsAreEqual(
|
||||
self.shortcutsDefaultsController
|
||||
.value(forKeyPath: "values.\(identifier)"),
|
||||
defaultShortcuts[identifier]
|
||||
)
|
||||
cellView.layoutViews()
|
||||
cellView.setDelegateOfRecorder(self)
|
||||
cellView.bindRecorder(
|
||||
toKeyPath: "values.\(identifier)",
|
||||
to: self.shortcutsDefaultsController
|
||||
)
|
||||
|
||||
return cellView
|
||||
}
|
||||
|
||||
func outlineView(_: NSOutlineView, heightOfRowByItem item: Any) -> CGFloat {
|
||||
return 28
|
||||
}
|
||||
|
||||
private func shortcutsAreEqual(_ lhs: Any?, _ rhs: Any?) -> Bool {
|
||||
if lhs == nil && rhs == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
guard let lhsShortcut = lhs as? [String: Any],
|
||||
let rhsShortcut = rhs as? [String: Any]
|
||||
else {
|
||||
return false
|
||||
}
|
||||
|
||||
if lhsShortcut.isEmpty && rhsShortcut.isEmpty {
|
||||
return true
|
||||
}
|
||||
|
||||
if lhsShortcut[SRShortcutCharacters] as? String
|
||||
!= rhsShortcut[SRShortcutCharacters] as? String {
|
||||
return false
|
||||
}
|
||||
|
||||
if lhsShortcut[SRShortcutCharactersIgnoringModifiers] as? String
|
||||
!= rhsShortcut[SRShortcutCharactersIgnoringModifiers] as? String {
|
||||
return false
|
||||
}
|
||||
|
||||
if lhsShortcut[SRShortcutKeyCode] as? Int
|
||||
!= rhsShortcut[SRShortcutKeyCode] as? Int {
|
||||
return false
|
||||
}
|
||||
|
||||
if lhsShortcut[SRShortcutModifierFlagsKey] as? Int
|
||||
!= rhsShortcut[SRShortcutModifierFlagsKey] as? Int {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - SRRecorderControlDelegate
|
||||
extension ShortcutsPref {
|
||||
|
||||
func shortcutRecorderDidEndRecording(_ sender: SRRecorderControl!) {
|
||||
self.treeController.rearrangeObjects()
|
||||
}
|
||||
}
|
127
VimR/VimR/ShortcutsTableSubviews.swift
Normal file
127
VimR/VimR/ShortcutsTableSubviews.swift
Normal file
@ -0,0 +1,127 @@
|
||||
/**
|
||||
* Tae Won Ha - http://taewon.de - @hataewon
|
||||
* See LICENSE
|
||||
*/
|
||||
|
||||
import Cocoa
|
||||
import ShortcutRecorder
|
||||
|
||||
class ShortcutTableRow: NSTableRowView {
|
||||
|
||||
init(withIdentifier identifier: String) {
|
||||
super.init(frame: .zero)
|
||||
self.identifier = NSUserInterfaceItemIdentifier(identifier)
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
}
|
||||
|
||||
class ShortcutTableCell: NSTableCellView {
|
||||
|
||||
static let font = NSFont.systemFont(ofSize: 13)
|
||||
static let boldFont = NSFont.boldSystemFont(ofSize: 13)
|
||||
|
||||
var customized = false
|
||||
var isDir = false
|
||||
|
||||
var text: String {
|
||||
get {
|
||||
return self.textField!.stringValue
|
||||
}
|
||||
|
||||
set {
|
||||
self.textField?.stringValue = newValue
|
||||
}
|
||||
}
|
||||
|
||||
func setDelegateOfRecorder(_ delegate: SRRecorderControlDelegate) {
|
||||
self.shortcutRecorder.delegate = delegate
|
||||
}
|
||||
|
||||
func bindRecorder(toKeyPath keypath: String, to content: Any) {
|
||||
self.shortcutRecorder.unbind(.value)
|
||||
self.shortcutRecorder.bind(
|
||||
.value, to: content, withKeyPath: keypath
|
||||
)
|
||||
}
|
||||
|
||||
init(withIdentifier identifier: String) {
|
||||
super.init(frame: .zero)
|
||||
|
||||
self.identifier = NSUserInterfaceItemIdentifier(identifier)
|
||||
|
||||
self.textField = self._textField
|
||||
|
||||
let textField = self._textField
|
||||
textField.font = ShortcutTableCell.font
|
||||
textField.isBordered = true
|
||||
textField.isBezeled = false
|
||||
textField.allowsEditingTextAttributes = false
|
||||
textField.isEditable = false
|
||||
textField.usesSingleLineMode = true
|
||||
textField.drawsBackground = false
|
||||
|
||||
let recorder = self.shortcutRecorder
|
||||
recorder.allowsEscapeToCancelRecording = true
|
||||
recorder.allowsDeleteToClearShortcutAndEndRecording = true
|
||||
recorder.storesEmptyValueForNoShortcut = true
|
||||
recorder.setAllowedModifierFlags(
|
||||
[.command, .shift, .option, .control],
|
||||
requiredModifierFlags: [],
|
||||
allowsEmptyModifierFlags: false
|
||||
)
|
||||
recorder.allowsDeleteToClearShortcutAndEndRecording = true
|
||||
}
|
||||
|
||||
func reset() -> ShortcutTableCell {
|
||||
self.text = ""
|
||||
self.removeAllSubviews()
|
||||
return self
|
||||
}
|
||||
|
||||
func layoutViews() {
|
||||
let textField = self._textField
|
||||
let recorder = self.shortcutRecorder
|
||||
|
||||
textField.removeFromSuperview()
|
||||
recorder.removeFromSuperview()
|
||||
|
||||
if self.isDir {
|
||||
textField.font = ShortcutTableCell.boldFont
|
||||
} else {
|
||||
textField.font = ShortcutTableCell.font
|
||||
}
|
||||
if self.customized {
|
||||
textField.textColor = .blue
|
||||
} else {
|
||||
textField.textColor = .textColor
|
||||
}
|
||||
|
||||
self.addSubview(textField)
|
||||
guard !self.isDir else {
|
||||
textField.autoPinEdgesToSuperviewEdges(
|
||||
with: NSEdgeInsets(top: 3, left: 4, bottom: 3, right: 12)
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
self.addSubview(recorder)
|
||||
|
||||
recorder.autoPinEdge(toSuperviewEdge: .right, withInset: 12)
|
||||
recorder.autoPinEdge(toSuperviewEdge: .top, withInset: 2)
|
||||
recorder.autoSetDimension(.width, toSize: 180)
|
||||
textField.autoPinEdge(toSuperviewEdge: .left, withInset: 4)
|
||||
textField.autoPinEdge(.right, to: .left, of: recorder, withOffset: -8)
|
||||
textField.autoPinEdge(toSuperviewEdge: .top, withInset: 3)
|
||||
}
|
||||
|
||||
private let shortcutRecorder = SRRecorderControl(forAutoLayout: ())
|
||||
private let _textField = NSTextField(forAutoLayout: ())
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
# 0.26.0-???
|
||||
|
||||
* GH-314: You can customize the key shortcut for all menu items in the *Shortcut* preferences pane.
|
||||
* Draw the disclosure triangle in appropriate color of the current color scheme (and improve handling of changes of `cwd` in the file browser).
|
||||
* ...
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user