2015-07-16 23:53:53 +00:00
|
|
|
//
|
|
|
|
// AppDelegate.swift
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 16/07/2015.
|
2018-05-13 19:19:52 +00:00
|
|
|
// Copyright 2015 Thomas Harte. All rights reserved.
|
2015-07-16 23:53:53 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
import Cocoa
|
|
|
|
|
|
|
|
@NSApplicationMain
|
|
|
|
class AppDelegate: NSObject, NSApplicationDelegate {
|
|
|
|
|
2016-09-16 02:12:12 +00:00
|
|
|
func applicationDidFinishLaunching(_ aNotification: Notification) {
|
2019-08-05 01:34:30 +00:00
|
|
|
// Insert code here to initialize your application.
|
2015-07-16 23:53:53 +00:00
|
|
|
}
|
|
|
|
|
2016-09-16 02:12:12 +00:00
|
|
|
func applicationWillTerminate(_ aNotification: Notification) {
|
2019-08-05 01:34:30 +00:00
|
|
|
// Insert code here to tear down your application.
|
2015-07-16 23:53:53 +00:00
|
|
|
}
|
|
|
|
|
2019-09-22 17:59:31 +00:00
|
|
|
private var hasShownOpenDocument = false
|
2016-09-16 02:12:12 +00:00
|
|
|
func applicationShouldOpenUntitledFile(_ sender: NSApplication) -> Bool {
|
2019-09-21 22:01:16 +00:00
|
|
|
// Decline to show the 'New...' selector by default; the 'Open...'
|
|
|
|
// dialogue has already been shown if this application was started
|
|
|
|
// without a file.
|
2019-08-05 01:34:30 +00:00
|
|
|
//
|
|
|
|
// Obiter: I dislike it when other applications do this for me, but it
|
|
|
|
// seems to be the new norm, and I've had user feedback that showing
|
|
|
|
// nothing is confusing. So here it is.
|
2019-09-22 17:59:31 +00:00
|
|
|
if !hasShownOpenDocument {
|
|
|
|
NSDocumentController.shared.openDocument(self)
|
|
|
|
hasShownOpenDocument = true
|
|
|
|
}
|
2016-01-07 02:09:49 +00:00
|
|
|
return false
|
|
|
|
}
|
2015-07-16 23:53:53 +00:00
|
|
|
}
|