From f2ada1ca50a75201a9da71a66cc8481f9009f5cd Mon Sep 17 00:00:00 2001
From: Ivica Ico Bukvic <ico@vt.edu>
Date: Sun, 7 Sep 2014 11:49:43 -0400
Subject: [PATCH] *added dirty message to preset_hub so that it reports
 whenever its nodes have changed values (which means there are unstored
 values)

---
 pd/src/x_preset.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/pd/src/x_preset.c b/pd/src/x_preset.c
index bccaac395..b31e289bb 100644
--- a/pd/src/x_preset.c
+++ b/pd/src/x_preset.c
@@ -46,6 +46,7 @@
 //==================== forward declarations ========================//
 
 void preset_hub_add_a_node(t_preset_hub *h, t_preset_node *x);
+void preset_hub_dirty(t_preset_hub *h);
 void preset_hub_recall(t_preset_hub *h, t_float f);
 void preset_hub_store(t_preset_hub *h, t_float f);
 void preset_hub_delete_a_node(t_preset_hub *h, t_preset_node *x);
@@ -550,7 +551,8 @@ static void preset_node_anything(t_preset_node *x, t_symbol *s, int argc, t_atom
             break;
         }
     }
-    
+    if (x->pn_hub)
+        preset_hub_dirty(x->pn_hub);    
 }
 
 //======== following functions are for interaction with the hub/pd =======//
@@ -997,6 +999,13 @@ void preset_hub_bang(t_preset_hub *x)
     outlet_anything(x->ph_outlet, gensym("current"), 1, ap);
 }
 
+void preset_hub_dirty(t_preset_hub *x)
+{
+    t_atom ap[1];
+    SETFLOAT(ap+0, (t_float)1);
+    outlet_anything(x->ph_outlet, gensym("dirty"), 1, ap);    
+}
+
 void preset_hub_recall(t_preset_hub *x, t_float f)
 {
     if(PH_DEBUG) fprintf(stderr,"hub_recall\n");
-- 
GitLab