aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--grid/CHANGES.LOG2
-rw-r--r--grid/grid-help.pd37
-rw-r--r--grid/grid.c61
-rw-r--r--grid/help-grid.pd5
4 files changed, 86 insertions, 19 deletions
diff --git a/grid/CHANGES.LOG b/grid/CHANGES.LOG
index e548bc5..9d8c8a4 100644
--- a/grid/CHANGES.LOG
+++ b/grid/CHANGES.LOG
@@ -1,3 +1,5 @@
+0.8
+ path from alberto zin : change color thru messages
0.7
fixed coordinates for GOP support
0.6
diff --git a/grid/grid-help.pd b/grid/grid-help.pd
index b31c29e..23d6cc5 100644
--- a/grid/grid-help.pd
+++ b/grid/grid-help.pd
@@ -1,7 +1,7 @@
#N canvas 26 1 763 647 10;
-#X obj 71 76 grid grid1 200 0 199 200 0 199 1 1 1 10 10 188 197;
-#X floatatom 72 293 5 0 0;
-#X floatatom 257 282 5 0 0;
+#X obj 72 77 grid grid1 200 0 199 200 0 199 1 1 1 10 10 72 77;
+#X floatatom 72 293 5 0 0 0 - - -;
+#X floatatom 257 282 5 0 0 0 - - -;
#X text 41 21 Grid is a 2-dimensional control object;
#X text 319 449 (invoke with <right mouse>Properties );
#X text 322 439 You can set the following properties :;
@@ -28,12 +28,12 @@ grid;
#X msg 587 271 \; pd dsp 0;
#X msg 653 271 \; pd dsp 1;
#X obj 276 417 *~;
-#X floatatom 276 360 0 0 0;
+#X floatatom 276 360 0 0 0 0 - - -;
#X obj 357 397 line~;
-#X floatatom 188 380 0 0 0;
+#X floatatom 188 380 0 0 0 0 - - -;
#X obj 188 494 cos~;
#X obj 188 450 +~;
-#X floatatom 228 506 0 0 100;
+#X floatatom 228 506 0 0 100 0 - - -;
#N canvas 159 26 495 270 output 0;
#X obj 338 160 t b;
#X obj 338 110 f;
@@ -89,7 +89,7 @@ grid;
#X msg 266 506 MUTE;
#X obj 276 385 osc~ 0;
#X obj 357 371 pack 0 50;
-#X floatatom 357 318 0 0 0;
+#X floatatom 357 318 0 0 0 0 - - -;
#X obj 357 345 / 100;
#X text 188 345 carrier;
#X text 184 355 frequency;
@@ -104,34 +104,34 @@ grid;
#X text 393 325 in hundredths;
#X text 40 32 It was inspired by the chaospad device;
#X text 346 568 * Y step : Y delta for an Y update;
-#X floatatom 474 85 5 0 0;
-#X floatatom 586 84 5 0 0;
+#X floatatom 474 85 5 0 0 0 - - -;
+#X floatatom 586 84 5 0 0 0 - - -;
#X obj 411 82 pack f f;
#X msg 332 81 goto \$1 \$2;
#X msg 546 83 bang;
#X text 524 84 X;
#X text 333 63 Set position :;
#X text 631 85 Y;
-#X floatatom 486 120 5 0 0;
-#X floatatom 586 121 5 0 0;
+#X floatatom 486 120 5 0 0 0 - - -;
+#X floatatom 586 121 5 0 0 0 - - -;
#X obj 423 119 pack f f;
#X msg 546 120 bang;
#X text 530 120 X;
#X text 634 121 Y;
-#X floatatom 528 156 5 0 0;
-#X floatatom 633 156 5 0 0;
+#X floatatom 528 156 5 0 0 0 - - -;
+#X floatatom 633 156 5 0 0 0 - - -;
#X obj 465 153 pack f f;
#X msg 593 154 bang;
#X text 578 155 X;
#X text 679 156 Y;
-#X floatatom 503 191 5 0 0;
-#X floatatom 607 190 5 0 0;
+#X floatatom 503 191 5 0 0 0 - - -;
+#X floatatom 607 190 5 0 0 0 - - -;
#X obj 440 188 pack f f;
#X msg 568 189 bang;
#X text 553 190 X;
#X text 656 191 Y;
-#X floatatom 539 224 5 0 0;
-#X floatatom 638 226 5 0 0;
+#X floatatom 539 224 5 0 0 0 - - -;
+#X floatatom 638 226 5 0 0 0 - - -;
#X obj 472 223 pack f f;
#X msg 600 224 bang;
#X text 585 225 X;
@@ -145,6 +145,8 @@ grid;
#X text 334 170 Set values without changing output :;
#X text 332 205 Set deltas for values without changing output:;
#X msg 334 223 xvaluemotion \$1 \$2;
+#X msg 334 250 color 123 45 185;
+#X text 461 250 change bg color ( from alberto zin );
#X connect 0 0 1 0;
#X connect 0 1 2 0;
#X connect 1 0 23 0;
@@ -196,3 +198,4 @@ grid;
#X connect 84 0 0 0;
#X connect 85 0 0 0;
#X connect 88 0 0 0;
+#X connect 89 0 0 0;
diff --git a/grid/grid.c b/grid/grid.c
index 416960f..87b749f 100644
--- a/grid/grid.c
+++ b/grid/grid.c
@@ -35,7 +35,7 @@ static int gridcount=0;
static int guidebug=0;
static int pointsize = 5;
-static char *grid_version = "grid: version 0.7, written by Yves Degoyon (ydegoyon@free.fr)";
+static char *grid_version = "grid: version 0.8, written by Yves Degoyon (ydegoyon@free.fr)";
#define GRID_SYS_VGUI2(a,b) if (guidebug) \
post(a,b);\
@@ -251,6 +251,37 @@ static void grid_output_current(t_grid* x)
outlet_float( x->x_youtlet, yvalue );
}
+/*az new method to change color */
+static void grid_draw_new_color(t_grid *x, t_glist *glist, char *col)
+{
+ t_canvas *canvas=glist_getcanvas(glist);
+ char *tagRoot;
+ char str1[80];
+
+ strcpy (str1,".x%x.c itemconfigure %xGRID -fill #");
+ strcat (str1,col);
+ strcat (str1,"\n");
+ tagRoot = rtext_gettag(glist_findrtext(glist,(t_text *)x));
+ GRID_SYS_VGUI3(str1, canvas, x);
+ GRID_SYS_VGUI3(".x%x.c delete %so0\n", canvas, tagRoot);
+ GRID_SYS_VGUI3(".x%x.c delete %so1\n", canvas, tagRoot);
+ /*az redraw point if needed*/
+ if ( x->x_point )
+ {
+ grid_draw_update(x, glist);
+ }
+ GRID_SYS_VGUI7(".x%x.c create rectangle %d %d %d %d -tags %so0\n",
+ canvas, text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist) + x->x_height+1,
+ text_xpix(&x->x_obj, glist)+7, text_ypix(&x->x_obj, glist) + x->x_height+2,
+ tagRoot);
+ GRID_SYS_VGUI7(".x%x.c create rectangle %d %d %d %d -tags %so1\n",
+ canvas, text_xpix(&x->x_obj, glist)+x->x_width-7, text_ypix(&x->x_obj, glist) + x->x_height+1,
+ text_xpix(&x->x_obj, glist)+x->x_width, text_ypix(&x->x_obj, glist) + x->x_height+2,
+ tagRoot);
+
+ canvas_fixlinesfor( canvas, (t_text*)x );
+}
+
/* ------------------------ grid widgetbehaviour----------------------------- */
@@ -431,6 +462,33 @@ static void grid_goto(t_grid *x, t_floatarg newx, t_floatarg newy)
}
}
+
+static void grid_new_color(t_grid *x, t_floatarg color1, t_floatarg color2, t_floatarg color3)
+{
+ char col[30], col1[10], col2[10], col3[10];
+
+ sprintf(col1,"%X",(int) color1);
+ if (color1 < 17)
+ sprintf(col1,"0%X",(int) color1);
+ else
+ sprintf(col1,"%X",(int) color1);
+
+ if (color2 < 17)
+ sprintf(col2,"0%X",(int) color2);
+ else
+ sprintf(col2,"%X",(int) color2);
+
+ if (color3 < 17)
+ sprintf(col3,"0%X",(int) color3);
+ else
+ sprintf(col3,"%X",(int) color3);
+ strcpy( col, col1);
+ strcat( col, col2 );
+ strcat( col, col3 );
+
+ grid_draw_new_color( x, x->x_glist, col);
+}
+
static void grid_values(t_grid* x, t_floatarg xvalue, t_floatarg yvalue)
{
int xold = x->x_current;
@@ -657,6 +715,7 @@ void grid_setup(void)
A_FLOAT, A_FLOAT, 0);
class_addmethod(grid_class, (t_method)grid_goto, gensym("goto"), A_FLOAT, A_FLOAT, 0);
class_addmethod(grid_class, (t_method)grid_dialog, gensym("dialog"), A_GIMME, 0);
+ class_addmethod(grid_class, (t_method)grid_new_color, gensym("color"), A_FLOAT, A_FLOAT, A_FLOAT, 0);
grid_widgetbehavior.w_getrectfn = grid_getrect;
grid_widgetbehavior.w_displacefn = grid_displace;
grid_widgetbehavior.w_selectfn = grid_select;
diff --git a/grid/help-grid.pd b/grid/help-grid.pd
index 663237f..23d6cc5 100644
--- a/grid/help-grid.pd
+++ b/grid/help-grid.pd
@@ -1,5 +1,5 @@
#N canvas 26 1 763 647 10;
-#X obj 72 77 grid grid1 200 0 199 200 0 199 1 1 1 10 10 192 224;
+#X obj 72 77 grid grid1 200 0 199 200 0 199 1 1 1 10 10 72 77;
#X floatatom 72 293 5 0 0 0 - - -;
#X floatatom 257 282 5 0 0 0 - - -;
#X text 41 21 Grid is a 2-dimensional control object;
@@ -145,6 +145,8 @@ grid;
#X text 334 170 Set values without changing output :;
#X text 332 205 Set deltas for values without changing output:;
#X msg 334 223 xvaluemotion \$1 \$2;
+#X msg 334 250 color 123 45 185;
+#X text 461 250 change bg color ( from alberto zin );
#X connect 0 0 1 0;
#X connect 0 1 2 0;
#X connect 1 0 23 0;
@@ -196,3 +198,4 @@ grid;
#X connect 84 0 0 0;
#X connect 85 0 0 0;
#X connect 88 0 0 0;
+#X connect 89 0 0 0;