[PD-cvs] SF.net SVN: pure-data:[10593] branches/pd-extended/0.41/pd/src

eighthave at users.sourceforge.net eighthave at users.sourceforge.net
Thu Jan 22 02:02:15 CET 2009


Revision: 10593
          http://pure-data.svn.sourceforge.net/pure-data/?rev=10593&view=rev
Author:   eighthave
Date:     2009-01-22 01:02:15 +0000 (Thu, 22 Jan 2009)

Log Message:
-----------
- created "Do you want to save the changes" Yes/No/Cancel dialog for handling
  unsaved changes.

- this commit is the same as create_save_yesnocancel_dialog-0.41.4.patch and
  patch #2527413 in the tracker

Modified Paths:
--------------
    branches/pd-extended/0.41/pd/src/g_editor.c
    branches/pd-extended/0.41/pd/src/u_main.tk

Modified: branches/pd-extended/0.41/pd/src/g_editor.c
===================================================================
--- branches/pd-extended/0.41/pd/src/g_editor.c	2009-01-21 23:31:54 UTC (rev 10592)
+++ branches/pd-extended/0.41/pd/src/g_editor.c	2009-01-22 01:02:15 UTC (rev 10593)
@@ -1684,11 +1684,10 @@
         /* find all root canvases */
     for (g = canvas_list; g; g = g->gl_next)
         if (g2 = glist_finddirty(g))
-    {
-        canvas_vis(g2, 1);
-        sys_vgui(
-"pdtk_check .x%lx {Discard changes to '%s'?} {.x%lx menuclose 3;\n} no\n",
-            canvas_getrootfor(g2), canvas_getrootfor(g2)->gl_name->s_name, g2);
+        {
+            canvas_vis(g2, 1);
+            sys_vgui("pdtk_canvas_menuclose .x%lx {.x%lx menuclose 3;\n}\n",
+                     canvas_getrootfor(g2), g2);
         return;
     }
     if (f == 0)
@@ -1715,9 +1714,8 @@
         if (g)
         {
             canvas_vis(g, 1);
-            sys_vgui(
-"pdtk_check .x%lx {Discard changes to '%s'?} {.x%lx menuclose 2;\n} no\n",
-                canvas_getrootfor(g), canvas_getrootfor(g)->gl_name->s_name, g);
+            sys_vgui("pdtk_canvas_menuclose .x%lx {.x%lx menuclose 2;\n}\n",
+                     canvas_getrootfor(g), g);
             return;
         }
         else
@@ -1741,9 +1739,8 @@
         if (g)
         {
             canvas_vis(g, 1);
-            sys_vgui(
-"pdtk_check .x%lx {Discard changes to '%s'?} {.x%lx menuclose 2;\n} no\n",
-                canvas_getrootfor(x), canvas_getrootfor(x)->gl_name->s_name, g);
+            sys_vgui("pdtk_canvas_menuclose .x%lx {.x%lx menuclose 2;\n}\n",
+                     canvas_getrootfor(x), g);
             return;
         }
         else pd_free(&x->gl_pd);

Modified: branches/pd-extended/0.41/pd/src/u_main.tk
===================================================================
--- branches/pd-extended/0.41/pd/src/u_main.tk	2009-01-21 23:31:54 UTC (rev 10592)
+++ branches/pd-extended/0.41/pd/src/u_main.tk	2009-01-22 01:02:15 UTC (rev 10593)
@@ -424,10 +424,27 @@
         set answer [tk_messageBox -message $x -type yesno -default $default \
             -parent $canvas -icon question]
     }
-	puts stderr "raise $canvas"
     if {! [string compare $answer yes]}  {pd $message}
 }
 
+##### ask user Save? Discard? Cancel?, and if so, send a message on to Pd ######
+proc pdtk_canvas_menuclose {window reply} {
+	global pd_nt
+	raise $window
+	set filename [wm title $window]
+	set message [format {Do you want to save the changes you made in "%s"?} $filename]
+	set answer [tk_messageBox -message $message -type yesnocancel -default "yes" \
+					-parent $window -icon question]
+	switch -- $answer {
+		yes { 
+			pd [concat $window menusave \;]
+			pd $reply
+		}
+		no {pd $reply}
+		cancel {}
+	}
+}
+
 set menu_windowlist {} 
 
 proc pdtk_fixwindowmenu {} {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Pd-cvs mailing list