[PD-cvs] pd/src desire.c,1.1.2.124,1.1.2.125

Mathieu Bouchard matju at users.sourceforge.net
Thu Aug 31 21:02:31 CEST 2006


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

Modified Files:
      Tag: devel_0_39
	desire.c 
Log Message:
removed canvas_reflecttitle, gobj_vis and stuff.


Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.124
retrieving revision 1.1.2.125
diff -C2 -d -r1.1.2.124 -r1.1.2.125
*** desire.c	30 Aug 2006 17:26:24 -0000	1.1.2.124
--- desire.c	31 Aug 2006 19:02:28 -0000	1.1.2.125
***************
*** 284,288 ****
  t_canvas *canvas_whichfind;         /* last canvas we did a find in */ 
  t_canvas *canvas_list;              /* list of all root canvases */
- static void canvas_reflecttitle(t_canvas *x);
  static void canvas_setbounds(t_canvas *x, int x1, int y1, int x2, int y2);
  static void canvas_drawlines(t_canvas *x);
--- 284,287 ----
***************
*** 391,396 ****
      x->gl_name = s;
      if (strcmp(x->gl_name->s_name, "Pd"))   pd_bind(&x->gl_pd, canvas_makebindsym(x->gl_name));
-     if (glist_isvisible(x)) canvas_reflecttitle(x);
      if (dir && dir != &s_) canvas_getenv(x)->ce_dir = dir;
  }
  
--- 390,395 ----
      x->gl_name = s;
      if (strcmp(x->gl_name->s_name, "Pd"))   pd_bind(&x->gl_pd, canvas_makebindsym(x->gl_name));
      if (dir && dir != &s_) canvas_getenv(x)->ce_dir = dir;
+     gobj_changed(x,0);
  }
  
***************
*** 646,681 ****
  }
  
- void canvas_reflecttitle(t_canvas *x) {
- /*
-     char namebuf[MAXPDSTRING];
-     char foo[MAXPDSTRING];
-     t_canvasenvironment *env = canvas_getenv(x);
-     if (env->ce_argc)
-     {
-         int i;
-         strcpy(namebuf, " (");
-         for (i = 0; i < env->ce_argc; i++)
-         {
-             if (strlen(namebuf) > MAXPDSTRING/2 - 5)
-                 break;
-             if (i != 0)
-                 strcat(namebuf, " ");
-             atom_string(&env->ce_argv[i], namebuf + strlen(namebuf), 
-                 MAXPDSTRING/2);
-         }
-         strcat(namebuf, ")");
-     }
-     else namebuf[0] = 0;
-     sprintf(foo,"%s%c%s - %s",x->gl_name->s_name, (x->gl_dirty? '*' : ' '), namebuf,
- 	canvas_getdir(x)->s_name);
-     sys_mgui(x,"window_title","s",gensym(foo));
- */
- }
- 
  void canvas_dirty(t_canvas *x, t_int n) {
      t_canvas *x2 = canvas_getrootfor(x);
      if ((unsigned)n != x2->gl_dirty) {
          x2->gl_dirty = n;
!         canvas_reflecttitle(x2);
      }
  }
--- 645,653 ----
  }
  
  void canvas_dirty(t_canvas *x, t_int n) {
      t_canvas *x2 = canvas_getrootfor(x);
      if ((unsigned)n != x2->gl_dirty) {
          x2->gl_dirty = n;
! 	sys_mgui(x,"modified?=","i",n);
      }
  }
***************
*** 776,790 ****
      if (!!f) {
          if (x->gl_editor) { /* already visible, so just raise window */
! #ifdef MSW
!             canvas_vis(x, 0);
!             canvas_vis(x, 1);
! #else
!             sys_mgui(x,"window_raise","");
!             sys_mgui(x,"window_focus","");
!             sys_mgui(x,"window_deiconify","");
! #endif
          } else {
              canvas_create_editor(x, 1);
-             canvas_reflecttitle(x);
              x->gl_havewindow = 1;
  	    gobj_subscribe((t_gobj *)x,(t_gobj *)manager);
--- 748,754 ----
      if (!!f) {
          if (x->gl_editor) { /* already visible, so just raise window */
! 		sys_mgui(x,"raise","");
          } else {
              canvas_create_editor(x, 1);
              x->gl_havewindow = 1;
  	    gobj_subscribe((t_gobj *)x,(t_gobj *)manager);
***************
*** 792,798 ****
          }
      } else {    /* make invisible */
-         int i;
-         t_canvas *x2;
- 	gobj_subscribe((t_gobj *)x,(t_gobj *)manager); /* why this, if it's supposed to be invisible? */
          if (!x->gl_havewindow) {
                  /* bug workaround -- a graph in a visible patch gets "invised"
--- 756,759 ----
***************
*** 804,811 ****
              return;
          }
-         sys_mgui(x,"getscroll","");
          if (glist_isvisible(x)) canvas_map(x, 0);
          canvas_create_editor(x, 0);
-         i=1; for (x2=x; x2; x2=x2->gl_next) i++;
  	/* if we're a graph on our parent, and if the parent exists
  	   and is visible, show ourselves on parent. */
--- 765,770 ----
***************
*** 815,821 ****
              if (glist_isvisible(gl2)) gobj_vis(&x->gl_gobj, gl2, 0);
              x->gl_havewindow = 0;
              if (glist_isvisible(gl2)) gobj_vis(&x->gl_gobj, gl2, 1);
!         } else x->gl_havewindow = 0;
      }
  }
  
--- 774,784 ----
              if (glist_isvisible(gl2)) gobj_vis(&x->gl_gobj, gl2, 0);
              x->gl_havewindow = 0;
+ 	    gobj_unsubscribe((t_gobj *)x,(t_gobj *)manager);
              if (glist_isvisible(gl2)) gobj_vis(&x->gl_gobj, gl2, 1);
!         } else {
! 	    x->gl_havewindow = 0;
! 	}
      }
+     gobj_changed(x,0);
  }
  
***************
*** 1280,1315 ****
      LATER we'll use the "template" information to select which ones we
      redraw.   Action = 0 for redraw, 1 for draw only, 2 for erase. */
! static void glist_redrawall(t_glist *gl, int action)
! {
      t_gobj *g;
      int vis = glist_isvisible(gl);
!     for (g = gl->gl_list; g; g = g->g_next)
!     {
!         if (vis && g->g_pd == scalar_class)
!         {
!             if (action == 1)
!             {
!                 if (glist_isvisible(gl))
!                     gobj_vis(g, gl, 1);
!             }
!             else if (action == 2)
!             {
!                 if (glist_isvisible(gl))
!                     gobj_vis(g, gl, 0);
!             }
              else scalar_redraw((t_scalar *)g, gl);
!         }
!         else if (g->g_pd == canvas_class)
!             glist_redrawall((t_glist *)g, action);
      }
  }
  
!     /* public interface for above. */
! void canvas_redrawallfortemplate(t_template *template, int action)
! {
      t_canvas *x;
          /* find all root canvases */
!     for (x = canvas_list; x; x = x->gl_next)
!         glist_redrawall(x, action);
  }
  
--- 1243,1263 ----
      LATER we'll use the "template" information to select which ones we
      redraw.   Action = 0 for redraw, 1 for draw only, 2 for erase. */
! static void glist_redrawall(t_glist *gl, int action) {
      t_gobj *g;
      int vis = glist_isvisible(gl);
!     for (g = gl->gl_list; g; g = g->g_next) {
!         if (vis && g->g_pd == scalar_class) {
!             if      (action == 1) {if (glist_isvisible(gl)) gobj_vis(g, gl, 1);}
!             else if (action == 2) {if (glist_isvisible(gl)) gobj_vis(g, gl, 0);}
              else scalar_redraw((t_scalar *)g, gl);
!         } else if (g->g_pd == canvas_class) glist_redrawall((t_glist *)g, action);
      }
  }
  
! /* public interface for above. */
! void canvas_redrawallfortemplate(t_template *template, int action) {
      t_canvas *x;
          /* find all root canvases */
!     for (x = canvas_list; x; x = x->gl_next) glist_redrawall(x, action);
  }
  
***************
*** 1373,1397 ****
  void gobj_vis(t_gobj *x, struct _glist *glist, int flag) {
  	post("warning: t_visfn shouldn't do anything anymore");
- /*  
-     t_widgetbehavior *w = x->g_pd->c_wb;
-     if (w && w->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>WWWWx2 ||
-                 gy1<y1 || gy1>y2 || gy2<y1 || gy2>y2)
-                     return;
-         }
-         w->w_visfn(x, glist, flag);
-     }
- */
  }
  
--- 1321,1324 ----
***************
*** 1560,1602 ****
  void canvas_setgraph(t_glist *x, int flag, int nogoprect)
  {
!     if (!flag && glist_isgraph(x))
!     {
!         if (x->gl_owner && !x->gl_loading && glist_isvisible(x->gl_owner))
!             gobj_vis(&x->gl_gobj, x->gl_owner, 0);
          x->gl_isgraph = 0;
!         if (x->gl_owner && !x->gl_loading && glist_isvisible(x->gl_owner))
!         {
!             gobj_vis(&x->gl_gobj, x->gl_owner, 1);
!         }
!     }
!     else if (flag && !glist_isgraph(x))
!     {
!         if (x->gl_pixwidth <= 0)
!             x->gl_pixwidth = GLIST_DEFGRAPHWIDTH;
! 
!         if (x->gl_pixheight <= 0)
!             x->gl_pixheight = GLIST_DEFGRAPHHEIGHT;
! 
          if (x->gl_owner && !x->gl_loading && glist_isvisible(x->gl_owner))
              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);
!         if (x->gl_owner && !x->gl_loading && glist_isvisible(x->gl_owner))
!         {
!             gobj_vis(&x->gl_gobj, x->gl_owner, 1);
!         }
      }
  }
--- 1487,1507 ----
  void canvas_setgraph(t_glist *x, int flag, int nogoprect)
  {
!     if (!flag && glist_isgraph(x)) {
          x->gl_isgraph = 0;
!     } else if (flag && !glist_isgraph(x)) {
!         if (x->gl_pixwidth  <= 0) x->gl_pixwidth  = GLIST_DEFGRAPHWIDTH;
!         if (x->gl_pixheight <= 0) x->gl_pixheight = GLIST_DEFGRAPHHEIGHT;
          if (x->gl_owner && !x->gl_loading && glist_isvisible(x->gl_owner))
              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);
      }
  }





More information about the Pd-cvs mailing list