From 355e1d7cfc8eddca01192d43de7769367199dc13 Mon Sep 17 00:00:00 2001
From: Ivica Ico Bukvic <ico@vt.edu>
Date: Thu, 1 Aug 2013 22:08:36 -0400
Subject: [PATCH] added K12 Demos menu item in the File menu

---
 pd/src/pd.tk | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/pd/src/pd.tk b/pd/src/pd.tk
index 2394c1ebe..82220c670 100644
--- a/pd/src/pd.tk
+++ b/pd/src/pd.tk
@@ -1100,6 +1100,24 @@ proc menu_open {} {
 	}
 }
 
+proc menu_k12_open_demos {} {
+	global pd_guidir filetypes
+	if { ! [file isdirectory $pd_guidir/extra/K12/demos]} {
+		set files [tk_getOpenFile -defaultextension .pd \
+						  -multiple true \
+		                  -filetypes $filetypes -initialdir $pd_guidir/extra/]
+	} else {
+		set files [tk_getOpenFile -defaultextension .pd \
+						  -multiple true \
+		                  -filetypes $filetypes -initialdir $pd_guidir/extra/K12/demos]
+	}
+    if {$files != ""} {
+		foreach filename $files {
+			open_file $filename
+		}
+	}	
+}
+
 proc pdtk_set_current_dir {path_and_filename} {
 	global pd_opendir untitled_directory
 	set directory [file dirname $path_and_filename]
@@ -2729,6 +2747,10 @@ proc pdtk_canvas_new {name width height geometry editable} {
     $name.m.file add command -label Open -command {menu_open} \
         -accelerator [accel_munge "Ctrl+o"]
 
+	if { $k12_mode == 1 } {
+		$name.m.file add command -label {K12 Demos} -command {menu_k12_open_demos}
+	}
+
     $name.m.file add  separator
     $name.m.file add command -label Close \
         -command [concat menu_close $name] \
-- 
GitLab