[PD-cvs] externals/bbogart/popup README.txt,1.5,1.6 popup.c,1.10,1.11

B. Bogart bbogart at users.sourceforge.net
Mon Jan 17 22:07:02 CET 2005


Update of /cvsroot/pure-data/externals/bbogart/popup
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13075

Modified Files:
	README.txt popup.c 
Log Message:
Fixed resetting name on shade/minimize/desktop switch.


Index: popup.c
===================================================================
RCS file: /cvsroot/pure-data/externals/bbogart/popup/popup.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** popup.c	14 Jan 2005 20:12:00 -0000	1.10
--- popup.c	17 Jan 2005 21:06:59 -0000	1.11
***************
*** 53,56 ****
--- 53,57 ----
       int x_width;
  	 
+      int current_selection;
       int x_num_options;	 
       t_symbol* x_colour;
***************
*** 139,142 ****
--- 140,144 ----
    char text[MAXPDSTRING];
    int len,i;
+   t_symbol* temp_name;
    t_canvas *canvas=glist_getcanvas(glist);
    x->x_rect_width = x->x_width;
***************
*** 145,153 ****
    /* Create menubutton and empty menu widget -- maybe the menu should be created elseware?*/
  
    /* Seems we have to delete the widget in case it already exists (Provided by Guenter)*/
    sys_vgui("destroy .x%x.c.s%x\n",glist_getcanvas(glist),x);
  
    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++)
--- 147,163 ----
    /* Create menubutton and empty menu widget -- maybe the menu should be created elseware?*/
  
+   /* draw using the last name if it was selected otherwise use default name. */
+   if(x->current_selection < 0)
+   {
+     temp_name = x->x_name;
+   } else {
+     temp_name = x->x_options[x->current_selection];
+   }
+ 
    /* Seems we have to delete the widget in case it already exists (Provided by Guenter)*/
    sys_vgui("destroy .x%x.c.s%x\n",glist_getcanvas(glist),x);
  
    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,temp_name->s_name,x,x);
  
    for(i=0 ; i<x->x_num_options ; i++)
***************
*** 183,186 ****
--- 193,197 ----
  
    // Output a bang to first outlet when we're ready to receive float messages the first time!. 
+   // Too bad this is NOT always the first time... window shading makes the bang go out again. :(
    if(firsttime) {outlet_bang(x->x_obj.ob_outlet);}
  
***************
*** 338,341 ****
--- 349,353 ----
    DEBUG(post("output start");)
  
+   x->current_selection = popup_index;
    outlet_symbol(x->out2, x->x_options[(int)popup_index]);
    outlet_float(x->x_obj.ob_outlet, popup_index); 
***************
*** 413,416 ****
--- 425,429 ----
  		sys_vgui(".x%x.c.s%x configure -text \"%s\" ; popup_sel%x \"%d\" \n",
  			glist_getcanvas(x->x_glist), x, x->x_options[i]->s_name,x, i);
+ 
  	} else {
  		post("popup: Valid menu selections are from %d to %d\npopup: You entered %d.", 0, x->x_num_options, i);
***************
*** 478,483 ****
      x->x_glist = (t_glist*)NULL;
  
-     
      x->x_height = 25;
  	
  	if (argc < 5)
--- 491,496 ----
      x->x_glist = (t_glist*)NULL;
  
      x->x_height = 25;
+     x->current_selection = -1;
  	
  	if (argc < 5)
***************
*** 519,526 ****
      outlet_new(&x->x_obj, &s_float);
      x->out2 = outlet_new(&x->x_obj, &s_symbol);
-     return (x);
  
!     DEBUG(post("popup new end");)
  
  }
  
--- 532,539 ----
      outlet_new(&x->x_obj, &s_float);
      x->out2 = outlet_new(&x->x_obj, &s_symbol);
  
! DEBUG(post("popup new end");)
  
+     return (x);
  }
  

Index: README.txt
===================================================================
RCS file: /cvsroot/pure-data/externals/bbogart/popup/README.txt,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** README.txt	14 Jan 2005 20:14:36 -0000	1.5
--- README.txt	17 Jan 2005 21:06:59 -0000	1.6
***************
*** 40,47 ****
  - 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.
! 
! - If you change virtual desktops or "shade" the patcher window the selection 
!   visible on the popup will be reset to the popup-name.
  
  Have Fun.
--- 40,46 ----
  - 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. Unfortunatly 
!   this bang message is actually set on un-minimization and un-shading as 
!   well as on load.
  
  Have Fun.





More information about the Pd-cvs mailing list