[PD-cvs] pd/src g_canvas.c, 1.7, 1.8 g_canvas.h, 1.7, 1.8 g_editor.c, 1.7, 1.8 g_graph.c, 1.6, 1.7 g_readwrite.c, 1.4, 1.5 g_rtext.c, 1.4, 1.5 g_template.c, 1.8, 1.9 g_text.c, 1.7, 1.8 makefile.nt, 1.3, 1.4 notes.txt, 1.12, 1.13 u_main.tk, 1.10, 1.11

Miller Puckette millerpuckette at users.sourceforge.net
Sat Jul 2 07:03:08 CEST 2005


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

Modified Files:
	g_canvas.c g_canvas.h g_editor.c g_graph.c g_readwrite.c 
	g_rtext.c g_template.c g_text.c makefile.nt notes.txt 
	u_main.tk 
Log Message:
new graph-on-parent behavior - no more of the stretching behavior.  Existing
patches should behave compatibly, but new ones will work differently (much
much better.)



Index: g_text.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_text.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** g_text.c	18 May 2005 04:28:51 -0000	1.7
--- g_text.c	2 Jul 2005 05:03:06 -0000	1.8
***************
*** 951,961 ****
  }
  
!     /* return true if the text box should be drawn.
!     We don't show object boxes inside graphs. */
  int text_shouldvis(t_text *x, t_glist *glist)
  {
      return (glist->gl_havewindow ||
          (x->te_pd != canvas_class && x->te_pd->c_wb != &text_widgetbehavior) ||
!         (x->te_pd == canvas_class && (((t_glist *)x)->gl_isgraph)));
  }
  
--- 951,962 ----
  }
  
!     /* return true if the text box should be drawn.  We don't show text boxes
!     inside graphs---except comments, if we're doing the new (goprect) style. */
  int text_shouldvis(t_text *x, t_glist *glist)
  {
      return (glist->gl_havewindow ||
          (x->te_pd != canvas_class && x->te_pd->c_wb != &text_widgetbehavior) ||
!         (x->te_pd == canvas_class && (((t_glist *)x)->gl_isgraph)) ||
!         (glist->gl_goprect && (x->te_type == T_TEXT)));
  }
  

Index: u_main.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/u_main.tk,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** u_main.tk	25 Jun 2005 02:49:15 -0000	1.10
--- u_main.tk	2 Jul 2005 05:03:06 -0000	1.11
***************
*** 1747,1751 ****
  ############ pdtk_gatom_dialog -- run a gatom dialog #########
  
! # see graph_apply, etc., for comments about handling variable names here...
  
  proc gatom_escape {sym} {
--- 1747,1758 ----
  ############ pdtk_gatom_dialog -- run a gatom dialog #########
  
! # dialogs like this one can come up in many copies; but in TK the easiest
! # way to get data from an "entry", etc., is to set an associated variable
! # name.  This is especially true for grouped "radio buttons".  So we have
! # to synthesize variable names for each instance of the dialog.  The dialog
! # gets a TK pathname $id, from which it strips the leading "." to make a
! # variable suffix $vid.  Then you can get the actual value out by asking for
! # [eval concat $$variablename].  There should be an easier way but I don't see
! # it yet.
  
  proc gatom_escape {sym} {
***************
*** 1971,2109 ****
  }
  
- ############ pdtk_graph_dialog -- dialog window for graphs #########
- 
- # the graph and array dialogs can come up in many copies; but in TK the easiest
- # way to get data from an "entry", etc., is to set an associated variable
- # name.  This is especially true for grouped "radio buttons".  So we have
- # to synthesize variable names for each instance of the dialog.  The dialog
- # gets a TK pathname $id, from which it strips the leading "." to make a
- # variable suffix $vid.  Then you can get the actual value out by asking for
- # [eval concat $$variablename].  There should be an easier way but I don't see
- # it yet.
- 
- proc graph_apply {id} {
- # strip "." from the TK id to make a variable name suffix 
-     set vid [string trimleft $id .]
- # for each variable, make a local variable to hold its name...
-     set var_graph_x1 [concat graph_x1_$vid]
-     global $var_graph_x1
-     set var_graph_x2 [concat graph_x2_$vid]
-     global $var_graph_x2
-     set var_graph_xpix [concat graph_xpix_$vid]
-     global $var_graph_xpix
-     set var_graph_y1 [concat graph_y1_$vid]
-     global $var_graph_y1
-     set var_graph_y2 [concat graph_y2_$vid]
-     global $var_graph_y2
-     set var_graph_ypix [concat graph_ypix_$vid]
-     global $var_graph_ypix
- 
-     pd [concat $id dialog \
-     	[eval concat $$var_graph_x1] \
-     	[eval concat $$var_graph_y1] \
-     	[eval concat $$var_graph_x2] \
-     	[eval concat $$var_graph_y2] \
-     	[eval concat $$var_graph_xpix] \
-     	[eval concat $$var_graph_ypix] \
- 	\;]
- }
- 
- proc graph_cancel {id} {
-     set cmd [concat $id cancel \;]
- #    puts stderr $cmd
-     pd $cmd
- }
- 
- proc graph_ok {id} {
-     graph_apply $id
-     graph_cancel $id
- }
- 
- proc pdtk_graph_dialog {id x1 y1 x2 y2 xpix ypix} {
-     set vid [string trimleft $id .]
-     set var_graph_x1 [concat graph_x1_$vid]
-     global $var_graph_x1
-     set var_graph_x2 [concat graph_x2_$vid]
-     global $var_graph_x2
-     set var_graph_xpix [concat graph_xpix_$vid]
-     global $var_graph_xpix
-     set var_graph_y1 [concat graph_y1_$vid]
-     global $var_graph_y1
-     set var_graph_y2 [concat graph_y2_$vid]
-     global $var_graph_y2
-     set var_graph_ypix [concat graph_ypix_$vid]
-     global $var_graph_ypix
- 
-     set $var_graph_x1 $x1
-     set $var_graph_x2 $x2
-     set $var_graph_xpix $xpix
-     set $var_graph_y1 $y1
-     set $var_graph_y2 $y2
-     set $var_graph_ypix $ypix
- 
-     toplevel $id
-     wm title $id {graph}
-     wm protocol $id WM_DELETE_WINDOW [concat graph_cancel $id]
- 
-     label $id.label -text {GRAPH BOUNDS}
-     pack $id.label -side top
- 
-     frame $id.buttonframe
-     pack $id.buttonframe -side bottom -fill x -pady 2m
-     button $id.buttonframe.cancel -text {Cancel}\
-     	-command "graph_cancel $id"
-     button $id.buttonframe.apply -text {Apply}\
-     	-command "graph_apply $id"
-     button $id.buttonframe.ok -text {OK}\
-     	-command "graph_ok $id"
-     pack $id.buttonframe.cancel -side left -expand 1
-     pack $id.buttonframe.apply -side left -expand 1
-     pack $id.buttonframe.ok -side left -expand 1
-     
-     frame $id.xrangef
-     pack $id.xrangef -side top
-     
-     label $id.xrangef.l1 -text "X from:"
-     entry $id.xrangef.x1 -textvariable $var_graph_x1 -width 7
-     label $id.xrangef.l2 -text "to:"
-     entry $id.xrangef.x2 -textvariable $var_graph_x2 -width 7
-     label $id.xrangef.l3 -text "screen width:"
-     entry $id.xrangef.xpix -textvariable $var_graph_xpix -width 7
-     pack $id.xrangef.l1 $id.xrangef.x1 \
-     	 $id.xrangef.l2 $id.xrangef.x2 \
- 	 $id.xrangef.l3 $id.xrangef.xpix -side left
-     
-     frame $id.yrangef
-     pack $id.yrangef -side top
- 
- # dig in the following that the upper bound is labeled y1 but the variable is
- # y2, etc. This is to deal with the inconsistent use of "upper and lower"
- # graph bounds... in the dialog the upper Y bound is the lower valued Y pixel.
-     label $id.yrangef.l1 -text "Y from:"
-     entry $id.yrangef.y1 -textvariable $var_graph_y2 -width 7
-     label $id.yrangef.l2 -text "to:"
-     entry $id.yrangef.y2 -textvariable $var_graph_y1 -width 7
-     label $id.yrangef.l3 -text "screen height:"
-     entry $id.yrangef.ypix -textvariable $var_graph_ypix -width 7
-     pack $id.yrangef.l1 $id.yrangef.y1 \
-     	 $id.yrangef.l2 $id.yrangef.y2 \
- 	 $id.yrangef.l3 $id.yrangef.ypix -side left
- 
-     bind $id.xrangef.x1 <KeyPress-Return> [concat graph_ok $id]
-     bind $id.xrangef.x2 <KeyPress-Return> [concat graph_ok $id]
-     bind $id.xrangef.xpix <KeyPress-Return> [concat graph_ok $id]
-     bind $id.yrangef.y1 <KeyPress-Return> [concat graph_ok $id]
-     bind $id.yrangef.y2 <KeyPress-Return> [concat graph_ok $id]
-     bind $id.yrangef.ypix <KeyPress-Return> [concat graph_ok $id]
-     pdtk_standardkeybindings $id.xrangef.x1
-     pdtk_standardkeybindings $id.xrangef.x2
-     pdtk_standardkeybindings $id.xrangef.xpix
-     pdtk_standardkeybindings $id.yrangef.y1
-     pdtk_standardkeybindings $id.yrangef.y2
-     pdtk_standardkeybindings $id.yrangef.ypix
-     $id.xrangef.x2 select from 0
-     $id.xrangef.x2 select adjust end
-     focus $id.xrangef.x2
- }
  
  # begin of change "iemlib"
--- 1978,1981 ----
***************
*** 2836,2839 ****
--- 2708,2713 ----
  
  ############ pdtk_array_dialog -- dialog window for arrays #########
+ # see comments above (pdtk_gatom_dialog) about variable name handling 
+ 
  proc array_apply {id} {
  # strip "." from the TK id to make a variable name suffix 
***************
*** 2980,2987 ****
--- 2854,2864 ----
  
  ############ pdtk_canvas_dialog -- dialog window for canvass #########
+ # see comments above (pdtk_gatom_dialog) about variable name handling 
+ 
  proc canvas_apply {id} {
  # strip "." from the TK id to make a variable name suffix 
      set vid [string trimleft $id .]
  # for each variable, make a local variable to hold its name...
+ 
      set var_canvas_xscale [concat canvas_xscale_$vid]
      global $var_canvas_xscale
***************
*** 2990,2999 ****
      set var_canvas_graphme [concat canvas_graphme_$vid]
      global $var_canvas_graphme
! #    set var_canvas_stretch [concat canvas_stretch_$vid]
! #    global $var_canvas_stretch
      pd [concat $id donecanvasdialog \
      	[eval concat $$var_canvas_xscale] \
  	[eval concat $$var_canvas_yscale] \
      	[eval concat $$var_canvas_graphme] \
  	\;]
  }
--- 2867,2899 ----
      set var_canvas_graphme [concat canvas_graphme_$vid]
      global $var_canvas_graphme
!     set var_canvas_x1 [concat canvas_x1_$vid]
!     global $var_canvas_x1
!     set var_canvas_x2 [concat canvas_x2_$vid]
!     global $var_canvas_x2
!     set var_canvas_xpix [concat canvas_xpix_$vid]
!     global $var_canvas_xpix
!     set var_canvas_xmargin [concat canvas_xmargin_$vid]
!     global $var_canvas_xmargin
!     set var_canvas_y1 [concat canvas_y1_$vid]
!     global $var_canvas_y1
!     set var_canvas_y2 [concat canvas_y2_$vid]
!     global $var_canvas_y2
!     set var_canvas_ypix [concat canvas_ypix_$vid]
!     global $var_canvas_ypix
!     set var_canvas_ymargin [concat canvas_ymargin_$vid]
!     global $var_canvas_ymargin
! 
      pd [concat $id donecanvasdialog \
      	[eval concat $$var_canvas_xscale] \
  	[eval concat $$var_canvas_yscale] \
      	[eval concat $$var_canvas_graphme] \
+     	[eval concat $$var_canvas_x1] \
+     	[eval concat $$var_canvas_y1] \
+     	[eval concat $$var_canvas_x2] \
+     	[eval concat $$var_canvas_y2] \
+     	[eval concat $$var_canvas_xpix] \
+     	[eval concat $$var_canvas_ypix] \
+     	[eval concat $$var_canvas_xmargin] \
+     	[eval concat $$var_canvas_ymargin] \
  	\;]
  }
***************
*** 3009,3014 ****
  }
  
! proc pdtk_canvas_dialog {id xscale yscale graphme stretch} {
      set vid [string trimleft $id .]
  
      set var_canvas_xscale [concat canvas_xscale_$vid]
--- 2909,2915 ----
  }
  
! proc canvas_checkcommand {id} {
      set vid [string trimleft $id .]
+ #    puts stderr [concat canvas_checkcommand $id $vid]
  
      set var_canvas_xscale [concat canvas_xscale_$vid]
***************
*** 3018,3028 ****
      set var_canvas_graphme [concat canvas_graphme_$vid]
      global $var_canvas_graphme
! #    set var_canvas_stretch [concat canvas_stretch_$vid]
! #    global $var_canvas_stretch
  
      set $var_canvas_xscale $xscale
      set $var_canvas_yscale $yscale
      set $var_canvas_graphme $graphme
! #    set $var_canvas_stretch $stretch
  
      toplevel $id
--- 2919,3028 ----
      set var_canvas_graphme [concat canvas_graphme_$vid]
      global $var_canvas_graphme
!     set var_canvas_x1 [concat canvas_x1_$vid]
!     global $var_canvas_x1
!     set var_canvas_x2 [concat canvas_x2_$vid]
!     global $var_canvas_x2
!     set var_canvas_xpix [concat canvas_xpix_$vid]
!     global $var_canvas_xpix
!     set var_canvas_xmargin [concat canvas_xmargin_$vid]
!     global $var_canvas_xmargin
!     set var_canvas_y1 [concat canvas_y1_$vid]
!     global $var_canvas_y1
!     set var_canvas_y2 [concat canvas_y2_$vid]
!     global $var_canvas_y2
!     set var_canvas_ypix [concat canvas_ypix_$vid]
!     global $var_canvas_ypix
!     set var_canvas_ymargin [concat canvas_ymargin_$vid]
!     global $var_canvas_ymargin
! 
!     if { [eval concat $$var_canvas_graphme] != 0 } {
!         $id.xrange.entry1 configure -state normal
!         $id.xrange.entry2 configure -state normal
!         $id.xrange.entry3 configure -state normal
!         $id.xrange.entry4 configure -state normal
!         $id.yrange.entry1 configure -state normal
!         $id.yrange.entry2 configure -state normal
!         $id.yrange.entry3 configure -state normal
!         $id.yrange.entry4 configure -state normal
!         $id.xscale.entry configure -state disabled
!         $id.yscale.entry configure -state disabled
!         set x1 [eval concat $$var_canvas_x1]
!         set y1 [eval concat $$var_canvas_y1]
!         set x2 [eval concat $$var_canvas_x2]
!         set y2 [eval concat $$var_canvas_y2]
!         if { [eval concat $$var_canvas_x1] == 0 && \
!              [eval concat $$var_canvas_y1] == 0 && \
!              [eval concat $$var_canvas_x2] == 0 && \
!              [eval concat $$var_canvas_y2] == 0 } {
!                 set $var_canvas_x2 1
!                 set $var_canvas_y2 1
!         }
!         if { [eval concat $$var_canvas_xpix] == 0 } {
!             set $var_canvas_xpix 85
!             set $var_canvas_xmargin 100
!         }
!         if { [eval concat $$var_canvas_ypix] == 0 } {
!             set $var_canvas_ypix 60
!             set $var_canvas_ymargin 100
!         }
!     } else {
!         $id.xrange.entry1 configure -state disabled
!         $id.xrange.entry2 configure -state disabled
!         $id.xrange.entry3 configure -state disabled
!         $id.xrange.entry4 configure -state disabled
!         $id.yrange.entry1 configure -state disabled
!         $id.yrange.entry2 configure -state disabled
!         $id.yrange.entry3 configure -state disabled
!         $id.yrange.entry4 configure -state disabled
!         $id.xscale.entry configure -state normal
!         $id.yscale.entry configure -state normal
!         if { [eval concat $$var_canvas_xscale] == 0 } {
!             set $var_canvas_xscale 1
!         }
!         if { [eval concat $$var_canvas_yscale] == 0 } {
!             set $var_canvas_yscale -1
!         }
!     }
! }
! 
! proc pdtk_canvas_dialog {id xscale yscale graphme x1 y1 x2 y2 \
!     xpix ypix xmargin ymargin} {
!     set vid [string trimleft $id .]
! 
!     set var_canvas_xscale [concat canvas_xscale_$vid]
!     global $var_canvas_xscale
!     set var_canvas_yscale [concat canvas_yscale_$vid]
!     global $var_canvas_yscale
!     set var_canvas_graphme [concat canvas_graphme_$vid]
!     global $var_canvas_graphme
!     set var_canvas_x1 [concat canvas_x1_$vid]
!     global $var_canvas_x1
!     set var_canvas_x2 [concat canvas_x2_$vid]
!     global $var_canvas_x2
!     set var_canvas_xpix [concat canvas_xpix_$vid]
!     global $var_canvas_xpix
!     set var_canvas_xmargin [concat canvas_xmargin_$vid]
!     global $var_canvas_xmargin
!     set var_canvas_y1 [concat canvas_y1_$vid]
!     global $var_canvas_y1
!     set var_canvas_y2 [concat canvas_y2_$vid]
!     global $var_canvas_y2
!     set var_canvas_ypix [concat canvas_ypix_$vid]
!     global $var_canvas_ypix
!     set var_canvas_ymargin [concat canvas_ymargin_$vid]
!     global $var_canvas_ymargin
! 
  
      set $var_canvas_xscale $xscale
      set $var_canvas_yscale $yscale
      set $var_canvas_graphme $graphme
!     set $var_canvas_x1 $x1
!     set $var_canvas_y1 $y1
!     set $var_canvas_x2 $x2
!     set $var_canvas_y2 $y2
!     set $var_canvas_xpix $xpix
!     set $var_canvas_ypix $ypix
!     set $var_canvas_xmargin $xmargin
!     set $var_canvas_ymargin $ymargin
  
      toplevel $id
***************
*** 3030,3033 ****
--- 3030,3036 ----
      wm protocol $id WM_DELETE_WINDOW [concat canvas_cancel $id]
  
+     label $id.toplabel -text "Canvas Properties"
+     pack $id.toplabel -side top
+     
      frame $id.xscale
      pack $id.xscale -side top
***************
*** 3043,3053 ****
  
      checkbutton $id.graphme -text {graph on parent} \
!     	-variable $var_canvas_graphme -anchor w
      pack $id.graphme -side top
  
! #    checkbutton $id.stretch -text {stretch on resize} \
! #    	-variable $var_canvas_stretch -anchor w
! #    pack $id.stretch -side top
  
  
      frame $id.buttonframe
--- 3046,3084 ----
  
      checkbutton $id.graphme -text {graph on parent} \
!     	-variable $var_canvas_graphme -anchor w \
!         -command [concat canvas_checkcommand $id]
      pack $id.graphme -side top
  
!     frame $id.xrange
!     pack $id.xrange -side top
!     label $id.xrange.label1 -text "X range: from"
!     entry $id.xrange.entry1 -textvariable $var_canvas_x1 -width 6
!     label $id.xrange.label2 -text "to"
!     entry $id.xrange.entry2 -textvariable $var_canvas_x2 -width 6
!     label $id.xrange.label3 -text "size"
!     entry $id.xrange.entry3 -textvariable $var_canvas_xpix -width 4
!     label $id.xrange.label4 -text "margin"
!     entry $id.xrange.entry4 -textvariable $var_canvas_xmargin -width 4
!     pack $id.xrange.label1 $id.xrange.entry1 \
!         $id.xrange.label2 $id.xrange.entry2 \
!         $id.xrange.label3 $id.xrange.entry3 \
!         $id.xrange.label4 $id.xrange.entry4 \
!         -side left
  
+     frame $id.yrange
+     pack $id.yrange -side top
+     label $id.yrange.label1 -text "Y range: from"
+     entry $id.yrange.entry1 -textvariable $var_canvas_y1 -width 6
+     label $id.yrange.label2 -text "to"
+     entry $id.yrange.entry2 -textvariable $var_canvas_y2 -width 6
+     label $id.yrange.label3 -text "size"
+     entry $id.yrange.entry3 -textvariable $var_canvas_ypix -width 4
+     label $id.yrange.label4 -text "margin"
+     entry $id.yrange.entry4 -textvariable $var_canvas_ymargin -width 4
+     pack $id.yrange.label1 $id.yrange.entry1 \
+         $id.yrange.label2 $id.yrange.entry2 \
+         $id.yrange.label3 $id.yrange.entry3 \
+         $id.yrange.label4 $id.yrange.entry4 \
+         -side left
  
      frame $id.buttonframe
***************
*** 3070,3073 ****
--- 3101,3105 ----
      $id.xscale.entry select adjust end
      focus $id.xscale.entry
+     canvas_checkcommand $id
  }
  

Index: g_canvas.h
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_canvas.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** g_canvas.h	25 Jun 2005 02:49:15 -0000	1.7
--- g_canvas.h	2 Jul 2005 05:03:06 -0000	1.8
***************
*** 159,162 ****
--- 159,164 ----
      int gl_screenx2;
      int gl_screeny2;
+     int gl_xmargin;                /* origin for GOP rectangle */
+     int gl_ymargin;
      t_tick gl_xtick;            /* ticks marking X values */    
      int gl_nxlabels;            /* number of X coordinate labels */
***************
*** 179,183 ****
      unsigned int gl_edit:1;         /* edit mode */
      unsigned int gl_isdeleting:1;   /* we're inside glist_delete -- hack! */
!     unsigned int gl_stretch:1;      /* stretch contents on resize */
      unsigned int gl_isgraph:1;      /* show as graph on parent */
  };
--- 181,185 ----
      unsigned int gl_edit:1;         /* edit mode */
      unsigned int gl_isdeleting:1;   /* we're inside glist_delete -- hack! */
!     unsigned int gl_goprect:1;      /* draw rectangle for graph-on-parent */
      unsigned int gl_isgraph:1;      /* show as graph on parent */
  };

Index: makefile.nt
===================================================================
RCS file: /cvsroot/pure-data/pd/src/makefile.nt,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** makefile.nt	30 May 2005 03:04:18 -0000	1.3
--- makefile.nt	2 Jul 2005 05:03:06 -0000	1.4
***************
*** 48,54 ****
          $(PADIR)/pa_common/pa_cpuload.c \
          $(PADIR)/pa_common/pa_converters.c \
          $(PADIR)/pa_win/pa_win_util.c \
          $(PADIR)/pa_win/pa_win_hostapis.c \
!         $(PADIR)/pa_common/pa_allocation.c
  
  SRCASIO = $(PADIR)/pa_asio/pa_asio.cpp 
--- 48,55 ----
          $(PADIR)/pa_common/pa_cpuload.c \
          $(PADIR)/pa_common/pa_converters.c \
+         $(PADIR)/pa_common/pa_allocation.c \
          $(PADIR)/pa_win/pa_win_util.c \
          $(PADIR)/pa_win/pa_win_hostapis.c \
!         $(PADIR)/pa_win_wmme/pa_win_wmme.c
  
  SRCASIO = $(PADIR)/pa_asio/pa_asio.cpp 
***************
*** 61,65 ****
  PAOBJ = pa_stream.obj pa_trace.obj pa_skeleton.obj pa_process.obj \
  	pa_front.obj pa_dither.obj pa_cpuload.obj pa_converters.obj \
! 	pa_allocation.obj pa_win_util.obj pa_win_hostapis.obj pa_asio.obj
  
  
--- 62,67 ----
  PAOBJ = pa_stream.obj pa_trace.obj pa_skeleton.obj pa_process.obj \
  	pa_front.obj pa_dither.obj pa_cpuload.obj pa_converters.obj \
! 	pa_allocation.obj pa_win_util.obj pa_win_hostapis.obj pa_asio.obj \
! 	pa_win_wmme.obj
  
  
***************
*** 126,129 ****
--- 128,133 ----
  pa_win_hostapis.obj: $(PADIR)\pa_win\pa_win_hostapis.c
  	cl /c $(ALLCF) $(PADIR)\pa_win\pa_win_hostapis.c
+ pa_win_wmme.obj: $(PADIR)\pa_win_wmme\pa_win_wmme.c
+ 	cl /c $(ALLCF) $(PADIR)\pa_win_wmme\pa_win_wmme.c
  pa_asio.obj: $(PADIR)\pa_asio\pa_asio.cpp
  	cl /c $(ALLCF) $(PADIR)\pa_asio\pa_asio.cpp

Index: g_canvas.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_canvas.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** g_canvas.c	18 May 2005 04:28:50 -0000	1.7
--- g_canvas.c	2 Jul 2005 05:03:06 -0000	1.8
***************
*** 15,18 ****
--- 15,19 ----
  #include "g_all_guis.h"
  
+     /* LATER consider adding font size to this struct (see glist_getfont()) */
  struct _canvasenvironment
  {
***************
*** 402,405 ****
--- 403,407 ----
          pd_bind(&x->gl_pd, canvas_makebindsym(x->gl_name));
      x->gl_loading = 1;
+     x->gl_goprect = 0;      /* no GOP rectangle unless it's turned on later */
      x->gl_willvis = vis;
      x->gl_edit = !strncmp(x->gl_name->s_name, "Untitled", 8);
***************
*** 409,413 ****
  }
  
! void canvas_setgraph(t_glist *x, int flag);
  
  static void canvas_coords(t_glist *x, t_symbol *s, int argc, t_atom *argv)
--- 411,415 ----
  }
  
! void canvas_setgraph(t_glist *x, int flag, int nogoprect);
  
  static void canvas_coords(t_glist *x, t_symbol *s, int argc, t_atom *argv)
***************
*** 419,423 ****
      x->gl_pixwidth = atom_getintarg(4, argc, argv);
      x->gl_pixheight = atom_getintarg(5, argc, argv);
!     canvas_setgraph(x, atom_getintarg(6, argc, argv));
  }
  
--- 421,432 ----
      x->gl_pixwidth = atom_getintarg(4, argc, argv);
      x->gl_pixheight = atom_getintarg(5, argc, argv);
!     if (argc <= 7)
!         canvas_setgraph(x, atom_getintarg(6, argc, argv), 1);
!     else
!     {
!         x->gl_xmargin = atom_getintarg(7, argc, argv);
!         x->gl_ymargin = atom_getintarg(8, argc, argv);
!         canvas_setgraph(x, atom_getintarg(6, argc, argv), 0);
!     }
  }
  
***************
*** 481,486 ****
          pd_bind(&x->gl_pd, canvas_makebindsym(x->gl_name));
      x->gl_owner = g;
-     x->gl_stretch = 1;
      x->gl_isgraph = 1;
      x->gl_obj.te_binbuf = binbuf_new();
      binbuf_addv(x->gl_obj.te_binbuf, "s", gensym("graph"));
--- 490,495 ----
          pd_bind(&x->gl_pd, canvas_makebindsym(x->gl_name));
      x->gl_owner = g;
      x->gl_isgraph = 1;
+     x->gl_goprect = 0;
      x->gl_obj.te_binbuf = binbuf_new();
      binbuf_addv(x->gl_obj.te_binbuf, "s", gensym("graph"));
***************
*** 590,593 ****
--- 599,616 ----
  }
  
+ void canvas_drawredrect(t_canvas *x, int doit)
+ {
+     if (doit)
+         sys_vgui(".x%lx.c create line\
+             %d %d %d %d %d %d %d %d %d %d -fill #ff8080 -tags GOP\n",
+             glist_getcanvas(x),
+             x->gl_xmargin, x->gl_ymargin,
+             x->gl_xmargin + x->gl_pixwidth, x->gl_ymargin,
+             x->gl_xmargin + x->gl_pixwidth, x->gl_ymargin + x->gl_pixheight,
+             x->gl_xmargin, x->gl_ymargin + x->gl_pixheight,
+             x->gl_xmargin, x->gl_ymargin);
+     else sys_vgui(".x%lx.c delete GOP\n",  glist_getcanvas(x));
+ }
+ 
      /* the window becomes "mapped" (visible and not miniaturized) or
      "unmapped" (either miniaturized or just plain gone.)  This should be
***************
*** 613,616 ****
--- 636,641 ----
              x->gl_mapped = 1;
              canvas_drawlines(x);
+             if (x->gl_isgraph && x->gl_goprect)
+                 canvas_drawredrect(x, 1);
              sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", x);
          }
***************
*** 622,625 ****
--- 647,651 ----
                  /* just clear out the whole canvas... */
              sys_vgui(".x%lx.c delete all\n", x);
+ #if 0
                  /* alternatively, we could have erased them one by one...
              for (y = x->gl_list; y; y = y->g_next)
***************
*** 627,630 ****
--- 653,657 ----
                      ... but we should go through and erase the lines as well
                      if we do it that way. */
+ #endif
              x->gl_mapped = 0;
          }
***************
*** 817,821 ****
  int glist_getfont(t_glist *x)
  {
!     return (glist_getcanvas(x)->gl_font);
  }
  
--- 844,851 ----
  int glist_getfont(t_glist *x)
  {
!     while (!x->gl_env)
!         if (!(x = x->gl_owner))
!             bug("t_canvasenvironment");
!     return (x->gl_font);
  }
  
***************
*** 1414,1418 ****
  void g_editor_setup(void);
  void g_readwrite_setup(void);
! extern void graph_properties(t_gobj *z, t_glist *owner);
  
  void g_canvas_setup(void)
--- 1444,1448 ----
  void g_editor_setup(void);
  void g_readwrite_setup(void);
! extern void canvas_properties(t_gobj *z);
  
  void g_canvas_setup(void)
***************
*** 1485,1489 ****
      class_addmethod(canvas_class, (t_method)canvas_map,
          gensym("map"), A_FLOAT, A_NULL);
!     class_setpropertiesfn(canvas_class, graph_properties);
  
  /* ---------------------- list handling ------------------------ */
--- 1515,1519 ----
      class_addmethod(canvas_class, (t_method)canvas_map,
          gensym("map"), A_FLOAT, A_NULL);
!     class_setpropertiesfn(canvas_class, (t_propertiesfn)canvas_properties);
  
  /* ---------------------- list handling ------------------------ */

Index: g_rtext.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_rtext.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** g_rtext.c	6 Sep 2004 20:20:34 -0000	1.4
--- g_rtext.c	2 Jul 2005 05:03:06 -0000	1.5
***************
*** 154,162 ****
      char smallbuf[200], *tempbuf;
      int outchars = 0, nlines = 0, ncolumns = 0,
!         pixwide, pixhigh;
!     int font = glist_getfont(x->x_glist);
!     int fontwidth = sys_fontwidth(font), fontheight = sys_fontheight(font);
!     int findx = (*widthp + (fontwidth/2)) / fontwidth,
!         findy = *heightp / fontheight;
      int reportedindex = 0;
      t_canvas *canvas = glist_getcanvas(x->x_glist);
--- 154,158 ----
      char smallbuf[200], *tempbuf;
      int outchars = 0, nlines = 0, ncolumns = 0,
!         pixwide, pixhigh, font, fontwidth, fontheight, findx, findy;
      int reportedindex = 0;
      t_canvas *canvas = glist_getcanvas(x->x_glist);
***************
*** 165,168 ****
--- 161,175 ----
      int inindex = 0;
      int selstart = 0, selend = 0;
+         /* if we're a GOP (the new, "goprect" style) borrow the font size
+         from the inside to preserve the spacing */
+     if (pd_class(&x->x_text->te_pd) == canvas_class &&
+         ((t_glist *)(x->x_text))->gl_isgraph &&
+         ((t_glist *)(x->x_text))->gl_goprect)
+             font =  glist_getfont((t_glist *)(x->x_text));
+     else font = glist_getfont(x->x_glist);
+     fontwidth = sys_fontwidth(font);
+     fontheight = sys_fontheight(font);
+     findx = (*widthp + (fontwidth/2)) / fontwidth;
+     findy = *heightp / fontheight;
      if (x->x_bufsize >= 100)
           tempbuf = (char *)t_getbytes(2 * x->x_bufsize + 1);

Index: notes.txt
===================================================================
RCS file: /cvsroot/pure-data/pd/src/notes.txt,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** notes.txt	25 Jun 2005 02:49:15 -0000	1.12
--- notes.txt	2 Jul 2005 05:03:06 -0000	1.13
***************
*** 1,5 ****
  ---------------- dolist --------------------
  done for 0.39:
! arrays are now first-class data
  array elements can be clicked on, etc
  fixed array onset bug
--- 1,7 ----
  ---------------- dolist --------------------
  done for 0.39:
! At the source level, "regular" arrays and arrays withing data structures
! are now the same thing.  The main user-visible effect of this is that now
! "arrays" may be graphed as "bezier curves".
  array elements can be clicked on, etc
  fixed array onset bug
***************
*** 8,11 ****
--- 10,19 ----
  bugfix in number2
  plot drawing instructions turn on and off
+ ranges in drawing instructions
+ unify graph properties dialogs
+ GOP font depends on abstraction, not parent
+ 
+ 
+ ------------ 0.39 ---------
  
  check:
***************
*** 13,22 ****
  blechman patch for s_inter.c
  
- At the source level, "regular" arrays and arrays withing data structures
- are now the same thing.  The main user-visible effect of this is that now
- "arrays" may be graphed as "bezier curves".
- 
- ------------ 0.39 ---------
- 
  garray change:
  make a gobj_redraw that schedules the redraw
--- 21,24 ----
***************
*** 32,35 ****
--- 34,38 ----
  
  problems:
+ modal dialogs confuse watchdog
  patcher inlets don't deal with scalars (zbug.pd)
  Macintosh .pd extension not added to filenames
***************
*** 53,57 ****
  dac~/ adc~/ block~ incompatibility
  scofo reports error on reading score1.txt
- rfft~ loses nyquist bin -- see "to hell with it" comment in d_fft.c
  loading e-mailed patches without removing headers crashes pd
  pd $1 bug ($1 is saved as it was evaluated, not as '$1')
--- 56,59 ----
***************
*** 94,98 ****
  figure out why Pd sometimes crashes when you close example after adding fields
  arrays of non-existent templates crash
- allow field(1,5,0,100) etc. in drawing commands
  vget, vset traversal objects
  cursor to show (x, y) location
--- 96,99 ----

Index: g_graph.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_graph.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** g_graph.c	18 May 2005 04:28:50 -0000	1.6
--- g_graph.c	2 Jul 2005 05:03:06 -0000	1.7
***************
*** 25,28 ****
--- 25,30 ----
  /* -------------------- maintaining the list -------------------- */
  
+ void canvas_drawredrect(t_canvas *x, int doit);
+ 
  void glist_add(t_glist *x, t_gobj *y)
  {
***************
*** 38,41 ****
--- 40,48 ----
      if (x->gl_editor && (ob = pd_checkobject(&y->g_pd)))
          rtext_new(x, ob);
+     if (x->gl_editor && x->gl_isgraph && !x->gl_goprect)
+     {
+         x->gl_goprect = 1;
+         canvas_drawredrect(x, 1);
+     }
      if (glist_isvisible(x))
          gobj_vis(y, x, 1);
***************
*** 594,603 ****
      /* get the window location in pixels of a "text" object.  The
      object's x and y positions are in pixels when the glist they're
!     in is toplevel.  If it's not, we convert to pixels on the parent
!     window. */
  int text_xpix(t_text *x, t_glist *glist)
  {
      if (glist->gl_havewindow || !glist->gl_isgraph)
          return (x->te_xpix);
      else return (glist_xtopixels(glist, 
              glist->gl_x1 + (glist->gl_x2 - glist->gl_x1) * 
--- 601,614 ----
      /* get the window location in pixels of a "text" object.  The
      object's x and y positions are in pixels when the glist they're
!     in is toplevel.  Otherwise, if it's a new-style graph-on-parent
!     (so gl_goprect is set) we use the offset into the framing subrectangle
!     as an offset into the parent rectangle.  Finally, it might be an old,
!     proportional-style GOP.  In this case we do a coordinate transformation. */
  int text_xpix(t_text *x, t_glist *glist)
  {
      if (glist->gl_havewindow || !glist->gl_isgraph)
          return (x->te_xpix);
+     else if (glist->gl_goprect)
+          return (glist->gl_obj.te_xpix + x->te_xpix - glist->gl_xmargin);
      else return (glist_xtopixels(glist, 
              glist->gl_x1 + (glist->gl_x2 - glist->gl_x1) * 
***************
*** 609,612 ****
--- 620,625 ----
      if (glist->gl_havewindow || !glist->gl_isgraph)
          return (x->te_ypix);
+     else if (glist->gl_goprect)
+          return (glist->gl_obj.te_ypix + x->te_ypix - glist->gl_ymargin);
      else return (glist_ytopixels(glist, 
              glist->gl_y1 + (glist->gl_y2 - glist->gl_y1) * 
***************
*** 639,642 ****
--- 652,661 ----
                      glist_getcanvas(x), oc,
                          t.tr_lx1, t.tr_ly1, t.tr_lx2, t.tr_ly2);
+             canvas_drawredrect(x, 0);
+             if (x->gl_goprect)
+             {
+                 post("draw it");
+                 canvas_drawredrect(x, 1);
+             }
          }
          if (x->gl_owner && glist_isvisible(x->gl_owner))
***************
*** 839,862 ****
      int y1 = text_ypix(&x->gl_obj, glist);
      int x2, y2;
- #if 0   /* this used to adjust graph size when it was in another graph;
-             now we just preserve the size. */
-         /* same logic here as in text_xpix(): */
-     if (glist->gl_havewindow)
-     {
-         x2 = x1 + x->gl_pixwidth;
-         y2 = y1 + x->gl_pixheight;
-     }
-     else
-     {
-         x2 = glist_xtopixels(glist, 
-             glist->gl_x1 + (glist->gl_x2 - glist->gl_x1) * 
-                 (x->gl_obj.te_xpix + x->gl_pixwidth) /
-                     (glist->gl_screenx2 - glist->gl_screenx1));
-         y2 = glist_ytopixels(glist, 
-             glist->gl_y1 + (glist->gl_y2 - glist->gl_y1) * 
-                 (x->gl_obj.te_ypix + x->gl_pixheight) /
-                     (glist->gl_screeny2 - glist->gl_screeny1));
-     }
- #endif
      x2 = x1 + x->gl_pixwidth;
      y2 = y1 + x->gl_pixheight;
--- 858,861 ----
***************
*** 891,912 ****
                  y2 = y22;
          }
!             /* lie about whether we have our own window to affect gobj_getrect
!             calls below.  (LATER add argument to gobj_getrect()?) */
!         hadwindow = x->gl_havewindow;
!         x->gl_havewindow = 0;
!         for (g = x->gl_list; g; g = g->g_next)
!             if ((!(ob = pd_checkobject(&g->g_pd))) || text_shouldvis(ob, x))
          {
!                 /* don't do this for arrays, just let them hang outsize the
!                 box. */
!             if (pd_class(&g->g_pd) == garray_class)
!                 continue;
!             gobj_getrect(g, x, &x21, &y21, &x22, &y22);
!             if (x22 > x2) 
!                 x2 = x22;
!             if (y22 > y2) 
!                 y2 = y22;
          }
-         x->gl_havewindow = hadwindow;
      }
      else text_widgetbehavior.w_getrectfn(z, glist, &x1, &y1, &x2, &y2);
--- 890,916 ----
                  y2 = y22;
          }
!         if (!x->gl_goprect)
          {
!             /* expand the rectangle to fit in text objects; this applies only
!             to the old (0.37) graph-on-parent behavior. */
!             /* lie about whether we have our own window to affect gobj_getrect
!             calls below.  */
!             hadwindow = x->gl_havewindow;
!             x->gl_havewindow = 0;
!             for (g = x->gl_list; g; g = g->g_next)
!                 if ((!(ob = pd_checkobject(&g->g_pd))) || text_shouldvis(ob, x))
!             {
!                     /* don't do this for arrays, just let them hang outside the
!                     box. */
!                 if (pd_class(&g->g_pd) == garray_class)
!                     continue;
!                 gobj_getrect(g, x, &x21, &y21, &x22, &y22);
!                 if (x22 > x2) 
!                     x2 = x22;
!                 if (y22 > y2) 
!                     y2 = y22;
!             }
!             x->gl_havewindow = hadwindow;
          }
      }
      else text_widgetbehavior.w_getrectfn(z, glist, &x1, &y1, &x2, &y2);
***************
*** 1069,1089 ****
  };
  
- void graph_properties(t_gobj *z, t_glist *owner)
- {
-     t_glist *x = (t_glist *)z;
-     {
-         t_gobj *y;
-         char graphbuf[200];
-         sprintf(graphbuf, "pdtk_graph_dialog %%s %g %g %g %g %d %d\n",
-             x->gl_x1, x->gl_y1, x->gl_x2, x->gl_y2,
-                 x->gl_pixwidth, x->gl_pixheight);
-         gfxstub_new(&x->gl_pd, x, graphbuf);
- 
-         for (y = x->gl_list; y; y = y->g_next)
-             if (pd_class(&y->g_pd) == garray_class) 
-                 garray_properties((t_garray *)y);
-     }
- }
- 
      /* find the graph most recently added to this glist;
          if none exists, return 0. */
--- 1073,1076 ----
***************
*** 1098,1124 ****
  }
  
-     /* message back from dialog GUI to set parameters.  Args are:
-         1-4: bounds in our coordinates; 5-6: size in parent */
- static void graph_dialog(t_glist *x, t_symbol *s, int argc, t_atom *argv)
- {
-     t_float x1 = atom_getfloatarg(0, argc, argv);
-     t_float y1 = atom_getfloatarg(1, argc, argv);
-     t_float x2 = atom_getfloatarg(2, argc, argv);
-     t_float y2 = atom_getfloatarg(3, argc, argv);
-     t_float xpix = atom_getfloatarg(4, argc, argv);
-     t_float ypix = atom_getfloatarg(5, argc, argv);
-     if (x1 != x->gl_x1 || x2 != x->gl_x2 ||
-         y1 != x->gl_y1 || y2 != x->gl_y2)
-             graph_bounds(x, x1, y1, x2, y2);
-     if (xpix != x->gl_pixwidth || ypix != x->gl_pixheight)
-     {
-         x->gl_pixwidth = xpix;
-         x->gl_pixheight = ypix;
-         glist_redraw(x);
-         if (x->gl_owner)
-             canvas_fixlinesfor(x->gl_owner, &x->gl_obj);
-     }
- }
- 
  extern void canvas_menuarray(t_glist *canvas);
  
--- 1085,1088 ----
***************
*** 1140,1145 ****
      class_addmethod(canvas_class, (t_method)canvas_menuarray,
          gensym("menuarray"), A_NULL);
-     class_addmethod(canvas_class, (t_method)graph_dialog, gensym("dialog"),
-         A_GIMME, 0);
      class_addmethod(canvas_class, (t_method)glist_arraydialog,
          gensym("arraydialog"), A_SYMBOL, A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
--- 1104,1107 ----

Index: g_readwrite.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_readwrite.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** g_readwrite.c	28 Nov 2004 21:20:42 -0000	1.4
--- g_readwrite.c	2 Jul 2005 05:03:06 -0000	1.5
***************
*** 598,606 ****
      if (x->gl_isgraph || x->gl_x1 || x->gl_y1 ||
          x->gl_x2 != 1 ||  x->gl_y2 != 1 || x->gl_pixwidth || x->gl_pixheight)
!             binbuf_addv(b, "ssfffffff;", gensym("#X"), gensym("coords"),
                  x->gl_x1, x->gl_y1,
                  x->gl_x2, x->gl_y2,
                  (float)x->gl_pixwidth, (float)x->gl_pixheight,
                  (float)x->gl_isgraph);
  }
  
--- 598,618 ----
      if (x->gl_isgraph || x->gl_x1 || x->gl_y1 ||
          x->gl_x2 != 1 ||  x->gl_y2 != 1 || x->gl_pixwidth || x->gl_pixheight)
!     {
!         if (x->gl_isgraph && x->gl_goprect)
!                 /* if we have a graph-on-parent rectangle, we're new style.
!                 The format is arranged so
!                 that old versions of Pd can at least do something with it. */
!             binbuf_addv(b, "ssfffffffff;", gensym("#X"), gensym("coords"),
!                 x->gl_x1, x->gl_y1,
!                 x->gl_x2, x->gl_y2,
!                 (float)x->gl_pixwidth, (float)x->gl_pixheight,
!                 1., (float)x->gl_xmargin, (float)x->gl_ymargin); 
!                     /* otherwise write in 0.38-compatible form */
!         else binbuf_addv(b, "ssfffffff;", gensym("#X"), gensym("coords"),
                  x->gl_x1, x->gl_y1,
                  x->gl_x2, x->gl_y2,
                  (float)x->gl_pixwidth, (float)x->gl_pixheight,
                  (float)x->gl_isgraph);
+     }
  }
  

Index: g_editor.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_editor.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** g_editor.c	18 May 2005 04:28:50 -0000	1.7
--- g_editor.c	2 Jul 2005 05:03:06 -0000	1.8
***************
*** 65,69 ****
--- 65,87 ----
  {
      if (x->g_pd->c_wb && x->g_pd->c_wb->w_visfn)
+     {
+         if (!glist->gl_havewindow && glist->gl_isgraph && glist->gl_goprect &&
+             glist->gl_owner && (pd_class(&glist->gl_pd) != garray_class))
+         {
+             /* if we're graphing-on-parent and the object falls outside the
+             graph rectangle, don't draw it. */
+             int x1, y1, x2, y2, gx1, gy1, gx2, gy2, m;
+             gobj_getrect(&glist->gl_gobj, glist->gl_owner, &x1, &y1, &x2, &y2);
+             if (x1 > x2)
+                 m = x1, x1 = x2, x2 = m;
+             if (y1 > y2)
+                 m = y1, y1 = y2, x2 = m;
+             gobj_getrect(x, glist, &gx1, &gy1, &gx2, &gy2);
+             if (gx1 < x1 || gx1 > x2 || gx2 < x1 || gx2 > x2 ||
+                 gy1 < y1 || gy1 > y2 || gy2 < y1 || gy2 > y2)
+                     return;
+         }
          (*x->g_pd->c_wb->w_visfn)(x, glist, flag);
+     }
  }
  
***************
*** 788,805 ****
  }
  
!     /* tell GUI to create a properties dialog on the canvas.  We tell
!     the user the negative of the "pixel" y scale to make it appear to grow
!     naturally upward, whereas pixels grow downward. */
! static void canvas_properties(t_glist *x)
! {
!     char graphbuf[200];
!     sprintf(graphbuf, "pdtk_canvas_dialog %%s %g %g %g %g \n",
!         glist_dpixtodx(x, 1), -glist_dpixtody(x, 1),
!         (float)glist_isgraph(x), (float)x->gl_stretch);
!     gfxstub_new(&x->gl_pd, x, graphbuf);
! }
! 
! 
! void canvas_setgraph(t_glist *x, int flag)
  {
      if (!flag && glist_isgraph(x))
--- 806,812 ----
  }
  
!     /* set a canvas up as a graph-on-parent.  Set reasonable defaults for
!     any missing paramters and redraw things if necessary. */
! void canvas_setgraph(t_glist *x, int flag, int nogoprect)
  {
      if (!flag && glist_isgraph(x))
***************
*** 825,830 ****
              gobj_vis(&x->gl_gobj, x->gl_owner, 0);
          x->gl_isgraph = 1;
!         /* if (x->gl_owner && glist_isvisible(x->gl_owner))
!             canvas_vis(x, 1); */
          if (x->gl_loading && x->gl_owner && glist_isvisible(x->gl_owner))
              canvas_create_editor(x, 1);
--- 832,847 ----
              gobj_vis(&x->gl_gobj, x->gl_owner, 0);
          x->gl_isgraph = 1;
!         if (!nogoprect && !x->gl_goprect)
!         {
!             t_gobj *g;
!             for (g = x->gl_list; g; g = g->g_next)
!                 if (pd_checkobject(&g->g_pd))
!             {
!                 x->gl_goprect = 1;
!                 break;
!             }
!         }
!         if (glist_isvisible(x) && x->gl_goprect)
!             glist_redraw(x);
          if (x->gl_loading && x->gl_owner && glist_isvisible(x->gl_owner))
              canvas_create_editor(x, 1);
***************
*** 837,846 ****
  }
  
      /* called from the gui when "OK" is selected on the canvas properties
          dialog.  Again we negate "y" scale. */
! static void canvas_donecanvasdialog(t_glist *x,  t_floatarg xperpix,
!     t_floatarg yperpix, t_floatarg fgraphme)
  {
!     int graphme = (fgraphme != 0), redraw = 0;
      yperpix = -yperpix;
      if (xperpix == 0)
--- 854,908 ----
  }
  
+     /* tell GUI to create a properties dialog on the canvas.  We tell
+     the user the negative of the "pixel" y scale to make it appear to grow
+     naturally upward, whereas pixels grow downward. */
+ void canvas_properties(t_glist *x)
+ {
+     char graphbuf[200];
+     if (glist_isgraph(x) != 0)
+         sprintf(graphbuf,
+             "pdtk_canvas_dialog %%s %g %g %d %g %g %g %g %d %d %d %d\n",
+                 0., 0.,
+                 1,
+                 x->gl_x1, x->gl_y1, x->gl_x2, x->gl_y2, 
+                 (int)x->gl_pixwidth, (int)x->gl_pixheight,
+                 (int)x->gl_xmargin, (int)x->gl_ymargin);
+     else sprintf(graphbuf,
+             "pdtk_canvas_dialog %%s %g %g %d %g %g %g %g %d %d %d %d\n",
+                 glist_dpixtodx(x, 1), -glist_dpixtody(x, 1),
+                 0,
+                 0., -1., 1., 1., 
+                 (int)x->gl_pixwidth, (int)x->gl_pixheight,
+                 (int)x->gl_xmargin, (int)x->gl_ymargin);
+     gfxstub_new(&x->gl_pd, x, graphbuf);
+ }
+ 
      /* called from the gui when "OK" is selected on the canvas properties
          dialog.  Again we negate "y" scale. */
! static void canvas_donecanvasdialog(t_glist *x,
!     t_symbol *s, int argc, t_atom *argv)
  {
! 
! 
!     float xperpix, yperpix, x1, y1, x2, y2, xpix, ypix, xmargin, ymargin; 
!     int graphme, redraw = 0;
! 
!     xperpix = atom_getfloatarg(0, argc, argv);
!     yperpix = atom_getfloatarg(1, argc, argv);
!     graphme = (atom_getfloatarg(2, argc, argv) != 0);
!     x1 = atom_getfloatarg(3, argc, argv);
!     y1 = atom_getfloatarg(4, argc, argv);
!     x2 = atom_getfloatarg(5, argc, argv);
!     y2 = atom_getfloatarg(6, argc, argv);
!     xpix = atom_getfloatarg(7, argc, argv);
!     ypix = atom_getfloatarg(8, argc, argv);
!     xmargin = atom_getfloatarg(9, argc, argv);
!     ymargin = atom_getfloatarg(10, argc, argv);
!     
!     x->gl_pixwidth = xpix;
!     x->gl_pixheight = ypix;
!     x->gl_xmargin = xmargin;
!     x->gl_ymargin = ymargin;
! 
      yperpix = -yperpix;
      if (xperpix == 0)
***************
*** 848,854 ****
      if (yperpix == 0)
          yperpix = 1;
!     canvas_setgraph(x, graphme);
!     if (!x->gl_isgraph && (xperpix != glist_dpixtodx(x, 1)))
      {
          if (xperpix > 0)
          {
--- 910,927 ----
      if (yperpix == 0)
          yperpix = 1;
! 
!     if (graphme)
      {
+         if (x1 != x2)
+             x->gl_x1 = x1, x->gl_x2 = x2;
+         else x->gl_x1 = 0, x->gl_x2 = 1;
+         if (y1 != y2)
+             x->gl_y1 = y1, x->gl_y2 = y2;
+         else x->gl_y1 = 0, x->gl_y2 = 1;
+     }
+     else
+     {
+         if (xperpix != glist_dpixtodx(x, 1) || yperpix != glist_dpixtody(x, 1))
+             redraw = 1;
          if (xperpix > 0)
          {
***************
*** 861,868 ****
              x->gl_x2 = x->gl_x1 + xperpix;
          }
-         redraw = 1;
-     }   
-     if (!x->gl_isgraph && (yperpix != glist_dpixtody(x, 1)))
-     {
          if (yperpix > 0)
          {
--- 934,937 ----
***************
*** 875,882 ****
              x->gl_y2 = x->gl_y1 + yperpix;
          }
-         redraw = 1;
      }
!     if (redraw)
!         canvas_redraw(x);
  }
  
--- 944,951 ----
              x->gl_y2 = x->gl_y1 + yperpix;
          }
      }
!         /* LATER avoid doing 2 redraws here (possibly one inside setgraph) */
!     canvas_setgraph(x, graphme, 0);
!     canvas_redraw(x);
  }
  
***************
*** 2317,2321 ****
          gensym("done-popup"), A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
      class_addmethod(canvas_class, (t_method)canvas_donecanvasdialog,
!         gensym("donecanvasdialog"), A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
      class_addmethod(canvas_class, (t_method)glist_arraydialog,
          gensym("arraydialog"), A_SYMBOL, A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
--- 2386,2390 ----
          gensym("done-popup"), A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
      class_addmethod(canvas_class, (t_method)canvas_donecanvasdialog,
!         gensym("donecanvasdialog"), A_GIMME, A_NULL);
      class_addmethod(canvas_class, (t_method)glist_arraydialog,
          gensym("arraydialog"), A_SYMBOL, A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);

Index: g_template.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_template.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** g_template.c	25 Jun 2005 02:49:15 -0000	1.8
--- g_template.c	2 Jul 2005 05:03:06 -0000	1.9
***************
*** 1324,1327 ****
--- 1324,1328 ----
  void plot_float(t_plot *x, t_floatarg f)
  {
+     int viswas;
      if (x->x_vis.fd_type != A_FLOAT || x->x_vis.fd_var)
      {
***************
*** 1329,1333 ****
          return;
      }
!     int viswas = (x->x_vis.fd_un.fd_float != 0);
      
      if ((f != 0 && viswas) || (f == 0 && !viswas))
--- 1330,1334 ----
          return;
      }
!     viswas = (x->x_vis.fd_un.fd_float != 0);
      
      if ((f != 0 && viswas) || (f == 0 && !viswas))





More information about the Pd-cvs mailing list