Update of /cvsroot/pure-data/externals/tkwidgets/shared In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26942/shared
Modified Files: tkwidgets.c tkwidgets.h Log Message:
- created functions to generate all the various Tk IDs and tags and ported text.c to use those functions
- started sketch for checkbutton.c
Index: tkwidgets.c =================================================================== RCS file: /cvsroot/pure-data/externals/tkwidgets/shared/tkwidgets.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tkwidgets.c 15 Nov 2007 17:27:03 -0000 1.3 --- tkwidgets.c 21 Nov 2007 22:19:12 -0000 1.4 *************** *** 34,77 ****
! void query_options(t_symbol *receive_name, char *widget_id, int argc, char** argv) { int i; for(i = 0; i < argc; i++) sys_vgui("pd [concat %s query_callback %s [%s cget -%s] \;]\n", ! receive_name->s_name, argv[i], widget_id, argv[i]); }
! /* ! I think I'll probably have to follow Krzsztof and make structs to make this work ! tkwidgets_setcallbackname(void *x, char *widget_name) { char buf[MAXPDSTRING];
! sprintf(buf,"%s%lx", widget_name, (long unsigned int)x); ! x->tcl_namespace = getbytes(strlen(buf)); ! strcpy(x->tcl_namespace, buf);
! sprintf(buf,"#%s", x->tcl_namespace); ! x->receive_name = gensym(buf); ! pd_bind(&x->x_obj.ob_pd, x->receive_name); } - */
! void draw_inlets(t_object *x, t_glist *glist, int firsttime, ! int total_inlets, int total_outlets) { ! // TODO perhaps I should try to use glist_drawiofor() from g_text.c }
! void draw_handle() { ! // TODO draw resize handle when selected in editmode }
! void draw_resize_window() { // TODO draw the resize window while resizing } --- 34,152 ----
! void tkwidgets_query_options(t_symbol *receive_name, t_symbol *widget_id, ! int argc, char** argv) { int i; for(i = 0; i < argc; i++) sys_vgui("pd [concat %s query_callback %s [%s cget -%s] \;]\n", ! receive_name->s_name, argv[i], widget_id->s_name, argv[i]); }
! void tkwidgets_restore_options(t_symbol *receive_name, t_symbol *widget_id, ! int argc, char** argv) ! { ! int i; ! for(i = 0; i < argc; i++) ! { ! // TODO parse out -flags and values, and set them here: ! sys_vgui("%s configure %s\n", ! widget_id->s_name, argv[i]); ! } ! } ! ! void tkwidgets_set_ids(t_object *x, t_tkwidgets *tkw, t_canvas *canvas) ! { ! ! tkw->canvas = canvas; ! } ! ! ! t_symbol* tkwidgets_gen_tcl_namespace(t_object* x, t_symbol* widget_name) { char buf[MAXPDSTRING]; + sprintf(buf,"%s%lx", widget_name->s_name, (long unsigned int)x); + return gensym(buf); + }
! t_symbol* tkwidgets_gen_callback_name(t_symbol* tcl_namespace) ! { ! char buf[MAXPDSTRING]; ! sprintf(buf,"#%s", tcl_namespace->s_name); ! return gensym(buf); ! }
! t_symbol* tkwidgets_gen_canvas_id(t_canvas* canvas) ! { ! char buf[MAXPDSTRING]; ! sprintf(buf,".x%lx.c", (long unsigned int) canvas); ! return gensym(buf); }
! t_symbol* tkwidgets_gen_frame_id(t_object* x, t_symbol* canvas_id) { ! char buf[MAXPDSTRING]; ! sprintf(buf,"%s.frame%lx", canvas_id->s_name, (long unsigned int)x); ! return gensym(buf); }
+ t_symbol* tkwidgets_gen_widget_id(t_object* x, t_symbol* parent_id) + { + char buf[MAXPDSTRING]; + sprintf(buf,"%s.widget%lx", parent_id->s_name, (long unsigned int)x); + return gensym(buf); + }
+ t_symbol* tkwidgets_gen_window_id(t_object* x, t_symbol* canvas_id) + { + char buf[MAXPDSTRING]; + sprintf(buf,"%s.window%lx", canvas_id->s_name, (long unsigned int)x); + return gensym(buf); + }
! t_symbol* tkwidgets_gen_handle_id(t_object *x, t_symbol* canvas_id) { ! char buf[MAXPDSTRING]; ! sprintf(buf,"%s.handle%lx", canvas_id->s_name, (long unsigned int)x); ! return gensym(buf); }
+ t_symbol* tkwidgets_gen_scrollbar_id(t_object *x, t_symbol* frame_id) + { + char buf[MAXPDSTRING]; + sprintf(buf,"%s.scrollbar%lx", frame_id->s_name, (long unsigned int)x); + return gensym(buf); + }
! t_symbol* tkwidgets_gen_all_tag(t_object *x) ! { ! char buf[MAXPDSTRING]; ! sprintf(buf,"all%lx", (long unsigned int)x); ! return gensym(buf); ! } ! ! void tkwidgets_draw_inlets(t_object *x, t_glist *glist, ! int total_inlets, int total_outlets) ! { ! // TODO perhaps I should try to use glist_drawiofor() from g_text.c ! } ! ! void tkwidgets_draw_handle() ! { ! // TODO draw resize handle when selected in editmode ! } ! ! void tkwidgets_draw_resize_window() { // TODO draw the resize window while resizing } + + + /* + void query_options() + { + + } + + + + */
Index: tkwidgets.h =================================================================== RCS file: /cvsroot/pure-data/externals/tkwidgets/shared/tkwidgets.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tkwidgets.h 15 Nov 2007 17:27:03 -0000 1.3 --- tkwidgets.h 21 Nov 2007 22:19:12 -0000 1.4 *************** *** 28,31 **** --- 28,32 ---- #include "g_canvas.h"
+ /* I don't know what these do, but they seem to be everywhere */ #ifdef _MSC_VER #pragma warning( disable : 4244 ) *************** *** 41,68 **** typedef struct _tkwidgets { ! t_symbol *canvas_id; /* the canvas that is showing this widget */ ! t_symbol *receive_name; /* name to bind to, to receive callbacks */ ! t_symbol *window_id; /* the window that contains the widget */ ! t_symbol *widget_id; /* the core widget */ ! t_symbol *all_tag; /* the tag for moving/deleting everything */ ! int resizing; /* flag to tell when being resized */ ! int selected; /* flag for when widget is selected */ } t_tkwidgets;
- - /* query a tk widget for the state of all its options */ ! void query_options(t_symbol *receive_name, char *widget_id, int argc, char** argv);
/* this should be part of the Pd API */ ! t_symbol *canvas_getname(t_canvas *canvas); void tkwidgets_setcallbackname(void *x, char *widget_name);
// TODO perhaps I should try to use glist_drawiofor() from g_text.c ! void draw_inlets(t_object *x, t_glist *glist, int firsttime, int total_inlets, int total_outlets); ! void draw_handle(); // TODO draw resize handle when selected in editmode ! void draw_resize_window(); // TODO draw the resize window while resizing
--- 42,87 ---- typedef struct _tkwidgets { ! t_canvas* canvas; /* canvas/glist this widget is currently drawn in*/ ! t_glist* glist; /* glist that owns this widget */ ! t_binbuf* options_binbuf;/* binbuf to save options state in */ ! t_symbol* receive_name; /* name to bind to, to receive callbacks */ ! t_symbol* tcl_namespace; /* namespace to prevent name collisions */ ! t_symbol* canvas_id; /* the canvas that is showing this widget */ ! t_symbol* frame_id; /* the frame around the widget and supporters */ ! t_symbol* window_id; /* the window that contains the widget */ ! t_symbol* widget_id; /* the core widget */ ! t_symbol* handle_id; /* the resizing handle */ ! t_symbol* all_tag; /* the tag for moving/deleting everything */ ! int resizing; /* flag to tell when being resized */ ! int selected; /* flag for when widget is selected */ } t_tkwidgets;
/* query a tk widget for the state of all its options */ ! void tkwidgets_query_options(t_symbol* receive_name, t_symbol *widget_id, ! int argc, char** argv); ! /* initialize things on new widget */ ! void tkwidgets_new(t_tkwidgets* tkw);
/* this should be part of the Pd API */ ! t_symbol* canvas_getname(t_canvas *canvas); ! void tkwidgets_setcallbackname(void *x, char *widget_name);
+ t_symbol* tkwidgets_gen_tcl_namespace(t_object* x, t_symbol* widget_name); + t_symbol* tkwidgets_gen_callback_name(t_symbol* tcl_namespace); + t_symbol* tkwidgets_gen_canvas_id(t_canvas* canvas); + t_symbol* tkwidgets_gen_frame_id(t_object* x, t_symbol* canvas_id); + t_symbol* tkwidgets_gen_widget_id(t_object* x, t_symbol* parent_id); + t_symbol* tkwidgets_gen_handle_id(t_object *x, t_symbol* parent_id); + t_symbol* tkwidgets_gen_window_tag(t_object* x, t_symbol* parent_id); + t_symbol* tkwidgets_gen_all_tag(t_object *x); + + // TODO perhaps I should try to use glist_drawiofor() from g_text.c ! void tkwidgets_draw_inlets(t_object *x, t_glist *glist, int total_inlets, int total_outlets); ! void tkwidgets_draw_handle(); // TODO draw resize handle when selected in editmode ! void tkwidgets_draw_resize_window(); // TODO draw the resize window while resizing
*************** *** 72,74 ****
! #endif /* NOT g_TK_WIDGETS_H */ --- 91,93 ----
! #endif /* NOT __TK_WIDGETS_H */