Better message for duplicate / template open
This commit is contained in:
parent
b27739bb1c
commit
72fb3482a5
|
@ -108,9 +108,15 @@ class ASApplication: NSObject, NSApplicationDelegate, NSMenuDelegate {
|
|||
ASSerialWin.showWindowWithPort(port.title)
|
||||
}
|
||||
|
||||
func openTemplate(template: NSURL) {
|
||||
func openTemplate(template: NSURL, fromReadOnly: Bool) {
|
||||
let editable : String
|
||||
if fromReadOnly {
|
||||
editable = "editable "
|
||||
} else {
|
||||
editable = ""
|
||||
}
|
||||
ASApplication.newProjectLocation(nil,
|
||||
message: "Save editable copy of project \(template.lastPathComponent)")
|
||||
message: "Save \(editable)copy of project \(template.lastPathComponent!)")
|
||||
{ (saveTo) -> Void in
|
||||
let oldName = template.lastPathComponent!
|
||||
let newName = saveTo.lastPathComponent!
|
||||
|
@ -151,7 +157,7 @@ class ASApplication: NSObject, NSApplicationDelegate, NSMenuDelegate {
|
|||
|
||||
@IBAction func openExample(item: NSMenuItem) {
|
||||
let url = NSURL(fileURLWithPath: examples[item.tag])
|
||||
openTemplate(url.URLByDeletingLastPathComponent!)
|
||||
openTemplate(url.URLByDeletingLastPathComponent!, fromReadOnly:true)
|
||||
}
|
||||
|
||||
@IBAction func createSketch(_: AnyObject) {
|
||||
|
|
|
@ -236,7 +236,7 @@ class ASProjDoc: NSDocument, NSOutlineViewDelegate, NSMenuDelegate, NSOpenSavePa
|
|||
|
||||
override func duplicateDocument(sender: AnyObject?) {
|
||||
let app = NSApplication.sharedApplication().delegate as! ASApplication
|
||||
app.openTemplate(fileURL!.URLByDeletingLastPathComponent!)
|
||||
app.openTemplate(fileURL!.URLByDeletingLastPathComponent!, fromReadOnly:false)
|
||||
}
|
||||
|
||||
func updateLog(_: AnyObject?) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user