Update of /cvsroot/pure-data/externals/bbogart/popup
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2004
Modified Files:
README.txt popup-help.pd popup.c
Log Message:
Added "append" method, fixed bug with background colour, added proper args to README
Index: popup.c
===================================================================
RCS file: /cvsroot/pure-data/externals/bbogart/popup/popup.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** popup.c 7 Nov 2004 17:53:46 -0000 1.8
--- popup.c 13 Dec 2004 23:56:59 -0000 1.9
***************
*** 155,159 ****
canvas, x, x->x_options[i]->s_name, canvas, x, x->x_options[i]->s_name, x, i);
}
!
DEBUG(post("id: .x%x.c.s%x", canvas, x);)
DEBUG(post("create_widget end");)
--- 155,159 ----
canvas, x, x->x_options[i]->s_name, canvas, x, x->x_options[i]->s_name, x, i);
}
!
DEBUG(post("id: .x%x.c.s%x", canvas, x);)
DEBUG(post("create_widget end");)
***************
*** 183,186 ****
--- 183,189 ----
DEBUG(post("drawme end");)
+
+ // Output a bang to first outlet when we're ready to receive float messages the first time!.
+ if(firsttime) {outlet_bang(x->x_obj.ob_outlet);}
}
***************
*** 383,391 ****
/* function to change colour of popup background */
! void popup_bgcolour(t_popup* x, t_symbol* col)
{
DEBUG(post("bgcolour start");)
! x->x_colour->s_name = col->s_name;
sys_vgui(".x%x.c.s%x configure -background \"%s\"\n", x->x_glist, x, col->s_name);
}
--- 386,394 ----
/* function to change colour of popup background */
! static void popup_bgcolour(t_popup* x, t_symbol* col)
{
DEBUG(post("bgcolour start");)
! x->x_colour = col;
sys_vgui(".x%x.c.s%x configure -background \"%s\"\n", x->x_glist, x, col->s_name);
}
***************
*** 417,420 ****
--- 420,461 ----
}
+ /* Function to append symbols to popup list
+ static void popup_append(t_popup* x, t_symbol *item)
+ {
+ // Add menu item
+ sys_vgui(".x%x.c.s%x.menu add command -label \"%s\" -command {.x%x.c.s%x configure -text \"%s\" ; popup_sel%x \"%d\"} \n",
+ x->x_glist, x, item->s_name, x->x_glist, x, item->s_name, x, (x->x_num_options-1) );
+
+ post("orig num_options: %d", x->x_num_options);
+
+ // Incriment num_options
+ x->x_num_options++;
+
+ post("post num_options: %d", x->x_num_options);
+ } */
+
+ /* Function to append symbols to popup list */
+ void popup_append(t_popup* x, t_symbol *s, int argc, t_atom *argv)
+ {
+ DEBUG(post("append start");)
+
+ int i, new_limit;
+
+ new_limit = x->x_num_options + argc;
+
+ for(i=x->x_num_options ; i<new_limit ; i++)
+ {
+ x->x_options[i] = atom_getsymbol(argv+i-x->x_num_options);
+ sys_vgui(".x%x.c.s%x.menu add command -label \"%s\" -command {.x%x.c.s%x configure -text \"%s\" ; popup_sel%x \"%d\"} \n",
+ x->x_glist, x, x->x_options[i]->s_name, x->x_glist, x, x->x_options[i]->s_name, x, i);
+ }
+
+ x->x_num_options = new_limit;
+
+ DEBUG(post("append end");)
+ }
+
+
+
static t_class *popup_class;
***************
*** 472,475 ****
--- 513,517 ----
DEBUG(post("popup new end");)
+
}
***************
*** 500,503 ****
--- 542,551 ----
A_DEFSYMBOL,
0);
+
+ class_addmethod(popup_class, (t_method)popup_append,
+ gensym("append"),
+ A_GIMME,
+ 0);
+
class_doaddfloat(popup_class, (t_method)popup_iselect);
Index: popup-help.pd
===================================================================
RCS file: /cvsroot/pure-data/externals/bbogart/popup/popup-help.pd,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** popup-help.pd 17 Oct 2004 01:24:23 -0000 1.4
--- popup-help.pd 13 Dec 2004 23:56:59 -0000 1.5
***************
*** 1,20 ****
! #N canvas 154 131 631 317 10;
! #X obj 66 220 popup 124 25 white duh! one two three four five six seven
! eight nine ten eleven twelve thirteen i14 i15 i16 i17 i18 i19 i20 i21
! i22 i23 i24 i25 i26 i26 i27 i28 i29 i30;
! #X obj 67 265 print index;
! #X msg 79 100 name popup;
! #X obj 169 266 print symbol;
! #X floatatom 44 78 5 0 0 0 - - -;
! #X msg 126 156 options one two three four five six seven eight nine
! ten eleven twelve thirteen i14 i15 i16 i17 i18 i19 i20 i21 i22 i23
! i24 i25 i26 i26 i27 i28 i29 i30;
! #X msg 109 130 bgcolour black;
#X text 13 11 popup \, a popup menu for PD. Copyright Ben Bogart 2004
Released under the GPL.;
! #X connect 0 0 1 0;
#X connect 0 1 3 0;
#X connect 2 0 0 0;
#X connect 4 0 0 0;
! #X connect 5 0 0 0;
! #X connect 6 0 0 0;
--- 1,35 ----
! #N canvas 119 198 631 397 10;
! #X obj 106 300 popup 124 25 grey90 duh! one two three four five six
! seven eight nine ten eleven twelve thirteen i14 i15 i16 i17 i18 i19
! i20 i21 i22 i23 i24 i25 i26 i27 i28 i29 i30;
! #X obj 152 359 print index;
! #X msg 96 108 name popup;
! #X obj 239 359 print symbol;
! #X floatatom 43 94 5 0 0 0 - - -;
#X text 13 11 popup \, a popup menu for PD. Copyright Ben Bogart 2004
Released under the GPL.;
! #X text 14 43 Left outlet sends out a bang on load \, used to set default
! value. Using a loadbang to send a float will result in a crash.;
! #X msg 173 235 options;
! #X msg 166 186 options one two three four five six seven eight nine
! ten eleven twelve thirteen i14 i15 i16 i17 i18 i19 i20 i21 i22 i23
! i24 i25 i26 i27 i28 i29 i30;
! #X msg 184 261 append append-one append-two append-three;
! #X obj 106 332 route bang;
! #X msg 33 298 10;
! #X text 187 332 Choose 10 as the default value on load \, does send
! output.;
! #X msg 119 133 bgcolour #047992;
! #X msg 149 160 bgcolour grey90;
! #X connect 0 0 10 0;
#X connect 0 1 3 0;
#X connect 2 0 0 0;
#X connect 4 0 0 0;
! #X connect 7 0 0 0;
! #X connect 8 0 0 0;
! #X connect 9 0 0 0;
! #X connect 10 0 11 0;
! #X connect 10 1 1 0;
! #X connect 11 0 0 0;
! #X connect 13 0 0 0;
! #X connect 14 0 0 0;
Index: README.txt
===================================================================
RCS file: /cvsroot/pure-data/externals/bbogart/popup/README.txt,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** README.txt 5 Nov 2004 15:44:44 -0000 1.3
--- README.txt 13 Dec 2004 23:56:58 -0000 1.4
***************
*** 27,31 ****
Put the helpfile in your 5.reference folder.
! Arguments: [pixel width] [background colour] [name] [opt1] [opt2] [...]
Methods:
--- 27,31 ----
Put the helpfile in your 5.reference folder.
! Arguments: [pixel width] [pixel height] [background colour] [name] [opt1] [opt2] [...]
Methods:
***************
*** 35,41 ****
--- 35,44 ----
bgcolour [colour] Background Colour (white, green, #5500ff)
options [opt1] [...] List of the popup options
+ append [opt1] [...] Add the arg list to the bottom of the current options
BUGS:
- Do not use a loadbang to set a patch-default value. Will cause a segfault.
+ The left outlet will send a "bang" message when we're ready to set values,
+ see example patch on how to use this to set a default value.
Have Fun.