Update of /cvsroot/pure-data/externals/popup In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5362
Modified Files: gop-test.pd popup-help.pd popup.c Added Files: README.build.txt README.txt Log Message: The first argument is now pixel rather than character width, bounding-box is drawn correctly, and added a little documentation and GPL.
--- NEW FILE: README.build.txt --- These objects where developed under OSX and have been tested under OSX and Linux.
To build (under linux):
make pd_linux
To build (under OSX):
make pd_darwin
--- NEW FILE: README.txt --- This is the readme for "popup" a popup menu for PD.
popup is Copyright Ben Bogart 2003
If you have any questions/comments you can reach the author at ben@ekran.org.
This program is distributed under the terms of the GNU General Public License
PSO is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
PSO is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with PSO; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
USAGE:
PD: Put it in your extra folder.
Arguments: [pixel width] [background colour] [name] [opt1] [opt2] [...]
Methods:
float Select index value name [name] Popup's name bgcolour [colour] Background Colour (white, green, #5500ff) options [opt1] [...] List of the popup options
Have Fun.
Index: gop-test.pd =================================================================== RCS file: /cvsroot/pure-data/externals/popup/gop-test.pd,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** gop-test.pd 20 Feb 2004 20:25:32 -0000 1.1 --- gop-test.pd 10 Mar 2004 21:40:13 -0000 1.2 *************** *** 1,4 **** #N canvas 441 293 131 47 10; ! #X obj 0 5 popup 10 grey90 1024x512 opt1; #X obj 0 0 cnv 15 128 40 empty empty empty 20 12 0 14 -233017 -66577 0; --- 1,4 ---- #N canvas 441 293 131 47 10; ! #X obj 0 5 popup 124 grey90 1024x512 opt1; #X obj 0 0 cnv 15 128 40 empty empty empty 20 12 0 14 -233017 -66577 0;
Index: popup-help.pd =================================================================== RCS file: /cvsroot/pure-data/externals/popup/popup-help.pd,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** popup-help.pd 20 Feb 2004 20:25:32 -0000 1.1 --- popup-help.pd 10 Mar 2004 21:40:13 -0000 1.2 *************** *** 1,20 **** ! #N canvas 154 131 623 309 10; ! #X obj 78 188 popup 10 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 msg 129 111 bgcolour white; #X obj 79 233 print index; ! #X msg 99 81 name popup; ! #X msg 56 53 width 10; #X obj 181 234 print symbol; #X floatatom 33 32 5 0 0 0 - - -; ! #X msg 146 137 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 connect 0 0 2 0; ! #X connect 0 1 5 0; ! #X connect 1 0 0 0; ! #X connect 3 0 0 0; #X connect 4 0 0 0; #X connect 6 0 0 0; - #X connect 7 0 0 0; --- 1,18 ---- ! #N canvas 154 131 631 317 10; ! #X obj 78 188 popup 124 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 79 233 print index; ! #X msg 91 68 name popup; #X obj 181 234 print symbol; #X floatatom 33 32 5 0 0 0 - - -; ! #X msg 138 124 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 121 98 bgcolour black; ! #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;
Index: popup.c =================================================================== RCS file: /cvsroot/pure-data/externals/popup/popup.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** popup.c 22 Feb 2004 19:04:43 -0000 1.2 --- popup.c 10 Mar 2004 21:40:13 -0000 1.3 *************** *** 39,43 **** int x_width; - int x_char_width; int x_num_options; t_symbol* x_colour; --- 39,42 ---- *************** *** 119,128 **** int len,i; t_canvas *canvas=glist_getcanvas(glist); ! x->x_rect_width = x->x_width+10; ! x->x_rect_height = x->x_height*20+9;
/* Create menubutton and empty menu widget -- maybe the menu should be created elseware?*/ ! sys_vgui("set %xw .x%x.c.s%x ; menubutton $%xw -relief raised -width "%d" -background "%s" -text "%s" -direction flush -menu $%xw.menu ; menu $%xw.menu -tearoff 0\n", ! x,canvas,x,x,x->x_char_width,x->x_colour->s_name,x->x_name->s_name,x,x);
for(i=0 ; i<x->x_num_options ; i++) --- 118,127 ---- int len,i; t_canvas *canvas=glist_getcanvas(glist); ! x->x_rect_width = x->x_width; ! x->x_rect_height = x->x_height+2;
/* Create menubutton and empty menu widget -- maybe the menu should be created elseware?*/ ! sys_vgui("set %xw .x%x.c.s%x ; menubutton $%xw -relief raised -background "%s" -text "%s" -direction flush -menu $%xw.menu ; menu $%xw.menu -tearoff 0\n", ! x,canvas,x,x,x->x_colour->s_name,x->x_name->s_name,x,x);
for(i=0 ; i<x->x_num_options ; i++) *************** *** 143,148 **** create_widget(x,glist); x->x_glist = canvas; ! sys_vgui(".x%x.c create window %d %d -anchor nw -window .x%x.c.s%x -tags %xS\n", ! canvas,text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),x->x_glist,x,x);
} --- 142,147 ---- create_widget(x,glist); x->x_glist = canvas; ! sys_vgui(".x%x.c create window %d %d -width %d -height 25 -anchor nw -window .x%x.c.s%x -tags %xS\n", ! canvas,text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist), x->x_width, x->x_glist,x,x);
} *************** *** 298,302 **** binbuf_addv(b, "ssiisiss", gensym("#X"),gensym("obj"), x->x_obj.te_xpix, x->x_obj.te_ypix , ! gensym("popup"), x->x_char_width, x->x_colour, x->x_name); /* Loop for menu items */ for(i=0 ; i<x->x_num_options ; i++) --- 297,301 ---- binbuf_addv(b, "ssiisiss", gensym("#X"),gensym("obj"), x->x_obj.te_xpix, x->x_obj.te_ypix , ! gensym("popup"), x->x_width, x->x_colour, x->x_name); /* Loop for menu items */ for(i=0 ; i<x->x_num_options ; i++) *************** *** 325,335 **** }
- /* function to change width of popup */ - void popup_width(t_popup* x, t_floatarg w) - { - x->x_char_width = (int)w; - sys_vgui(".x%x.c.s%x configure -width %d\n", x->x_glist, x, x->x_char_width); - } - /* function to change colour of popup background */ void popup_bgcolour(t_popup* x, t_symbol* col) --- 324,327 ---- *************** *** 371,380 ****
! x->x_height = 1; if (argc < 4) { post("popup: You must enter at least 4 arguments. Default values used."); ! x->x_char_width = 10; x->x_num_options = 1; x->x_colour = gensym("#ffffff"); --- 363,372 ----
! x->x_height = 25; if (argc < 4) { post("popup: You must enter at least 4 arguments. Default values used."); ! x->x_width = 124; x->x_num_options = 1; x->x_colour = gensym("#ffffff"); *************** *** 385,389 **** } else { /* Copy args into structure */ ! x->x_char_width = atom_getint(argv); x->x_colour = atom_getsymbol(argv+1); x->x_name = atom_getsymbol(argv+2); --- 377,381 ---- } else { /* Copy args into structure */ ! x->x_width = atom_getint(argv); x->x_colour = atom_getsymbol(argv+1); x->x_name = atom_getsymbol(argv+2); *************** *** 397,404 **** }
- /* TODO .. ask the popup for its width -- "[canvas] itemcget [tags] -width" -- but how to pass the data back?*/ - /* x->x_width = x->x_char_width*10; tuned for OSX */ - x->x_width = x->x_char_width*7; /* tuned for Linux */ - /* Bind the recieve "popup%p" to the widget outlet*/ sprintf(buf,"popup%p",x); --- 389,392 ---- *************** *** 423,431 **** 0);
- class_addmethod(popup_class, (t_method)popup_width, - gensym("width"), - A_DEFFLOAT, - 0); - class_addmethod(popup_class, (t_method)popup_name, gensym("name"), --- 411,414 ----