Update of /cvsroot/pure-data/externals/bbogart/entry In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27089
Modified Files: entry.c Log Message: got live resizing working, now I need to fix the handle, it doesn't move properly
Index: entry.c =================================================================== RCS file: /cvsroot/pure-data/externals/bbogart/entry/entry.c,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** entry.c 13 Nov 2007 15:27:54 -0000 1.30 --- entry.c 13 Nov 2007 17:01:39 -0000 1.31 *************** *** 27,31 **** /* TODO: set message doesnt work with a loadbang */ /* TODO: complete inlet draw/erase logic */ - /* TODO: unbind text from all key events when selected */ /* TODO: handle scrollbar when resizing */ /* TODO: sort out x_height/x_width vs. x_rect_height/x_rect_width */ --- 27,30 ---- *************** *** 124,128 **** static void entry_delete(t_gobj *z, t_glist *glist); static void entry_vis(t_gobj *z, t_glist *glist, int vis); ! static int entry_click(t_gobj *x, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit); static void entry_save(t_gobj *z, t_binbuf *b);
--- 123,127 ---- static void entry_delete(t_gobj *z, t_glist *glist); static void entry_vis(t_gobj *z, t_glist *glist, int vis); ! //static int entry_click(t_gobj *x, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit); static void entry_save(t_gobj *z, t_binbuf *b);
*************** *** 135,139 **** w_deletefn: entry_delete, w_visfn: entry_vis, ! w_clickfn: entry_click, };
--- 134,138 ---- w_deletefn: entry_delete, w_visfn: entry_vis, ! w_clickfn: NULL, };
*************** *** 188,191 **** --- 187,193 ---- int current_iolet, int total_iolets) { + post("calculate_onset"); + post("x_rect_width: %d x_width: %d", x->x_rect_width, x->x_width); + post("x_rect_height: %d x_height: %d", x->x_rect_height, x->x_height); return(text_xpix(&x->x_obj, glist) + (x->x_rect_width - IOWIDTH) \ * current_iolet / (total_iolets == 1 ? 1 : total_iolets - 1)); *************** *** 316,319 **** --- 318,323 ---- DEBUG(post("create_widget");); /* I guess this is for fine-tuning of the rect size based on width and height? */ + post("x_rect_width: %d x_width: %d", x->x_rect_width, x->x_width); + post("x_rect_height: %d x_height: %d", x->x_rect_height, x->x_height); x->x_rect_width = x->x_width; x->x_rect_height = x->x_height+2; *************** *** 323,328 **** /* Seems we have to delete the widget in case it already exists (Provided by Guenter)*/ sys_vgui("destroy %s\n", x->frame_id); - - sys_vgui("frame %s \n", x->frame_id); sys_vgui("text %s -font {%s %d %s} -border 1 \ --- 327,330 ---- *************** *** 333,346 **** x->x_bgcolour->s_name, x->x_fgcolour->s_name, x->scrollbar_id); ! sys_vgui("scrollbar %s -command {%s yview}\n", x->scrollbar_id, x->text_id); sys_vgui("pack %s -side left -fill both -expand 1 \n", x->text_id); sys_vgui("pack %s -side bottom -fill both -expand 1 \n", x->frame_id);
- sys_vgui("bind %s <KeyRelease> {+pd %s keyup %%N \;} \n", - x->text_id, x->x_receive_name->s_name); - bind_standard_keys(x); bind_button_events(x); }
--- 335,347 ---- x->x_bgcolour->s_name, x->x_fgcolour->s_name, x->scrollbar_id); ! sys_vgui("scrollbar %s -command {%s yview}\n", x->scrollbar_id, x->text_id); sys_vgui("pack %s -side left -fill both -expand 1 \n", x->text_id); sys_vgui("pack %s -side bottom -fill both -expand 1 \n", x->frame_id);
bind_standard_keys(x); bind_button_events(x); + sys_vgui("bind %s <KeyRelease> {+pd %s keyup %%N \;} \n", + x->text_id, x->x_receive_name->s_name); }
*************** *** 351,357 **** if (firsttime) { ! create_widget(x); /* TODO: what is this window for? */ sys_vgui("%s create window %d %d -anchor nw -window %s \ ! -tags {%s %s} -width %d -height %d \n", x->canvas_id, text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist), x->frame_id, x->window_tag, x->all_tag, x->x_width, x->x_height); --- 352,361 ---- if (firsttime) { ! post("x_rect_width: %d x_width: %d", x->x_rect_width, x->x_width); ! post("x_rect_height: %d x_height: %d", x->x_rect_height, x->x_height); ! create_widget(x); ! if(x->x_have_scrollbar) draw_scrollbar(x); sys_vgui("%s create window %d %d -anchor nw -window %s \ ! -tags {%s %s} -width %d -height %d \n", x->canvas_id, text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist), x->frame_id, x->window_tag, x->all_tag, x->x_width, x->x_height); *************** *** 389,402 **** int *xp1, int *yp1, int *xp2, int *yp2) { ! /* DEBUG(post("entry_getrect");); */ /* this one is very chatty :D */ ! int width, height; ! t_entry* s = (t_entry*)z;
! width = s->x_rect_width; ! height = s->x_rect_height; ! *xp1 = text_xpix(&s->x_obj, owner); ! *yp1 = text_ypix(&s->x_obj, owner) - 1; ! *xp2 = text_xpix(&s->x_obj, owner) + width; ! *yp2 = text_ypix(&s->x_obj, owner) + height; }
--- 393,403 ---- int *xp1, int *yp1, int *xp2, int *yp2) { ! // DEBUG(post("entry_getrect");); /* this one is very chatty :D */ ! t_entry *x = (t_entry*)z;
! *xp1 = text_xpix(&x->x_obj, owner); ! *yp1 = text_ypix(&x->x_obj, owner); ! *xp2 = *xp1 + x->x_rect_width; ! *yp2 = *yp1 + x->x_rect_height; }
*************** *** 462,471 **** sys_vgui("canvas %s -width %d -height %d -bg #fedc00 -bd 0 -cursor top_left_arrow\n", x->handle_id, TKW_HANDLE_WIDTH, TKW_HANDLE_HEIGHT); ! sys_vgui("%s create window %f %f -anchor nw -width %d -height %d -window %s -tags {%s RSZ}\n", x->canvas_id, x2 - (TKW_HANDLE_WIDTH - SCOPE_SELBDWIDTH), y2 - (TKW_HANDLE_HEIGHT - SCOPE_SELBDWIDTH), TKW_HANDLE_WIDTH, TKW_HANDLE_HEIGHT, x->handle_id, x->all_tag); ! sys_vgui("%s raise RSZ\n", x->canvas_id); sys_vgui("bind %s <Button> {pd [concat %s resize_click 1 \;]}\n", x->handle_id, x->x_receive_name->s_name); --- 463,472 ---- sys_vgui("canvas %s -width %d -height %d -bg #fedc00 -bd 0 -cursor top_left_arrow\n", x->handle_id, TKW_HANDLE_WIDTH, TKW_HANDLE_HEIGHT); ! sys_vgui("%s create window %f %f -anchor nw -width %d -height %d -window %s -tags RSZ\n", x->canvas_id, x2 - (TKW_HANDLE_WIDTH - SCOPE_SELBDWIDTH), y2 - (TKW_HANDLE_HEIGHT - SCOPE_SELBDWIDTH), TKW_HANDLE_WIDTH, TKW_HANDLE_HEIGHT, x->handle_id, x->all_tag); ! sys_vgui("raise %s\n", x->handle_id); sys_vgui("bind %s <Button> {pd [concat %s resize_click 1 \;]}\n", x->handle_id, x->x_receive_name->s_name); *************** *** 504,518 **** }
! static int entry_click(t_gobj *x, t_glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit) { DEBUG(post("entry_click x:%d y:%d ", xpix, ypix);); ! /* this is currently unused ! t_text *x = (t_text *)z; ! t_rtext *y = glist_findrtext(glist, x); ! if (z->g_pd != gatom_class) rtext_activate(y, state); ! */ }
static void entry_append(t_entry* x, t_symbol *s, int argc, t_atom *argv) --- 505,517 ---- }
! /* static int entry_click(t_gobj *x, t_glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit) { DEBUG(post("entry_click x:%d y:%d ", xpix, ypix);); ! // this is currently unused ! return 0; } + */
static void entry_append(t_entry* x, t_symbol *s, int argc, t_atom *argv) *************** *** 741,748 **** sys_vgui("%s itemconfigure %s -width %d -height %d \n", x->canvas_id, x->all_tag, (int)width, (int)height); ! entry_vis(x, x->x_canvas, 0); ! entry_vis(x, x->x_canvas, 1); }
static void entry_click_callback(t_entry *x, t_floatarg f) { --- 740,748 ---- sys_vgui("%s itemconfigure %s -width %d -height %d \n", x->canvas_id, x->all_tag, (int)width, (int)height); ! entry_vis((t_gobj *)x, x->x_canvas, 0); ! entry_vis((t_gobj *)x, x->x_canvas, 1); }
+ /* callback functions */ static void entry_click_callback(t_entry *x, t_floatarg f) { *************** *** 763,769 **** if (canvas) { - sys_vgui(".x%x.c delete RESIZE_OUTLINE\n", canvas); - entry_vis(x,canvas,0); - entry_vis(x,canvas,1); sys_vgui("destroy %s\n", x->handle_id); entry_select((t_gobj *)x, x->x_glist, 1); --- 763,766 ---- *************** *** 778,785 **** int x1, y1, x2, y2; entry_getrect((t_gobj *)x, x->x_glist, &x1, &y1, &x2, &y2); - // sys_vgui("lower %s\n", x->handle_id); - sys_vgui(".x%x.c create rectangle %d %d %d %d -outline blue -width %f -tags RESIZE_OUTLINE\n", - canvas, x1, y1, x2, y2, SCOPE_SELBDWIDTH); - sys_vgui("%s raise RESIZE_OUTLINE\n", canvas); } x->x_resize_x = 0; --- 775,778 ---- *************** *** 801,808 **** if (newx > x1 + SCOPE_MINWIDTH && newy > y1 + SCOPE_MINHEIGHT) { ! t_canvas *canvas = (glist_isvisible(x->x_glist) ? x->x_canvas : 0); ! if (canvas) ! sys_vgui(".x%x.c coords RESIZE_OUTLINE %d %d %d %d\n", ! canvas, x1, y1, newx, newy); x->x_resize_x = dx; x->x_resize_y = dy; --- 794,805 ---- if (newx > x1 + SCOPE_MINWIDTH && newy > y1 + SCOPE_MINHEIGHT) { ! if (glist_isvisible(x->x_glist)) ! { ! sys_vgui("%s itemconfigure %s -width %d -height %d\n", ! x->canvas_id, x->window_tag, ! x->x_width + dx, x->x_height + dy); ! // sys_vgui("%s coords RSZ %d %d\n", ! // x->canvas_id, newx, newy); ! } x->x_resize_x = dx; x->x_resize_y = dy;