[PD-cvs] externals/grill/flext/source flattr_ed.cpp,1.26,1.27 flclass.h,1.46,1.47

Thomas Grill xovo at users.sourceforge.net
Mon Nov 15 04:31:02 CET 2004


Update of /cvsroot/pure-data/externals/grill/flext/source
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16621/source

Modified Files:
	flattr_ed.cpp flclass.h 
Log Message:
fix for _long_ attribute dialogs
fix for showing attributes on select (and recreate the object on edit)


Index: flattr_ed.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flattr_ed.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** flattr_ed.cpp	13 Nov 2004 03:30:49 -0000	1.26
--- flattr_ed.cpp	15 Nov 2004 03:30:59 -0000	1.27
***************
*** 463,470 ****
  {
      flext_base *th = thisObject(c);
!     char buf[10000],*b = buf;
  
!     STD::sprintf(b, "pdtk_flext_dialog %%s { "); b += strlen(b);
  
      t_text *x = (t_text *)c;
      FLEXT_ASSERT(x->te_binbuf);
--- 463,474 ----
  {
      flext_base *th = thisObject(c);
!     char buf[1000];
  
!      // beginning of proc
!     sys_vgui("proc pdtk_flext_dialog_%p {title} {\n",th);
  
+     sys_vgui("pdtk_flext_dialog $title {\n");
+ 
+     // add title
      t_text *x = (t_text *)c;
      FLEXT_ASSERT(x->te_binbuf);
***************
*** 473,479 ****
      t_atom *argv = binbuf_getvec(x->te_binbuf);
  
!     PrintList(argc,argv,b,sizeof(buf)+buf-b);   b += strlen(b);
! 
!     STD::sprintf(b, " } { "); b += strlen(b);
  
      AtomList la;
--- 477,482 ----
      t_atom *argv = binbuf_getvec(x->te_binbuf);
  
!     PrintList(argc,argv,buf,sizeof(buf));
!     sys_vgui("%s } {\n",buf);
  
      AtomList la;
***************
*** 521,525 ****
          }
  
!         STD::sprintf(b,list?"%s {":"%s ",GetString(sym)); b += strlen(b);
  
          AtomList lv;
--- 524,528 ----
          }
  
!         sys_vgui(list?"%s {\n":"%s\n",GetString(sym));
  
          AtomList lv;
***************
*** 528,531 ****
--- 531,535 ----
              th->GetAttrib(sym,gattr,lv);
  
+             char *b = buf;
              for(int i = 0; i < lv.Count(); ++i) {
                  char tmp[100];
***************
*** 534,543 ****
                  if(i < lv.Count()-1) { *(b++) = ' '; *b = 0; }
              }
          }
!         else {
!             strcpy(b,"{}"); b += strlen(b);
!         }
  
!         strcpy(b, list?"} {":" "); b += strlen(b);
  
          if(pattr) {
--- 538,547 ----
                  if(i < lv.Count()-1) { *(b++) = ' '; *b = 0; }
              }
+             sys_vgui("%s\n",buf);
          }
!         else
!             sys_vgui("{}\n");
  
!         sys_vgui(list?"} {\n":" \n");
  
          if(pattr) {
***************
*** 545,548 ****
--- 549,553 ----
              const AtomList &lp = initdata?*initdata:lv;
  
+             char *b = buf;
              for(int i = 0; i < lp.Count(); ++i) {
                  char tmp[256];
***************
*** 551,566 ****
                  if(i < lp.Count()-1) { *(b++) = ' '; *b = 0; }
              }
          }
!         else {
!             strcpy(b,"{}"); b += strlen(b);
!         }
  
  
!         STD::sprintf(b, list?"} %i %i %i ":" %i %i %i ",tp,sv,pattr?(pattr->BothExist()?2:1):0); b += strlen(b);
      }
  
!     strcpy(b, " }\n");
  
!     gfxstub_new((t_pd *)th->thisHdr(), th->thisHdr(), buf);
  }
  
--- 556,574 ----
                  if(i < lp.Count()-1) { *(b++) = ' '; *b = 0; }
              }
+             sys_vgui("%s\n",buf);
          }
!         else
!             sys_vgui("{}\n");
  
  
!         sys_vgui(list?"} %i %i %i \n":" %i %i %i \n",tp,sv,pattr?(pattr->BothExist()?2:1):0);
      }
  
!     sys_vgui(" } }\n"); // end of proc
  
!     STD::sprintf(buf,"pdtk_flext_dialog_%p %%s\n",th);
!     gfxstub_new((t_pd *)th->thisHdr(), th->thisHdr(),buf);
! 
!     //! \todo delete proc in TCL space
  }
  
***************
*** 575,579 ****
  
          t_binbuf *b = binbuf_new();
!         th->BinbufArgs(b,x->te_binbuf,true);
  
          // delete old object box text
--- 583,587 ----
  
          t_binbuf *b = binbuf_new();
!         th->BinbufArgs(b,x->te_binbuf,true,false);
  
          // delete old object box text
***************
*** 609,614 ****
  
              t_binbuf *b = binbuf_new();
!             th->BinbufArgs(b,x->te_binbuf,true);
!             if(state) th->BinbufAttr(b);
  
              // delete old object box text
--- 617,622 ----
  
              t_binbuf *b = binbuf_new();
!             th->BinbufArgs(b,x->te_binbuf,true,false);
!             if(state) th->BinbufAttr(b,false);
  
              // delete old object box text
***************
*** 637,643 ****
  
      // process the object arguments
!     th->BinbufArgs(b,t->te_binbuf,false);
      // process the attributes
!     th->BinbufAttr(b);
      // add end sign
      binbuf_addv(b, ";");
--- 645,651 ----
  
      // process the object arguments
!     th->BinbufArgs(b,t->te_binbuf,false,true);
      // process the attributes
!     th->BinbufAttr(b,true);
      // add end sign
      binbuf_addv(b, ";");
***************
*** 712,737 ****
  
  
! static void BinbufAdd(t_binbuf *b,const t_atom &at)
  {
!     char tbuf[MAXPDSTRING];
!     if(flext::IsString(at))
!         binbuf_addv(b,"s",flext::GetSymbol(at));
!     else if(flext::IsFloat(at))
!         binbuf_addv(b,"f",flext::GetFloat(at));
!     else if(flext::IsInt(at))
!         binbuf_addv(b,"i",flext::GetInt(at));
!     else if(at.a_type == A_DOLLAR) {
          sprintf(tbuf, "$%d", at.a_w.w_index);
          binbuf_addv(b,"s",flext::MakeSymbol(tbuf));
      }
!     else if(at.a_type == A_DOLLSYM) {
          sprintf(tbuf, "$%s", at.a_w.w_symbol->s_name);
          binbuf_addv(b,"s",flext::MakeSymbol(tbuf));
      }
      else
!         FLEXT_ASSERT(false);
  }
  
! void flext_base::BinbufArgs(t_binbuf *b,t_binbuf *args,bool withname)
  {
      int argc = binbuf_getnatom(args);
--- 720,740 ----
  
  
! static void BinbufAdd(t_binbuf *b,const t_atom &at,bool transdoll)
  {
!     if(transdoll && at.a_type == A_DOLLAR) {
!         char tbuf[MAXPDSTRING];
          sprintf(tbuf, "$%d", at.a_w.w_index);
          binbuf_addv(b,"s",flext::MakeSymbol(tbuf));
      }
!     else if(transdoll && at.a_type == A_DOLLSYM) {
!         char tbuf[MAXPDSTRING];
          sprintf(tbuf, "$%s", at.a_w.w_symbol->s_name);
          binbuf_addv(b,"s",flext::MakeSymbol(tbuf));
      }
      else
!         binbuf_add(b,1,const_cast<t_atom *>(&at));
  }
  
! void flext_base::BinbufArgs(t_binbuf *b,t_binbuf *args,bool withname,bool transdoll)
  {
      int argc = binbuf_getnatom(args);
***************
*** 739,746 ****
      int i,cnt = CheckAttrib(argc,argv);
      // process the creation arguments
!     for(i = withname?0:1; i < cnt; ++i) BinbufAdd(b,argv[i]);
  }
  
! void flext_base::BinbufAttr(t_binbuf *b)
  {
      // process the attributes
--- 742,749 ----
      int i,cnt = CheckAttrib(argc,argv);
      // process the creation arguments
!     for(i = withname?0:1; i < cnt; ++i) BinbufAdd(b,argv[i],transdoll);
  }
  
! void flext_base::BinbufAttr(t_binbuf *b,bool transdoll)
  {
      // process the attributes
***************
*** 795,799 ****
  
              // store value
!             for(int j = 0; j < lref->Count(); ++j) BinbufAdd(b,(*lref)[j]);
          }
      }
--- 798,802 ----
  
              // store value
!             for(int j = 0; j < lref->Count(); ++j) BinbufAdd(b,(*lref)[j],transdoll);
          }
      }

Index: flclass.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flclass.h,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -d -r1.46 -r1.47
*** flclass.h	13 Nov 2004 03:30:49 -0000	1.46
--- flclass.h	15 Nov 2004 03:30:59 -0000	1.47
***************
*** 864,869 ****
  	static void cb_GfxSelect(t_gobj *x, struct _glist *glist, int state);
  
!     void BinbufArgs(t_binbuf *b,t_binbuf *args,bool withname);
!     void BinbufAttr(t_binbuf *b);
  #endif
  
--- 864,869 ----
  	static void cb_GfxSelect(t_gobj *x, struct _glist *glist, int state);
  
!     void BinbufArgs(t_binbuf *b,t_binbuf *args,bool withname,bool transdoll);
!     void BinbufAttr(t_binbuf *b,bool transdoll);
  #endif
  





More information about the Pd-cvs mailing list