[PD-cvs] externals/grill/flext/source flattr_ed.cpp,1.24,1.25 flqueue.cpp,1.20,1.21

Thomas Grill xovo at users.sourceforge.net
Tue Nov 9 04:31:36 CET 2004


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

Modified Files:
	flattr_ed.cpp flqueue.cpp 
Log Message:
fixed a thread sensitive spot
make some adaptations for 0.38 compatibility
made queue length longer and added overflow checks


Index: flqueue.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flqueue.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** flqueue.cpp	7 Nov 2004 03:30:45 -0000	1.20
--- flqueue.cpp	9 Nov 2004 03:31:34 -0000	1.21
***************
*** 27,32 ****
  
  
! #define QUEUE_LENGTH 512
! #define QUEUE_ATOMS 1024
  
  class qmsg
--- 27,32 ----
  
  
! #define QUEUE_LENGTH 2048
! #define QUEUE_ATOMS 8192
  
  class qmsg
***************
*** 198,202 ****
      #endif
  
!         for(int i = 0; i < qc; ++i) {
              queue.Head().Send();
              queue.Pop();
--- 198,203 ----
      #endif
  
!         // once more, because flushing in destructors could have reduced the count
!         for(qc = queue.Count(); qc--; ) {
              queue.Head().Send();
              queue.Pop();

Index: flattr_ed.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flattr_ed.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** flattr_ed.cpp	7 Nov 2004 03:30:42 -0000	1.24
--- flattr_ed.cpp	9 Nov 2004 03:31:34 -0000	1.25
***************
*** 44,82 ****
  #endif
  
! void flext_base::SetAttrEditor(t_classid c)
  {
!     // widgetbehavior struct MUST be resident... (static is just ok here)
! 
! #ifndef FLEXT_CLONEWIDGET
!     ori_vis = c->c_wb->w_visfn; 
!     widgetbehavior.w_getrectfn =    c->c_wb->w_getrectfn; 
!     widgetbehavior.w_displacefn =   c->c_wb->w_displacefn; 
!     widgetbehavior.w_selectfn =     c->c_wb->w_selectfn; 
!     widgetbehavior.w_activatefn =   c->c_wb->w_activatefn; 
!     widgetbehavior.w_deletefn =     c->c_wb->w_deletefn; 
!     widgetbehavior.w_clickfn =      c->c_wb->w_clickfn;
! #else
!     widgetbehavior.w_getrectfn =    text_widgetbehavior.w_getrectfn; 
!     widgetbehavior.w_displacefn =   text_widgetbehavior.w_displacefn; 
!     widgetbehavior.w_selectfn =     text_widgetbehavior.w_selectfn; 
!     widgetbehavior.w_activatefn =   text_widgetbehavior.w_activatefn; 
!     widgetbehavior.w_deletefn =     text_widgetbehavior.w_deletefn; 
!     widgetbehavior.w_clickfn =      text_widgetbehavior.w_clickfn;
! #endif
! 
! #if PD_MINOR_VERSION >= 37
!     class_setpropertiesfn(c,cb_GfxProperties);
!     class_setsavefn(c,cb_GfxSave);
! #else
!     widgetbehavior.w_propertiesfn = cb_GfxProperties;
!     widgetbehavior.w_savefn =       cb_GfxSave;
! #endif
! 
!     widgetbehavior.w_visfn =        cb_GfxVis;
!     class_setwidget(c, &widgetbehavior);
! 
!     // generate the script for the property dialog
  
!     sys_gui(
          "proc flext_escatoms {lst} {\n"
              "set tmp {}\n"
--- 44,55 ----
  #endif
  
! //! generate the script for the property dialog
! static void tclscript()
  {
!     static bool havecode = false;
!     if(havecode) return;
!     else havecode = true;
  
!     sys_vgui(
          "proc flext_escatoms {lst} {\n"
              "set tmp {}\n"
***************
*** 85,94 ****
                  "set a [regsub {,} $a \\\\,]\n"  // replace , with \,
                  "set a [regsub {;} $a \\\\\\;]\n"  // replace ; with \;
- //                "set a [regsub {%} $a %%]\n"  // replace % with \%
                  "lappend tmp $a\n"
              "}\n"
              "return $tmp\n"
          "}\n"
! 
          "proc flext_makevalue {id ix} {\n"
              // strip "." from the TK id to make a variable name suffix
--- 58,67 ----
                  "set a [regsub {,} $a \\\\,]\n"  // replace , with \,
                  "set a [regsub {;} $a \\\\\\;]\n"  // replace ; with \;
                  "lappend tmp $a\n"
              "}\n"
              "return $tmp\n"
          "}\n"
!     );
!     sys_vgui(
          "proc flext_makevalue {id ix} {\n"
              // strip "." from the TK id to make a variable name suffix
***************
*** 124,128 ****
              "return $lst\n" 
          "}\n"
! 
          "proc flext_apply {id ix} {\n"
              "set lst [flext_makevalue $id $ix]\n"
--- 97,102 ----
              "return $lst\n" 
          "}\n"
!     );
!     sys_vgui(
          "proc flext_apply {id ix} {\n"
              "set lst [flext_makevalue $id $ix]\n"
***************
*** 151,155 ****
              "flext_cancel $id\n"
          "}\n"
! 
          "proc flext_help {id} {\n"
              "toplevel $id.hw\n"
--- 125,130 ----
              "flext_cancel $id\n"
          "}\n"
!     );
!     sys_vgui(
          "proc flext_help {id} {\n"
              "toplevel $id.hw\n"
***************
*** 178,182 ****
              "$id.hw.text configure -state disabled\n"
          "}\n"
! 
          "proc flext_copyval {dst src} {\n"
              "global $src $dst\n"
--- 153,158 ----
              "$id.hw.text configure -state disabled\n"
          "}\n"
!     );
!     sys_vgui(
          "proc flext_copyval {dst src} {\n"
              "global $src $dst\n"
***************
*** 193,197 ****
              "destroy $id\n"
          "}\n"
! 
          "proc flext_textzoom {id var title attr edit} {\n"
              "global $var\n"
--- 169,174 ----
              "destroy $id\n"
          "}\n"
!     );
!     sys_vgui(
          "proc flext_textzoom {id var title attr edit} {\n"
              "global $var\n"
***************
*** 231,235 ****
              "bind $id.w {<KeyPress-Escape>} \"destroy $id.w\"\n"
          "}\n"
! 
          "proc pdtk_flext_dialog {id title attrlist} {\n"
                  "set vid [string trimleft $id .]\n"
--- 208,213 ----
              "bind $id.w {<KeyPress-Escape>} \"destroy $id.w\"\n"
          "}\n"
!     );
!     sys_vgui(
          "proc pdtk_flext_dialog {id title attrlist} {\n"
                  "set vid [string trimleft $id .]\n"
***************
*** 275,279 ****
                  "grid config $id.sep -column 0 -columnspan 9 -row $row -pady 2 -sticky {snew}\n"
                  "incr row\n"
! 
                  "set ix 1\n"
                  "foreach {an av ai atp asv afl} $attrlist {\n"
--- 253,258 ----
                  "grid config $id.sep -column 0 -columnspan 9 -row $row -pady 2 -sticky {snew}\n"
                  "incr row\n"
!     );
!     sys_vgui(
                  "set ix 1\n"
                  "foreach {an av ai atp asv afl} $attrlist {\n"
***************
*** 310,314 ****
                      "label $id.label-$ix -text \"$an :\" -font {Helvetica 8 bold}\n"
                      "grid config $id.label-$ix -column 0 -row $row -padx 5 -sticky {e}\n"
! 
                      "if { $afl != 0 } {\n"
                          // attribute is puttable
--- 289,294 ----
                      "label $id.label-$ix -text \"$an :\" -font {Helvetica 8 bold}\n"
                      "grid config $id.label-$ix -column 0 -row $row -padx 5 -sticky {e}\n"
!     );
!     sys_vgui(
                      "if { $afl != 0 } {\n"
                          // attribute is puttable
***************
*** 360,363 ****
--- 340,345 ----
                              "grid config $id.b$i-$ix -column [expr $i + 6] -row $row  \n"
                          "}\n"
+     );
+     sys_vgui(
                      "} else {\n"
                          // attribute is gettable only
***************
*** 393,397 ****
                      "incr row\n"
                  "}\n"
! 
                  // Separator
                  "frame $id.sep2 -relief ridge -bd 1 -height 2\n"
--- 375,380 ----
                      "incr row\n"
                  "}\n"
!     );
!     sys_vgui(
                  // Separator
                  "frame $id.sep2 -relief ridge -bd 1 -height 2\n"
***************
*** 425,428 ****
--- 408,446 ----
  }
  
+ void flext_base::SetAttrEditor(t_classid c)
+ {
+     // widgetbehavior struct MUST be resident... (static is just ok here)
+ 
+ #ifndef FLEXT_CLONEWIDGET
+     ori_vis = c->c_wb->w_visfn; 
+     widgetbehavior.w_getrectfn =    c->c_wb->w_getrectfn; 
+     widgetbehavior.w_displacefn =   c->c_wb->w_displacefn; 
+     widgetbehavior.w_selectfn =     c->c_wb->w_selectfn; 
+     widgetbehavior.w_activatefn =   c->c_wb->w_activatefn; 
+     widgetbehavior.w_deletefn =     c->c_wb->w_deletefn; 
+     widgetbehavior.w_clickfn =      c->c_wb->w_clickfn;
+ #else
+     widgetbehavior.w_getrectfn =    text_widgetbehavior.w_getrectfn; 
+     widgetbehavior.w_displacefn =   text_widgetbehavior.w_displacefn; 
+     widgetbehavior.w_selectfn =     text_widgetbehavior.w_selectfn; 
+     widgetbehavior.w_activatefn =   text_widgetbehavior.w_activatefn; 
+     widgetbehavior.w_deletefn =     text_widgetbehavior.w_deletefn; 
+     widgetbehavior.w_clickfn =      text_widgetbehavior.w_clickfn;
+ #endif
+ 
+ #if PD_MINOR_VERSION >= 37
+     class_setpropertiesfn(c,cb_GfxProperties);
+     class_setsavefn(c,cb_GfxSave);
+ #else
+     widgetbehavior.w_propertiesfn = cb_GfxProperties;
+     widgetbehavior.w_savefn =       cb_GfxSave;
+ #endif
+ 
+     widgetbehavior.w_visfn =        cb_GfxVis;
+     class_setwidget(c, &widgetbehavior);
+ 
+     tclscript();
+ }
+ 
  static size_t escapeit(char *dst,size_t maxlen,const char *src)
  {
***************
*** 511,515 ****
                  PrintAtom(lv[i],tmp,sizeof tmp);
                  b += escapeit(b,sizeof(buf)+buf-b,tmp);
!                 if(i < lv.Count()-1) { *(b++) = ' '; *(b++) = 0; }
              }
          }
--- 529,533 ----
                  PrintAtom(lv[i],tmp,sizeof tmp);
                  b += escapeit(b,sizeof(buf)+buf-b,tmp);
!                 if(i < lv.Count()-1) { *(b++) = ' '; *b = 0; }
              }
          }
***************
*** 525,532 ****
  
              for(int i = 0; i < lp.Count(); ++i) {
!                 char tmp[100];
                  PrintAtom(lp[i],tmp,sizeof(tmp)); 
                  b += escapeit(b,sizeof(buf)+buf-b,tmp);
!                 if(i < lp.Count()-1) { *(b++) = ' '; *(b++) = 0; }
              }
          }
--- 543,550 ----
  
              for(int i = 0; i < lp.Count(); ++i) {
!                 char tmp[256];
                  PrintAtom(lp[i],tmp,sizeof(tmp)); 
                  b += escapeit(b,sizeof(buf)+buf-b,tmp);
!                 if(i < lp.Count()-1) { *(b++) = ' '; *b = 0; }
              }
          }





More information about the Pd-cvs mailing list