[PD-cvs] pd/src desire.c, 1.1.2.97, 1.1.2.98 desire.tk, 1.1.2.301, 1.1.2.302

Mathieu Bouchard matju at users.sourceforge.net
Tue Aug 8 21:52:50 CEST 2006


Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24707

Modified Files:
      Tag: devel_0_39
	desire.c desire.tk 
Log Message:
Window menu


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.301
retrieving revision 1.1.2.302
diff -C2 -d -r1.1.2.301 -r1.1.2.302
*** desire.tk	8 Aug 2006 18:15:38 -0000	1.1.2.301
--- desire.tk	8 Aug 2006 19:52:47 -0000	1.1.2.302
***************
*** 511,515 ****
  	.mbar add cascade -label [say $t] -menu [menu .mbar.$t -tearoff $pd_tearoff]
      }
!     .mbar.window configure -postcommand fixwindowmenu
      foreach z {in out} {
  	set f .controls.$z
--- 511,515 ----
  	.mbar add cascade -label [say $t] -menu [menu .mbar.$t -tearoff $pd_tearoff]
      }
!     .mbar.window configure -postcommand "$self fix_window_menu"
      foreach z {in out} {
  	set f .controls.$z
***************
*** 666,681 ****
  proc pdtk_watchdog {} {pd pd ping; after 2000 {pdtk_watchdog}}
  
- set menu_windowlist {} 
- 
- proc pdtk_fixwindowmenu {} {fixwindowmenu}
- proc fixwindowmenu {} {
-     global menu_windowlist
-     .mbar.window delete 0 end
-     foreach {i j} $menu_windowlist {
- 	.mbar.window add command -label $i -command "menu_domenuwindow [lindex $i 1]]"
-         menu_fixwindowmenu $j
-     }
- }
- 
  proc accel_munge {acc} {
      global OS
--- 666,669 ----
***************
*** 698,701 ****
--- 686,690 ----
  	eval [concat [list super] $args]
  	set @accel {}
+ 	set @menubar .$self.m
  }
  
***************
*** 710,717 ****
  }
  
- set main [Client new]
- $main init_controls
- $main init_binds
- 
  def Client open_file {} {
      global pd_opendir
--- 699,702 ----
***************
*** 782,786 ****
  }
  
! $main init_menus
  
  def* Menuable eval% {code} {
--- 767,779 ----
  }
  
! def Client init {} {
!   super
!   set @menubar .mbar
!   $self init_controls
!   $self init_binds
!   $self init_menus
! }
! 
! set main [Client new]
  
  def* Menuable eval% {code} {
***************
*** 1120,1124 ****
  
  def* Canvas init {x1 y1 xs ys args} {
!     global pd_opendir pd_tearoff OS cmdline canvas history manager
      super
      # those four are not to be confused with other @variables of the same name.
--- 1113,1118 ----
  
  def* Canvas init {x1 y1 xs ys args} {
!     global pd_opendir pd_tearoff OS cmdline canvas history manager window_list
!     lappend window_list $self
      super
      # those four are not to be confused with other @variables of the same name.
***************
*** 1194,1197 ****
--- 1188,1198 ----
  }
  
+ def Canvas _delete {} {
+ 	global window_list
+ 	set wl {}
+ 	foreach w $window_list {if {$w != $self} {lappend wl $w}}
+ 	set window_list $wl
+ }
+ 
  def Canvas focus {} {return $@focus}
  def Canvas focus= {o} {set @focus $o}
***************
*** 1321,1326 ****
  	Graph Array}
      $self populate_menu window {{}}
- #	{"parentwindow" {menu_windowparent} ""}
- #	{"Pdwindow" {menu_pop_pd} ""}
  
      $m.edit add checkbutton -label [say edit_mode] \
--- 1322,1325 ----
***************
*** 1333,1337 ****
      }
      $m.edit   configure -postcommand "$self fix_edit_menu"
!     $m.window configure -postcommand "menu_fixwindowmenu"
  
      foreach x {file edit view find put media window help} {
--- 1332,1336 ----
      }
      $m.edit   configure -postcommand "$self fix_edit_menu"
!     $m.window configure -postcommand "$self fix_window_menu"
  
      foreach x {file edit view find put media window help} {
***************
*** 1368,1371 ****
--- 1367,1380 ----
  }
  
+ set window_list [list $main]
+ 
+ def Menuable fix_window_menu {} {
+     global window_list
+     set menu $@menubar.window
+     $menu delete 0 end
+ #	{"parentwindow" {menu_windowparent} ""}
+     foreach w $window_list {$menu add command -label $w -command "$w raise"}
+ }
+ 
  #-----------------------------------------------------------------------------------#
  #this just tells whether an object is part of the selection, that is, what usually 
***************
*** 2693,2697 ****
  #-----------------------------------------------------------------------------------#
  
! def* Canvas keyup {x y key iso shift} {
      set canvas .$self.c
      if {$shift} {
--- 2702,2706 ----
  #-----------------------------------------------------------------------------------#
  
! def Canvas keyup {x y key iso shift} {
      set canvas .$self.c
      if {$shift} {
***************
*** 5705,5709 ****
          pack [label .$self.title -text "DesireData 0.39.A.0" -font {helvetica 24}] -side top
  	pack [label .$self.date -text "released on 2006.07.??"] -side top
! 	pack [text .$self.text -yscrollcommand ".$self.scroll set"] -side left
  	pack [scrollbar .$self.scroll -command ".$self.text yview"] -side right -fill y
  #12345678901234567890123456789012345678901234567890123456789012345678901 <- 72 chars
--- 5714,5719 ----
          pack [label .$self.title -text "DesireData 0.39.A.0" -font {helvetica 24}] -side top
  	pack [label .$self.date -text "released on 2006.07.??"] -side top
! 	pack [text .$self.text -yscrollcommand ".$self.scroll set" -width 72
! 		] -side left -fill both -expand yes
  	pack [scrollbar .$self.scroll -command ".$self.text yview"] -side right -fill y
  #12345678901234567890123456789012345678901234567890123456789012345678901 <- 72 chars

Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.97
retrieving revision 1.1.2.98
diff -C2 -d -r1.1.2.97 -r1.1.2.98
*** desire.c	7 Aug 2006 16:41:49 -0000	1.1.2.97
--- desire.c	8 Aug 2006 19:52:47 -0000	1.1.2.98
***************
*** 293,334 ****
  static t_atom *canvas_newargv;
  
- static void glist_doupdatewindowlist(t_glist *gl, char *sbuf)
- {
-     t_gobj *g;
-     if (!gl->gl_owner)
-     {
-         /* this is a canvas; if we have a window, put on "windows" list */
-         t_canvas *canvas = (t_canvas *)gl;
-         if (canvas->gl_havewindow)
-         {
-             if (strlen(sbuf) + strlen(gl->gl_name->s_name) + 100 <= 1024)
-             {
-                 char tbuf[1024];
-                 sprintf(tbuf, "{%s .x%lx} ", gl->gl_name->s_name,
-                     (t_int)canvas);
-                 strcat(sbuf, tbuf);
-             }
-         }
-     }
-     glist_each(g,gl) {
-         if (pd_class(&g->g_pd) == canvas_class)
-             glist_doupdatewindowlist((t_glist *)g, sbuf);
-     }
- }
- 
-     /* maintain the list of visible toplevels for the GUI's "windows" menu */
- void canvas_updatewindowlist( void)
- {
-     t_canvas *x;
-     char sbuf[1024];
-     strcpy(sbuf, "set menu_windowlist {");
-         /* find all root canvases */
-     for (x = canvas_list; x; x = x->gl_next)
-         glist_doupdatewindowlist(x, sbuf);
-     /* next line updates the window menu state before -postcommand tries it */
-     strcat(sbuf, "}\npdtk_fixwindowmenu\n");
-     sys_gui(sbuf);
- }
- 
      /* add a glist the list of "root" canvases (toplevels without parents.) */
  static void canvas_addtolist(t_canvas *x) {
--- 293,296 ----
***************
*** 893,897 ****
              canvas_reflecttitle(x);
              x->gl_havewindow = 1;
-             canvas_updatewindowlist();
  	    post("******subscribe %lx",(long)x);
  	    gobj_subscribe((t_gobj *)x,(t_gobj *)manager);
--- 855,858 ----
***************
*** 928,932 ****
              if (glist_isvisible(gl2)) gobj_vis(&x->gl_gobj, gl2, 1);
          } else x->gl_havewindow = 0;
-         canvas_updatewindowlist();
      }
  }
--- 889,892 ----
***************
*** 11374,11380 ****
      	    canvas_restoreconnections(glist_getcanvas(glist));
      	}
- 	if (natom2 >= 1  && vec2[0].a_type == A_SYMBOL
- 	    && !strcmp(vec2[0].a_w.w_symbol->s_name, "pd"))
- 		canvas_updatewindowlist();
      }
      else binbuf_text(x->te_binbuf, buf, bufsize);
--- 11334,11337 ----
***************
*** 12691,12695 ****
  void canvas_notice(t_gobj *x, struct _gobj *origin, int argc, t_atom *argv) {
  	t_canvas *self = (t_canvas *)x;
! 	post("canvas_notice(%p,%p,%d,...): havewindow=%d mapped=%d",x,origin,argc,self->gl_havewindow,self->gl_mapped);
  	gobj_changed3(self,origin,argc,argv);
  }
--- 12648,12653 ----
  void canvas_notice(t_gobj *x, struct _gobj *origin, int argc, t_atom *argv) {
  	t_canvas *self = (t_canvas *)x;
! 	/*post("canvas_notice(%p,%p,%d,...): havewindow=%d mapped=%d",
! 		x,origin,argc,self->gl_havewindow,self->gl_mapped);*/
  	gobj_changed3(self,origin,argc,argv);
  }





More information about the Pd-cvs mailing list