From 725255345f7c0bd70eb31ebbf12a4c76170e6a1c Mon Sep 17 00:00:00 2001 From: "rama.gottfried" Date: Sat, 9 Aug 2014 00:00:02 -0400 Subject: [PATCH 1/2] pd textbox guis work: added o.expr.codebox, revamped textbox approach to fix several bugs, removed old hacky workaround with less kludgy workarounds --- src/o.compose/o.compose.c | 66 ++-- src/o.compose/opd_textbox.h | 565 ++++++++++++++++++++-------- src/o.expr.codebox/o.expr.codebox.c | 499 +++++++++++++++++------- src/odot.xcodeproj/project.pbxproj | 187 +++++++++ 4 files changed, 985 insertions(+), 332 deletions(-) diff --git a/src/o.compose/o.compose.c b/src/o.compose/o.compose.c index 179f0590..ba7380ca 100644 --- a/src/o.compose/o.compose.c +++ b/src/o.compose/o.compose.c @@ -102,8 +102,6 @@ enum { #ifdef OMAX_PD_VERSION typedef struct _ocompose { t_object ob; - t_glist *glist; //the canvas heirarchy - t_opd_textbox *textbox; long textlen; @@ -185,7 +183,7 @@ void ocompose_int(t_ocompose *x, long n); void ocompose_float(t_ocompose *x, double xx); void ocompose_list(t_ocompose *x, t_symbol *msg, short argc, t_atom *argv); void ocompose_anything(t_ocompose *x, t_symbol *msg, short argc, t_atom *argv); -void omax_util_outletOSC(void *outlet, long len, char *ptr); +//void omax_util_outletOSC(void *outlet, long len, char *ptr); void ocompose_free(t_ocompose *x); void ocompose_inletinfo(t_ocompose *x, void *b, long index, char *t); void *ocompose_new(t_symbol *msg, short argc, t_atom *argv); @@ -764,6 +762,7 @@ static void ocompose_getrect(t_gobj *z, t_glist *glist,int *xp1, int *yp1, int * *xp2 = x2; *yp2 = y2; //post("%s %d %d %d %d", __func__, x1, y1, x2, y2); + opd_textbox_motion(x->textbox); } @@ -820,7 +819,7 @@ void ocompose_drawElements(t_object *ob, int firsttime) } else { - post("%x %s REDRAW height %d y1 %d y2 %d \n", x, __func__, t->height, y1, y2); + //post("%x %s REDRAW height %d y1 %d y2 %d \n", x, __func__, t->height, y1, y2); sys_vgui(".x%lx.c coords %s %d %d %d %d\n", canvas, x->border_tag, x1, y1, x2, y2); sys_vgui(".x%lx.c coords %sBorder %d %d %d %d %d %d %d %d %d %d %d %d \n",canvas, x->border_tag, cx1, cy1, cx2, cy1, cx2, cy2-10, cx2-10, cy2-10, cx2-10, cy2, cx1, cy2); @@ -864,23 +863,25 @@ static void ocompose_displace(t_gobj *z, t_glist *glist,int dx, int dy) { t_ocompose *x = (t_ocompose *)z; - x->ob.te_xpix += dx; - x->ob.te_ypix += dy; - - t_canvas *canvas = glist_getcanvas(glist); - sys_vgui(".x%lx.c move %s %d %d\n", canvas, x->border_tag, dx, dy); - sys_vgui(".x%lx.c move %sBorder %d %d\n", canvas, x->border_tag, dx, dy); - sys_vgui(".x%lx.c move %s %d %d\n", canvas, x->corner_tag, dx, dy); - sys_vgui(".x%lx.c move text%lx %d %d\n", canvas, (long)x, dx, dy); - - opd_textbox_displace(x->textbox, glist, dx, dy); - + if(!x->textbox->mouseDown) + { + x->ob.te_xpix += dx; + x->ob.te_ypix += dy; + + t_canvas *canvas = glist_getcanvas(glist); + + sys_vgui(".x%lx.c move %s %d %d\n", canvas, x->border_tag, dx, dy); + sys_vgui(".x%lx.c move %sBorder %d %d\n", canvas, x->border_tag, dx, dy); + sys_vgui(".x%lx.c move %s %d %d\n", canvas, x->corner_tag, dx, dy); + + opd_textbox_displace(x->textbox, glist, dx, dy); + } } static void ocompose_select(t_gobj *z, t_glist *glist, int state) { - post("%s %d", __func__, state); + //post("%s %d", __func__, state); t_ocompose *x = (t_ocompose *)z; t_canvas *canvas = glist_getcanvas(glist); @@ -897,7 +898,7 @@ static void ocompose_select(t_gobj *z, t_glist *glist, int state) static void ocompose_activate(t_gobj *z, t_glist *glist, int state) { - post("%s %d", __func__, state); + //post("%s %d", __func__, state); t_ocompose *x = (t_ocompose *)z; t_canvas *canvas = glist_getcanvas(glist); @@ -917,7 +918,7 @@ static void ocompose_activate(t_gobj *z, t_glist *glist, int state) static void ocompose_delete(t_gobj *z, t_glist *glist) { - post("%s", __func__); + //post("%s", __func__); t_ocompose *x = (t_ocompose *)z; t_opd_textbox *t = x->textbox; t_canvas *canvas = glist_getcanvas(glist); @@ -985,7 +986,7 @@ static void ocompose_save(t_gobj *z, t_binbuf *b) { t_ocompose *x = (t_ocompose *)z; t_opd_textbox *t = x->textbox; - post("%x %s", x, __func__); + //post("%x %s", x, __func__); opd_textbox_setHexFromText(t, t->text); @@ -1022,7 +1023,7 @@ static void ocompose_save(t_gobj *z, t_binbuf *b) void ocompose_free(t_ocompose *x) { - post("%x %s", x, __func__); + //post("%x %s", x, __func__); free(x->border_tag); free(x->corner_tag); @@ -1065,6 +1066,11 @@ void *ocompose_new(t_symbol *msg, short argc, t_atom *argv) t->editmode = glist_getcanvas(t->glist)->gl_edit; t->textediting = 0; + t->resizebox_x_offset = 2; + t->resizebox_y_offset = 2; + t->resizebox_height = 10; + t->resizebox_width = 10; + x->textbox = t; // post("%s %p glist %x canvas %x\n", __func__, x, t->glist, glist_getcanvas(t->glist)); @@ -1088,10 +1094,8 @@ void *ocompose_new(t_symbol *msg, short argc, t_atom *argv) x->have_new_data = 1; x->draw_new_data_indicator = 0; - x->border_tag = NULL; x->corner_tag = NULL; - //object name heirarchy: char buf[MAXPDSTRING]; @@ -1114,24 +1118,8 @@ void *ocompose_new(t_symbol *msg, short argc, t_atom *argv) } strcpy(x->corner_tag, buf); + opd_textbox_atoms(t, argc, argv); - if(argc > 3) - { - t->width = atom_getfloat(argv); - t->height = atom_getfloat(argv+1); - if(((argv+2)->a_type == A_SYMBOL ) && (atom_getsymbol(argv+2) == gensym("binhex"))) - { - - opd_textbox_textbuf(t, NULL, argc-2, (argv+2)); - t_atom done[2]; - atom_setsym(done, gensym("binhex")); - atom_setsym(done+1, gensym(t->receive_name)); - opd_textbox_textbuf(t, NULL, 2, done); - - } - } - -// post("%x %s height %d", x, __func__, x->height); t->in_new_flag = 0; t->softlock = 0; diff --git a/src/o.compose/opd_textbox.h b/src/o.compose/opd_textbox.h index 315b8466..f6437081 100644 --- a/src/o.compose/opd_textbox.h +++ b/src/o.compose/opd_textbox.h @@ -1,6 +1,10 @@ #ifndef odot_opd_textbox_h #define odot_opd_textbox_h +#include "m_imp.h" + +//#define OPD_TEXTBOX_DEBUG + typedef struct _opd_textbox { t_object ob; @@ -15,11 +19,14 @@ typedef struct _opd_textbox char *iolets_tag; uint16_t textediting; + uint16_t new_texteditor; + uint16_t c_bind; + uint16_t send_bind; + uint16_t editmode; uint16_t selected; - uint16_t displacing; uint16_t firsttime; uint16_t firstdisplace; @@ -29,22 +36,31 @@ typedef struct _opd_textbox uint16_t cmdDown; uint16_t mouseDown; - int xref; - int yscroll; int softlock; int streamflag; int in_new_flag; + int height; int width; - + int xref, yref, wref; + + int resizebox_height; + int resizebox_width; + int resizebox_x_offset; + int resizebox_y_offset; + uint16_t resize_hit; + t_gotfn draw_fn; t_gotfn gettext_fn; t_gotfn delete_fn; t_gotfn click_fn; - /* + + t_clock *unbind_delay; + + /* t_gotfn p_getrect; t_gotfn p_displace; t_gotfn p_select; @@ -57,8 +73,58 @@ typedef struct _opd_textbox void opd_textbox_nofocus_callback(t_opd_textbox *t); +void opd_textbox_outsideclick_callback(t_opd_textbox *t); +int opd_textbox_resizeHitTest(t_opd_textbox *x, int mx, int my); +int opd_textbox_motion(t_opd_textbox *x); +void opd_textbox_unbindCanvasEvents(t_opd_textbox *x) +{ + if(x->c_bind) + { + t_canvas *canvas = glist_getcanvas(x->glist); + // sys_vgui("::opd_textbox::unbind .x%lx.c {::opd_textbox::sendto %s resize_mousemove %%x %%y} \n", canvas, x->receive_name); + +#ifdef OPD_TEXTBOX_DEBUG + post("%x %s ...", x, __func__); +#endif + + sys_vgui("::opd_textbox::unbind .x%lx {::opd_textbox::sendto %s resize_mousedown %%x %%y} \n", canvas, x->receive_name); + sys_vgui("::opd_textbox::unbind .x%lx {::opd_textbox::sendto %s resize_mouseup} \n", canvas, x->receive_name); + + //sys_vgui("focus .x%lx\n", canvas, (long)x); + + // sys_vgui("::pdwindow::post \"check [bind .x%lx.c ] \n\" \n", canvas); + x->c_bind = 0; + } +#ifdef OPD_TEXTBOX_DEBUG + else { post("%x already unbound", x); } + post("%x %s end c_bind %d",x, __func__, x->c_bind); +#endif + +} + +void opd_textbox_bindCanvasEvents(t_opd_textbox *x) +{ + if(!x->c_bind) + { +#ifdef OPD_TEXTBOX_DEBUG + post("%x %s ...", x, __func__); +#endif + + t_canvas *canvas = glist_getcanvas(x->glist); + sys_vgui("bind .x%lx {+::opd_textbox::sendto %s resize_mousedown %%x %%y} \n", canvas, x->receive_name); + sys_vgui("bind .x%lx {+::opd_textbox::sendto %s resize_mouseup} \n", canvas, x->receive_name); + // sys_vgui("bind .x%lx.c {+::opd_textbox::sendto %s resize_mousemove %%x %%y} \n", canvas, x->receive_name); + // sys_vgui("::pdwindow::post \"check [bind .x%lx.c ] \n\" \n", canvas); + + x->c_bind = 1; + } +#ifdef OPD_TEXTBOX_DEBUG + post("%x %s end c_bind %d",x, __func__, x->c_bind); +#endif +} + void opd_textbox_drawParent(t_opd_textbox *t, int firstime) { if(t->draw_fn) @@ -79,8 +145,13 @@ void opd_textbox_setHeight(t_opd_textbox *t, float y) if((h != t->height) || t->forceredraw) { t->height = h; + +#ifdef OPD_TEXTBOX_DEBUG post("%x %s height set to %d firsttime %d", t, __func__, t->height, t->firsttime); - opd_textbox_drawParent(t, t->firsttime); +#endif + + if(t->send_bind) + opd_textbox_drawParent(t, t->firsttime); t->forceredraw = 0; @@ -92,7 +163,10 @@ void opd_textbox_setHeight(t_opd_textbox *t, float y) void opd_textbox_getRectAndDraw(t_opd_textbox *t, int forceredraw) { -// post("%x %s", t, __func__); +#ifdef OPD_TEXTBOX_DEBUG + post("%x %s", t, __func__); +#endif + t->forceredraw = forceredraw; t->softlock = 1; sys_vgui("pdsend \"%s setheight [lindex [.x%lx.c bbox text%lx] 3]\" \n", t->receive_name, glist_getcanvas(t->glist), (long)t); @@ -101,31 +175,131 @@ void opd_textbox_getRectAndDraw(t_opd_textbox *t, int forceredraw) void opd_textbox_resize_mousedown(t_opd_textbox *t) { - // post("%s", __func__); - t->mouseDown = 1; - t->xref = t->width; +#ifdef OPD_TEXTBOX_DEBUG + post("%x %s", t, __func__); +#endif + int mx,my, x1, y1, x2, y2; + glist_getnextxy(glist_getcanvas(t->glist), &mx, &my); //<< mouse position + gobj_getrect((t_gobj *)t->parent, t->glist, &x1, &y1, &x2, &y2); + + if(opd_textbox_motion(t)) //<< returns true for resize hit test + { + if(!t->selected) + gobj_select(&t->parent->te_g, t->glist, 1); +// gobj_select((t_gobj *)t->parent, t->glist, 1); + + + t->mouseDown = 1; + t->xref = mx; + t->wref = t->width; + sys_vgui("bind .x%lx.c {+::opd_textbox::sendto %s resize_mousemove %%x %%y} \n", glist_getcanvas(t->glist), t->receive_name); + } + else if ((t->textediting || t->selected) && (mx < x1 || mx > x2 || my < y1 || my > y2)) + { + opd_textbox_outsideclick_callback(t); + } } -void opd_textbox_resize_mousemove(t_opd_textbox *t, float dx, float dy) +void opd_textbox_resize_mousemove(t_opd_textbox *t, float x, float y) { - if(t->mouseDown && t->editmode) +#ifdef OPD_TEXTBOX_DEBUG + post("%x %s", t, __func__); +#endif + + if(t->mouseDown && glist_getcanvas(t->glist)->gl_edit) { - int width = (dx + t->xref); + int width = t->wref + ((int)x - t->xref); width = (width < 50) ? 50 : width; t->width = width; +#ifdef OPD_TEXTBOX_DEBUG + post("%x %s %d %d", t, __func__, (int)x, width); +#endif opd_textbox_getRectAndDraw(t, 1); - } + else + ;//post("mdown %d edit %d", t->mouseDown, glist_getcanvas(t->glist)->gl_edit); } void opd_textbox_resize_mouseup(t_opd_textbox *t) { - t->mouseDown = 0; - opd_textbox_drawParent(t, 0); +#ifdef OPD_TEXTBOX_DEBUG + post("%x %s", t, __func__); +#endif + + if(t->mouseDown) + { + gobj_select(&t->parent->te_g, t->glist, 0); +// gobj_select((t_gobj *)t->parent, t->glist, 0); + sys_vgui("::opd_textbox::unbind .x%lx.c {::opd_textbox::sendto %s resize_mousemove %%x %%y} \n", glist_getcanvas(t->glist), t->receive_name); + + t->mouseDown = 0; + opd_textbox_drawParent(t, 0); + + } +} + + +int opd_textbox_resizeHitTest(t_opd_textbox *x, int mx, int my) +{ + t_canvas *c = glist_getcanvas(x->glist); + + int test = 0; + if(c->gl_edit && glist_isvisible(c) && glist_istoplevel(c)) + { + int x1, y1, x2, y2; + x1 = text_xpix(x->parent, x->glist); + y1 = text_ypix(x->parent, x->glist); + x2 = x1 + x->width; + y2 = y1 + x->height; + + int rw = x->resizebox_width / 2; + int rh = x->resizebox_height / 2; + int rx1 = x2 - rw + x->resizebox_x_offset; + int ry1 = y2 - rh + x->resizebox_y_offset; + int rx2 = rx1 + rw; + int ry2 = ry1 + rh; + + test = (mx > rx1 && mx < rx2 && my > ry1 && my < ry2); + + if(test != x->resize_hit) + { + if(c->gl_edit) + { + char *color = (test && (x->selected || x->textediting)) ? "#006699" : "\"\""; + sys_vgui(".x%lx.c itemconfigure %lxRESIZE -outline %s \n", c, (long)x, color); + + + char *cursormode = (test && (x->textediting || x->selected || x->mouseDown)) ? "$cursor_editmode_resize" : "$cursor_runmode_nothing"; + //canvas_setcursor((t_canvas *)x->glist, cursormode); //<< not sure why this doesn't work + sys_vgui(".x%lx configure -cursor %s\n", c, cursormode); + } + + x->resize_hit = test; + } + } + return test; } +int opd_textbox_motion(t_opd_textbox *x) +{ + t_canvas *c = glist_getcanvas(x->glist); + + int test = 0; + if(c->gl_edit && glist_isvisible(c) && glist_istoplevel(c)) + { + int mx,my; + glist_getnextxy(c, &mx, &my); //<< mouse position + test = opd_textbox_resizeHitTest(x, mx, my); + opd_textbox_resize_mousemove(x, (float)mx, (float)my); + } + else + ;//post("gl_edit %d isvis %d istop %d", c->gl_edit, glist_isvisible(c), glist_istoplevel(c)); + + return test; +} + void opd_textbox_bind_text_events(t_opd_textbox *t) { t_canvas *canvas = glist_getcanvas(t->glist); @@ -133,33 +307,28 @@ void opd_textbox_bind_text_events(t_opd_textbox *t) sys_vgui("bind .x%lx.t%lxTEXT {+pdsend {%s keyup %%N }}\n", canvas, (long)t, t->receive_name); //focusout for clicking to other windows other than the main canvas - sys_vgui("bind .x%lx.t%lxTEXT {+pdsend {%s nofocus }}\n", canvas, (long)t, t->receive_name); + //sys_vgui("bind .x%lx.t%lxTEXT {+pdsend {%s nofocus }}\n", canvas, (long)t, t->receive_name); - if(!t->c_bind) - { - // post("%p %s no bind", x, __func__); - sys_vgui("bind .x%lx.c {+pdsend {%s outsideclick }}\n", canvas, t->receive_name); - sys_vgui("bind .x%lx.c {+pdsend {%s mousewheel %%D }}\n", canvas, t->receive_name); - - t->c_bind = 1; - } - - sys_vgui("::pdwindow::post \"[bind .x%lx.c ] \n\"\n", canvas); } void opd_textbox_getTextAndCreateEditor(t_opd_textbox *t, int firsttime) { - - int x1 = text_xpix(t->parent, t->glist); - int y1 = text_ypix(t->parent, t->glist); - - post("%x %s %d x1 %d y1 %d x2 %d y2 %d", t, __func__, firsttime, x1, y1, x1+t->width, y1+t->height); - t_canvas *canvas = glist_getcanvas(t->glist); +#ifdef OPD_TEXTBOX_DEBUG + post("%x %s", t, __func__); +#endif if(firsttime) { - // post("%lx %lx %lx\n", canvas, (long)t, (long)&(x->ob) ); + t->new_texteditor = 1; + + int x1 = text_xpix(t->parent, t->glist); + int y1 = text_ypix(t->parent, t->glist); + + // post("%x %s %d x1 %d y1 %d x2 %d y2 %d", t, __func__, firsttime, x1, y1, x1+t->width, y1+t->height); + t_canvas *canvas = glist_getcanvas(t->glist); + +// gobj_select(&t->parent->te_g, t->glist, 0); // << deselect to disable PD key motions etc. glist_noselect(t->glist); sys_vgui(".x%lx.c itemconfigure text%lx -fill white \n", canvas, (long)t); sys_vgui("text .x%lx.t%lxTEXT -font {{%s} %d %s} -undo true -fg \"black\" -bg \"white\" -takefocus 1 -state normal -highlightthickness 0 -wrap word -spacing3 0 \n", canvas, (long)t, sys_font, glist_getfont(t->glist), sys_fontweight ); //-tabs {%d left} , glist_getfont(t->glist) * ? @@ -174,38 +343,47 @@ void opd_textbox_getTextAndCreateEditor(t_opd_textbox *t, int firsttime) sys_vgui(".x%lx.t%lxTEXT tag add sel 0.0 end\n", canvas, (long)t); opd_textbox_bind_text_events(t); - +// opd_textbox_bindCanvasEvents(t); + } else { // pretty sure that this never gets called error("%s pretty sure that this never gets called? please tell rama if you see this!", __func__); - sys_vgui("place .x%lx.t%lxTEXT -x %d -y %d -width %d -height %d\n", canvas, (long)t, x1+4, y1+4, t->width-15, t->height-10); + //sys_vgui("place .x%lx.t%lxTEXT -x %d -y %d -width %d -height %d\n", canvas, (long)t, x1+4, y1+4, t->width-15, t->height-10); } t->textediting = 1; + t->new_texteditor = 0; opd_textbox_getRectAndDraw(t, 1); + } void opd_textbox_storeTextAndExitEditorTick(t_opd_textbox *t) { +#ifdef OPD_TEXTBOX_DEBUG + post("%x %s", t, __func__); +#endif t_canvas *canvas = glist_getcanvas(t->glist); - opd_textbox_nofocus_callback(t); - sys_vgui(".x%lx.c itemconfigure text%lx -fill black -width %d -text [subst -nobackslash -nocommands -novariables [string trimright {%s} ]] \n", canvas, (long)t->parent, t->width-15, t->text); - sys_vgui("destroy .x%lx.t%lxTEXT\n", canvas, (long)t); t->textediting = 0; +// opd_textbox_nofocus_callback(t); - opd_textbox_getRectAndDraw(t, 1); + sys_vgui(".x%lx.c itemconfigure text%lx -fill black -width %d -text [subst -nobackslash -nocommands -novariables [string trimright {%s} ]] \n", canvas, (long)t, t->width-15, t->text); + sys_vgui("destroy .x%lx.t%lxTEXT\n", canvas, (long)t); + gobj_select(&t->parent->te_g, t->glist, 0); + + opd_textbox_getRectAndDraw(t, 1); + } void opd_textbox_storeTextAndExitEditor(t_opd_textbox *t) { if(t->textediting){ - sys_vgui("sendchunks [.x%lx.t%lxTEXT get 0.0 end] %s \n", glist_getcanvas(t->glist), (long)t, t->receive_name); //sendchunks + sys_vgui("::opd_textbox::sendchunks [.x%lx.t%lxTEXT get 0.0 end] %s \n", glist_getcanvas(t->glist), (long)t, t->receive_name); //sendchunks //receive happens on next tick } @@ -213,6 +391,11 @@ void opd_textbox_storeTextAndExitEditor(t_opd_textbox *t) void opd_textbox_insideclick_callback(t_opd_textbox *t) { + //I belive this function is obsolete +#ifdef OPD_TEXTBOX_DEBUG + post("%x %s", t, __func__); +#endif + t_canvas *canvas = glist_getcanvas(t->glist); if(canvas->gl_edit) { @@ -221,12 +404,8 @@ void opd_textbox_insideclick_callback(t_opd_textbox *t) sys_vgui("focus .x%lx.t%lxTEXT\n", canvas, (long)t); glist_noselect(t->glist); - gobj_select((t_gobj *)t, t->glist, 1); - if(!t->c_bind) - { - sys_vgui("bind .x%lx.c {+pdsend {%s outsideclick }}\n", canvas, t->receive_name); - t->c_bind = 1; - } + gobj_select(&t->parent->te_g, t->glist, 1); + } else { sys_vgui("focus .x%lx.c\n", canvas); opd_textbox_storeTextAndExitEditor(t); @@ -238,19 +417,33 @@ void opd_textbox_insideclick_callback(t_opd_textbox *t) } +//called when clicking from one object to another without clicking on the empty canvas first +void opd_textbox_nofocus_callback(t_opd_textbox *t) +{ +#ifdef OPD_TEXTBOX_DEBUG + post("%x %s", t, __func__); +#endif + opd_textbox_unbindCanvasEvents(t); + gobj_select(&t->parent->te_g, t->glist, 0); +// sys_vgui("focus .x%lx.c\n", glist_getcanvas(t->glist)); + +} + + void opd_textbox_outsideclick_callback(t_opd_textbox *t) { - // post("%p %s", t, __func__); - - t->c_bind = 0; +#ifdef OPD_TEXTBOX_DEBUG + post("%x %s", t, __func__); +#endif + /* t_canvas *canvas = glist_getcanvas(t->glist); - sys_vgui("bind .x%lx.c $::%s::canvas%lxBUTTONBINDING\n", canvas, t->tcl_namespace, canvas); - sys_vgui("bind .x%lx.c $::%s::canvas%lxSCROLLBINDING \n", canvas, t->tcl_namespace, canvas ); - + opd_textbox_unbindCanvasEvents(t); + sys_vgui("focus .x%lx.c\n", canvas); gobj_select(&t->parent->te_g, t->glist, 0); //<< opd_textbox_storeTextAndExitEditor(x); called from select function - + */ + opd_textbox_nofocus_callback(t); //same for t->selected = 0; @@ -258,20 +451,6 @@ void opd_textbox_outsideclick_callback(t_opd_textbox *t) } -//called when clicking from one object to another without clicking on the empty canvas first -void opd_textbox_nofocus_callback(t_opd_textbox *t) -{ - t->c_bind = 0; - t_canvas *canvas = glist_getcanvas(t->glist); - sys_vgui("bind .x%lx.c $::%s::canvas%lxBUTTONBINDING\n", canvas, t->tcl_namespace, canvas); - sys_vgui("bind .x%lx.c $::%s::canvas%lxSCROLLBINDING \n", canvas, t->tcl_namespace, canvas ); - - sys_vgui("::pd_bindings::global_bindings \n"); - -// sys_vgui("bind .x%lx.c $::%s::canvas%lxKEYBINDING \n", canvas, t->tcl_namespace, canvas); - - gobj_select(&t->parent->te_g, t->glist, 0); -} void opd_textbox_mousewheel_callback(t_opd_textbox *t) @@ -300,7 +479,7 @@ void opd_textbox_key_callback(t_opd_textbox *t, t_symbol *s, int argc, t_atom *a { // in order to expand textbox when typing carrige return, need to *not trim trailing newline* // - printargs(argc, argv); + //printargs(argc, argv); if(argc == 1) { @@ -554,28 +733,25 @@ int opd_textbox_drawElements(t_opd_textbox *x, int x1, int y1, int x2, int y2, i // post("%x %s isvisible %d isgraph %d gl_editor %d", x, __func__, glist_isvisible(glist), glist_isgraph(glist), canvas->gl_editor); + int rw = x->resizebox_width / 2; + int rh = x->resizebox_height / 2; + int rx1 = x2 - rw + x->resizebox_x_offset; + int ry1 = y2 - rh + x->resizebox_y_offset; + int rx2 = rx1 + rw; + int ry2 = ry1 + rh; if (firsttime) { - // post("%x %s FIRST VIS height %d y1 %d y2 %d \n", x, __func__, x->height, y1, y2); - - //fist time: create canvas elements, then add text, then get text height, and re-draw - //post("%s drawing firsttime", __func__); - sys_vgui("namespace eval ::%s [list set canvas%lxBUTTONBINDING [bind .x%lx.c ]] \n", x->tcl_namespace, canvas, canvas); - sys_vgui("namespace eval ::%s [list set canvas%lxKEYBINDING [bind .x%lx.c ]] \n", x->tcl_namespace, canvas, canvas); - sys_vgui("namespace eval ::%s [list set canvas%lxSCROLLBINDING [bind .x%lx.c ]] \n", x->tcl_namespace, canvas, canvas); - - sys_vgui("::pdwindow::post \" FOOOOOOOOOOOO [bind .x%lx.c ] \n\"\n", canvas); +#ifdef OPD_TEXTBOX_DEBUG + post("%x %s FIRST VIS height %d y1 %d y2 %d", x, __func__, x->height, y1, y2); +#endif - //create resize handle canvas, and bind to mouse - sys_vgui("canvas .x%lx.h%lxHANDLE -width 10 -height 10 \n", canvas, (long)x); - sys_vgui(".x%lx.h%lxHANDLE create rectangle %d %d %d %d -outline \"white\" -fill \"white\" -tags %lxHANDLE \n",canvas, (long)x, 0, 0, 10, 10, (long)x); - sys_vgui("place .x%lx.h%lxHANDLE -x [expr %d - [.x%lx.c canvasx 0]] -y [expr %d - [.x%lx.c canvasy 0]] -width %d -height %d\n", canvas, (long)x, x2-4, canvas, y2-4, canvas, 10, 10); - sys_vgui("bind .x%lx.h%lxHANDLE {+pdsend {%s resize_mousedown}} \n", canvas, (long)x, x->receive_name); - sys_vgui("bind .x%lx.h%lxHANDLE {+pdsend {%s resize_mousemove %%x %%y }} \n", canvas, (long)x, x->receive_name); - sys_vgui("bind .x%lx.h%lxHANDLE {+pdsend {%s resize_mouseup }} \n", canvas, (long)x, x->receive_name); + sys_vgui(".x%lx.c create rectangle %d %d %d %d -outline \"\" -fill \"\" -tags %lxRESIZE \n", canvas, rx1, ry1, rx2, ry2, x); + //opd_textbox_bindCanvasEvents(x); + //sys_vgui("::pdwindow::post \"canvas motion after? [bind .x%lx.c ] // search for: $::%s::canvas%lxMOTION // result [regsub -all $::%s::canvas%lxMOTION \"[bind .x%lx.c ]\" \"FOO\" ] // \n\" \n", canvas, x->tcl_namespace, canvas, x->tcl_namespace, canvas, canvas); + //create text display sys_vgui(".x%lx.c create text %d %d -anchor nw -width %d -font {{%s} %d %s} -tags text%lx -text [subst -nobackslash -nocommands -novariables [string trimright {%s} ]] -fill \"black\" \n", canvas, x1+5, y1+5, x->width-15, sys_font, glist_getfont(glist), sys_fontweight, (long)x, x->text); @@ -587,17 +763,12 @@ int opd_textbox_drawElements(t_opd_textbox *x, int x1, int y1, int x2, int y2, i } else { +#ifdef OPD_TEXTBOX_DEBUG post("%x %s REDRAW height %d y1 %d y2 %d mousedown %d selected %d\n", x, __func__, x->height, y1, y2, x->mouseDown, x->selected); - - if(x->mouseDown) - { - ;//make canvas sprite here to display when resizing, since handle canvas needs to freeze for best mouse action - } - else - { - sys_vgui("place .x%lx.h%lxHANDLE -x [expr %d - [.x%lx.c canvasx 0]] -y [expr %d - [.x%lx.c canvasy 0]] -width %d -height %d\n", canvas, (long)x, x2-4, canvas, y2-4, canvas, 10, 10); - } +#endif + sys_vgui(".x%lx.c coords %lxRESIZE %d %d %d %d\n", canvas, x, rx1, ry1, rx2, ry2); + if (x->textediting) { sys_vgui("place .x%lx.t%lxTEXT -x [expr %d - [.x%lx.c canvasx 0]] -y [expr %d - [.x%lx.c canvasy 0]] -width %d -height %d\n", canvas, (long)x, x1+4, canvas, y1+4, canvas, x->width-16, x->height-6); @@ -611,46 +782,57 @@ int opd_textbox_drawElements(t_opd_textbox *x, int x1, int y1, int x2, int y2, i //do syntax highlighting here? } + char *color = (x->selected || x->textediting) ? "#006699" : "\"\""; + sys_vgui(".x%lx.c itemconfigure %lxRESIZE -fill %s \n", canvas, (long)x, color); } - if(x->editmode) - { - sys_vgui(".x%lx.h%lxHANDLE itemconfigure %lxHANDLE -outline \"white\" -fill %s \n", canvas, (long)x, (long)x, ((x->selected && !x->mouseDown) ? "#006699" : "white")); - - if(x->selected || x->textediting || x->mouseDown) - sys_vgui(".x%lx.h%lxHANDLE configure -cursor fleur \n", canvas, (long)x); - else - sys_vgui(".x%lx.h%lxHANDLE configure -cursor hand2 \n", canvas, (long)x); - - } - else - sys_vgui(".x%lx.h%lxHANDLE configure -cursor left_ptr \n", canvas, (long)x); - - return 1; } static void opd_textbox_delete(t_opd_textbox *x, t_glist *glist) { +#ifdef OPD_TEXTBOX_DEBUG + post("%x %s", t, __func__); +#endif + t_canvas *canvas = glist_getcanvas(glist); + opd_textbox_unbindCanvasEvents(x); sys_vgui(".x%lx.c delete text%lx \n", canvas, (long)x); - sys_vgui("destroy .x%lx.h%lxHANDLE\n", canvas, (long)x); + sys_vgui(".x%lx.c delete %lxRESIZE \n", canvas, (long)x); if(x->textediting) sys_vgui("destroy .x%lx.t%lxTEXT\n", canvas, (long)x); } +void opd_textbox_unbind_tick(t_opd_textbox *x) +{ + pd_unbind(&x->ob.ob_pd, gensym(x->receive_name)); + x->send_bind = 0; + opd_textbox_unbindCanvasEvents(x); + post("unbind c_bind? %d", x->c_bind); +} + static void opd_textbox_vis(t_opd_textbox *x, t_glist *glist, int vis) { - - post("%p %s vis %d firsttime %d visable %d", x, __func__, vis, x->firsttime, glist_isvisible(glist)); -// post("%s %p xglist %x glist %x\n", __func__, x, x->glist, glist); + t_canvas *canvas = glist_getcanvas(glist); + +#ifdef OPD_TEXTBOX_DEBUG + post("%x %s vis %d firsttime %d visable %d", x, __func__, vis, x->firsttime, glist_isvisible(glist)); + post("%x canvas isabstraction %d isGOP %d", x, (canvas->gl_owner != NULL), glist_isgraph(glist)); +#endif + if(vis) { + if(!x->send_bind) + { + pd_bind(&x->ob.ob_pd, gensym(x->receive_name)); + opd_textbox_bindCanvasEvents(x); + x->send_bind = 1; + } if(!x->firsttime && glist_isgraph(glist)) { @@ -670,9 +852,13 @@ static void opd_textbox_vis(t_opd_textbox *x, t_glist *glist, int vis) } else //not visible when loading from disk and from abstraction { - x->firsttime = 1; - opd_textbox_delete(x, glist); // make sure custom canvases are refreshed - opd_textbox_getRectAndDraw(x, 1); + x->firsttime = 1; //<< must be deleted and drawn again + + opd_textbox_delete(x, glist); + if(x->firsttime) + { // is abstraction + opd_textbox_getRectAndDraw(x, 1); + } } if(x->textediting) @@ -683,6 +869,9 @@ static void opd_textbox_vis(t_opd_textbox *x, t_glist *glist, int vis) } else { + if(x->send_bind) + clock_delay(x->unbind_delay, 0); + //if(!x->firsttime) { if(x->delete_fn) @@ -693,17 +882,18 @@ static void opd_textbox_vis(t_opd_textbox *x, t_glist *glist, int vis) static void opd_textbox_displace(t_opd_textbox *x, t_glist *glist, int dx, int dy) { - post("%x %s mousedown %d dx %d dy %d", x, __func__, x->mouseDown, dx, dy); + //post("%x %s mousedown %d dx %d dy %d", x, __func__, x->mouseDown, dx, dy); int x2 = x->parent->te_xpix + x->width; int y2 = x->parent->te_ypix + x->height; t_canvas *canvas = glist_getcanvas(glist); - sys_vgui(".x%lx.c move text%lx %d %d\n", canvas, (long)x, dx, dy); - if (!x->mouseDown) - sys_vgui("place .x%lx.h%lxHANDLE -x [expr %d - [.x%lx.c canvasx 0]] -y [expr %d - [.x%lx.c canvasy 0]] -width %d -height %d\n", canvas, (long)x, x2-4, canvas, y2-4, canvas, 5, 5); + { + sys_vgui(".x%lx.c move text%lx %d %d\n", canvas, (long)x, dx, dy); + sys_vgui(".x%lx.c move %lxRESIZE %d %d\n", canvas, (long)x, dx, dy); + } if(x->textediting) { @@ -728,21 +918,43 @@ static void opd_textbox_displace(t_opd_textbox *x, t_glist *glist, int dx, int d void opd_textbox_select(t_opd_textbox *x, t_glist *glist, int state) { - - // post("%p %s state %d selected %d textediting %d <selected, x->textediting); +#ifdef OPD_TEXTBOX_DEBUG + post("%x %s state %d selected %d textediting %d", x, __func__, state, x->selected, x->textediting); +#endif + int prev_sel = x->selected; x->selected = state; - if(!state && x->textediting) - opd_textbox_storeTextAndExitEditor(x); - + if (state) + { + opd_textbox_bindCanvasEvents(x); + } + else + { + if(x->textediting) + { + opd_textbox_storeTextAndExitEditor(x); + } + else if(prev_sel && !x->new_texteditor) + opd_textbox_unbindCanvasEvents(x); + + } + + if(opd_textbox_motion(x)) + { + opd_textbox_resize_mousedown(x); + } + opd_textbox_drawParent(x, 0); } static void opd_textbox_activate(t_opd_textbox *x, t_glist *glist, int state) { - post("%s %d", __func__, state); +#ifdef OPD_TEXTBOX_DEBUG + post("%x %s %d", x, __func__, state); +#endif + x->mouseDown = 0; if(state) @@ -752,19 +964,39 @@ static void opd_textbox_activate(t_opd_textbox *x, t_glist *glist, int state) } +void opd_textbox_atoms(t_opd_textbox *t, short argc, t_atom *argv) +{ + if(argc > 3) + { + t->width = atom_getfloat(argv); + t->height = atom_getfloat(argv+1); + if(((argv+2)->a_type == A_SYMBOL ) && (atom_getsymbol(argv+2) == gensym("binhex"))) + { + + opd_textbox_textbuf(t, NULL, argc-2, (argv+2)); + t_atom done[2]; + atom_setsym(done, gensym("binhex")); + atom_setsym(done+1, gensym(t->receive_name)); + opd_textbox_textbuf(t, NULL, 2, done); + + } + } + else + ;//error("%s: not enough args", __func__); +} void opd_textbox_free(t_opd_textbox *t) { - post("%s", __func__); +// post("%s", __func__); free(t->text); free(t->hex); free(t->tcl_namespace); free(t->iolets_tag); - pd_unbind(&t->ob.ob_pd, gensym(t->receive_name)); free(t->receive_name); + clock_free(t->unbind_delay); } t_opd_textbox *opd_textbox_new(t_class *c) @@ -776,6 +1008,8 @@ t_opd_textbox *opd_textbox_new(t_class *c) // post("%x %s", t, __func__); t->glist = NULL; t->c_bind = 0; + t->send_bind = 0; + t->softlock = 0; t->draw_fn = NULL; @@ -799,6 +1033,12 @@ t_opd_textbox *opd_textbox_new(t_class *c) t->streamflag = 0; t->yscroll = 0; + t->resize_hit = 0; + t->resizebox_x_offset = 0; + t->resizebox_y_offset = 0; + t->resizebox_height = 10; + t->resizebox_width = 10; + char buf[MAXPDSTRING]; sprintf(buf, "%lxIOLETS", (long unsigned int)t); @@ -829,10 +1069,15 @@ t_opd_textbox *opd_textbox_new(t_class *c) return NULL; } strcpy(t->receive_name, buf); - - //post("%s %s", __func__, t->receive_name); + +#ifdef OPD_TEXTBOX_DEBUG + post("%x bind %s", t, t->receive_name); +#endif pd_bind(&t->ob.ob_pd, gensym(t->receive_name)); + t->send_bind = 1; + + //post("%s %s", __func__, t->receive_name); t->text = NULL; t->text = (char *)malloc(OMAX_PD_MAXSTRINGSIZE * sizeof(char)); @@ -851,6 +1096,10 @@ t_opd_textbox *opd_textbox_new(t_class *c) return NULL; } + + // kludge due to in ability to know if a vis 1 is immediately followed by a vis 0 which wipes out the receiver + t->unbind_delay = clock_new(t, (t_method)opd_textbox_unbind_tick); + } @@ -886,26 +1135,46 @@ t_class *opd_textbox_classnew(void) // class_setwidget(c, &c->opd_textbox_widget); */ + sys_vgui("namespace eval ::opd_textbox:: {}\n"); + + sys_vgui("proc ::opd_textbox::unbind {tag event script} {\n"); + sys_vgui(" set bind {}\n"); + sys_vgui(" foreach x [split [bind $tag $event] \"\n\"] {\n"); + sys_vgui(" if {$x != $script} {\n"); + sys_vgui(" lappend bind $x\n"); + sys_vgui(" }\n"); + sys_vgui(" }\n"); + sys_vgui(" bind $tag $event {}\n"); + sys_vgui(" foreach x $bind {bind $tag $event $x}\n"); + sys_vgui("}\n"); + + sys_vgui("proc ::opd_textbox::sendto {sendto args} {\n"); + sys_vgui(" pdsend \"$sendto $args\"\n"); + sys_vgui("}\n"); + + + sys_vgui("proc ::opd_textbox::sendchunks {str sendto} {\n"); + sys_vgui(" binary scan $str H* hex\n"); + sys_vgui(" set k 0 ; set chunksize 512 ; set len [string length $hex] ; set nchunks [expr $len / $chunksize] ; set chad [expr $len %% $chunksize] \n"); + sys_vgui(" if { $nchunks > 0 } { \n"); + sys_vgui(" for {set k 0} {$k < $nchunks} {incr k} {\n"); + sys_vgui(" set hexchunk \"\" \n"); + sys_vgui(" for {set i 0} {$i < $chunksize} {incr i} {\n"); + sys_vgui(" append hexchunk [string index $hex [expr $i + [expr $k * $chunksize]]]\n"); + sys_vgui(" }\n"); + sys_vgui(" pdsend \"$sendto textbuf hex $hexchunk \"\n"); + sys_vgui(" }\n"); + sys_vgui(" }\n"); + sys_vgui(" set hexchunk \"\" \n"); + sys_vgui(" for {set i 0} {$i < $chad} {incr i} {\n"); + sys_vgui(" append hexchunk [string index $hex [expr $i + [expr $k * $chunksize]]]\n"); + sys_vgui(" }\n"); + sys_vgui(" pdsend \"$sendto textbuf hex $hexchunk \"\n"); + sys_vgui(" pdsend \"$sendto textbuf hex $sendto \"\n"); + sys_vgui("}\n");//, x->receive_name, x->receive_name, x->receive_name, x->receive_name); + + //sys_vgui("eval [read [open {%s/%s.tcl}]]\n", c->c_externdir->s_name,c->c_name->s_name); - sys_vgui("proc sendchunks {str sendto} {\n\ - binary scan $str H* hex\n\ - set k 0 ; set chunksize 512 ; set len [string length $hex] ; set nchunks [expr $len / $chunksize] ; set chad [expr $len %% $chunksize] \n\ - if { $nchunks > 0 } { \n\ - for {set k 0} {$k < $nchunks} {incr k} {\n\ - set hexchunk \"\" \n\ - for {set i 0} {$i < $chunksize} {incr i} {\n\ - append hexchunk [string index $hex [expr $i + [expr $k * $chunksize]]]\n\ - }\n\ - pdsend \"$sendto textbuf hex $hexchunk \"\n\ - }\n\ - }\n\ - set hexchunk \"\" \n\ - for {set i 0} {$i < $chad} {incr i} {\n\ - append hexchunk [string index $hex [expr $i + [expr $k * $chunksize]]]\n\ - }\n\ - pdsend \"$sendto textbuf hex $hexchunk \"\n\ - pdsend \"$sendto textbuf hex $sendto \"\n\ - }\n");//, x->receive_name, x->receive_name, x->receive_name, x->receive_name); return c; } diff --git a/src/o.expr.codebox/o.expr.codebox.c b/src/o.expr.codebox/o.expr.codebox.c index 078e9edd..7305d0b5 100755 --- a/src/o.expr.codebox/o.expr.codebox.c +++ b/src/o.expr.codebox/o.expr.codebox.c @@ -54,15 +54,18 @@ #ifdef OMAX_PD_VERSION #include "m_pd.h" +//#include "m_imp.h" +#include "g_canvas.h" +//#include "g_all_guis.h" #else #include "ext.h" #include "ext_obex.h" #include "ext_obex_util.h" #include "ext_critical.h" -#endif - #include "jpatcher_api.h" #include "jgraphics.h" +#endif + #include "osc.h" #include "osc_expr.h" #include "osc_expr_parser.h" @@ -79,7 +82,39 @@ #include "o.h" -typedef struct _oexprcodebox{ +#ifdef OMAX_PD_VERSION +#define OMAX_PD_MAXSTRINGSIZE (1<<16) +#include "opd_textbox.h" + +typedef struct _jrgba { + double red; ///< Red component in the range [0.0, 1.0] + double green; ///< Green component in the range [0.0, 1.0] + double blue; + double alpha; ///< Alpha (transparency) component in the range [0.0, 1.0] +} t_jrgba; + +typedef struct _oexprcodebox +{ + t_object ob; + t_opd_textbox *textbox; + char *border_tag; + char *update_tag; + t_critical lock; + long textlen; + char *text; + t_jrgba frame_color, background_color, text_color, default_color, error_color; + void *outlets[2]; + t_osc_expr *expr; +} t_oexprcodebox; + +t_class *oexprcodebox_class; +t_class *oexprcodebox_textbox_class; + +t_widgetbehavior oexprcodebox_widgetbehavior; + +#else +typedef struct _oexprcodebox +{ t_jbox ob; t_critical lock; long textlen; @@ -90,6 +125,8 @@ typedef struct _oexprcodebox{ } t_oexprcodebox; void *oexprcodebox_class; +#endif + void oexprcodebox_bang(t_oexprcodebox *x); @@ -141,6 +178,7 @@ void oexprcodebox_fullPacket(t_oexprcodebox *x, t_symbol *msg, int argc, t_atom } } +#ifndef OMAX_PD_VERSION void oexprcodebox_paint(t_oexprcodebox *x, t_object *patcherview) { critical_enter(x->lock); @@ -217,12 +255,31 @@ void oexprcodebox_mouseup(t_oexprcodebox *x, t_object *patcherview, t_pt pt, lon oexprcodebox_bang(x); } +OMAX_DICT_DICTIONARY(t_oexprcodebox, x, oexprcodebox_fullPacket); + +void oexprcodebox_assist(t_oexprcodebox *x, void *b, long io, long num, char *buf) +{ + omax_doc_assist(io, num, buf); +} + +t_max_err oexprcodebox_notify(t_oexprcodebox *x, t_symbol *s, t_symbol *msg, void *sender, void *data) +{ + return MAX_ERR_NONE; + t_symbol *attrname; + + if(msg == gensym("attr_modified")){ + attrname = (t_symbol *)object_method((t_object *)data, gensym("getname")); + } + return MAX_ERR_NONE; +} +#endif + void oexprcodebox_gettext(t_oexprcodebox *x) { long size = 0; char *text = NULL; #ifdef OMAX_PD_VERSION - text = x->text; + text = x->textbox->text; #else t_object *textfield = jbox_get_textfield((t_object *)x); object_method(textfield, gensym("gettextptr"), &text, &size); @@ -332,10 +389,6 @@ void oexprcodebox_bang(t_oexprcodebox *x) #endif } -#ifndef OMAX_PD_VERSION -OMAX_DICT_DICTIONARY(t_oexprcodebox, x, oexprcodebox_fullPacket); -#endif - void oexprcodebox_doc_cat(t_oexprcodebox *x, t_symbol *msg, int argc, t_atom *argv) { if(argc == 0){ @@ -391,174 +444,317 @@ void oexprcodebox_doc(t_oexprcodebox *x) omax_doc_outletDoc(x->outlets[0]); } -#ifndef OMAX_PD_VERSION -void oexprcodebox_assist(t_oexprcodebox *x, void *b, long io, long num, char *buf) -{ - omax_doc_assist(io, num, buf); -} -#endif - void oexprcodebox_free(t_oexprcodebox *x) { if(x->expr){ osc_expr_free(x->expr); } + +#ifdef OMAX_PD_VERSION + free(x->border_tag); + opd_textbox_free(x->textbox); +#else jbox_free((t_jbox *)x); +#endif + critical_free(x->lock); } -#ifndef OMAX_PD_VERSION -t_max_err oexprcodebox_notify(t_oexprcodebox *x, t_symbol *s, t_symbol *msg, void *sender, void *data) -{ - return MAX_ERR_NONE; - t_symbol *attrname; +//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +//::::::::::::::::::::::: PD VERSION ::::::::::::::::::::::: +//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - if(msg == gensym("attr_modified")){ - attrname = (t_symbol *)object_method((t_object *)data, gensym("getname")); - } - return MAX_ERR_NONE; +#ifdef OMAX_PD_VERSION +static void oexprcodebox_getrect(t_gobj *z, t_glist *glist,int *xp1, int *yp1, int *xp2, int *yp2) +{ + t_oexprcodebox *x = (t_oexprcodebox *)z; + int x1, y1, x2, y2; + + x1 = text_xpix(&x->ob, glist); + y1 = text_ypix(&x->ob, glist); + x2 = x1 + x->textbox->width; + y2 = y1 + x->textbox->height; + *xp1 = x1; + *yp1 = y1; + *xp2 = x2; + *yp2 = y2; + + opd_textbox_motion(x->textbox); + + // post("%s %d %d %d %d", __func__, x1, y1, x2, y2); + } -#endif -#ifdef OMAX_PD_VERSION -void *oexprcodebox_new(t_symbol *msg, short argc, t_atom *argv) +void oexprcodebox_drawElements(t_object *ob, int firsttime) { - t_oexprcodebox *x; - if((x = (t_oexprcodebox *)object_alloc(oexprcodebox_class))){ - t_osc_expr *f = NULL; - char symbuf[argc][65536]; - if(argc){ - char buf[65536]; - memset(buf, '\0', sizeof(buf)); - char *ptr = buf; - int i; - for(i = 0; i < argc; i++){ - switch(atom_gettype(argv + i)){ - case A_LONG: - ptr += sprintf(ptr, "%ld ", atom_getlong(argv + i)); - break; - case A_FLOAT: - ptr += sprintf(ptr, "%f ", atom_getfloat(argv + i)); - break; - case A_SYM: - { - strcpy(symbuf[i], atom_getsymbol(argv + i)->s_name); - omax_util_hashBrackets2Curlies(symbuf[i]); - - char *s = symbuf[i]; - int len = strlen(s); // null byte - int j; - for(j = 0; j < len; j++) { -//<< check this for pd version - if(s[j] == '$'){ - if((j + 1) < len){ - if((s[j + 1] <= 47 || s[j + 1] >= 58)){ - object_error((t_object *)x, "address can't contain a $"); - return NULL; - } - ptr += sprintf(ptr, "/_%d_", s[j + 1] - 48); - j++; - } else { - object_error((t_object *)x, "address can't contain a $"); - return NULL; - } - } else { - *ptr++ = s[j]; - } - } - - *ptr++ = ' '; - } - break; - } - } + + t_oexprcodebox *x = (t_oexprcodebox *)ob; + t_opd_textbox *t = x->textbox; + + if(!opd_textbox_shouldDraw(t)) + return; + + oexprcodebox_gettext(x); + + int x1, y1, x2, y2; + oexprcodebox_getrect((t_gobj *)x, t->glist, &x1, &y1, &x2, &y2); + int cx1 = x1;// - 2; + int cy1 = y1;// - 2; + int cx2 = x2;// + 2; + int cy2 = y2;// + 2; + + t_glist *glist = t->glist; + t_canvas *canvas = glist_getcanvas(glist); + + // post("%x %s %d %d\n", x, __func__, firsttime, t->firsttime); + + if (glist_isvisible(glist) && canvas->gl_editor) + { + if (firsttime) + { + //post("%x %s FIRST VIS height %d y1 %d y2 %d \n", x, __func__, t->height, y1, y2); - if(1){//if(!haspound){ - OSC_PROFILE_TIMER_START(foo); - int ret = osc_expr_parser_parseExpr(buf, &f); - OSC_PROFILE_TIMER_STOP(foo); - OSC_PROFILE_TIMER_PRINTF(foo); - OSC_PROFILE_TIMER_SNPRINTF(foo, buff); -#ifdef __OSC_PROFILE__ - post("%s\n", buff); -#endif - if(!f || ret) { - object_error((t_object *)x, "error parsing %s\n", buf); -// return NULL; //<< avioding bogus object - x->expr = NULL; - } else { - x->expr = f; - } - } else { - x->expr = NULL; - } + //border + sys_vgui(".x%lx.c create rectangle %d %d %d %d -outline \"#0066CC\" -fill \"#0066CC\" -tags %s \n", canvas, x1, y1, x2, y2, x->border_tag); + + sys_vgui(".x%lx.c create rectangle %d %d %d %d -outline #0066CC -fill \"white\" -tags %sBorder -width 2 \n",canvas, cx1+1, cy1+4, cx2 - 1, cy2, x->border_tag); } - - int n = 0; - while(f){ - n++; - f = osc_expr_next(f); + else + { + //post("%x %s REDRAW height %d y1 %d y2 %d \n", x, __func__, t->height, y1, y2); + sys_vgui(".x%lx.c coords %s %d %d %d %d\n", canvas, x->border_tag, x1, y1, x2, y2); + sys_vgui(".x%lx.c coords %sBorder %d %d %d %d \n",canvas, x->border_tag, cx1+1, cy1+4, cx2 - 1, cy2 - 2); } -#if defined (OIF) - if(n == 0 || n > 1){ - object_error((t_object *)x, "invalid number of expressions: %d", n); - return NULL; + opd_textbox_drawElements(x->textbox, x1, y1, x2, y2, firsttime); + + //draw IO + t_object *ob = pd_checkobject(&x->ob.te_pd); + if (ob){ + glist_drawiofor(glist, ob, firsttime, t->iolets_tag, x1, y1, x2, y2); + canvas_fixlinesfor(glist, ob); } - x->outlets = osc_mem_alloc(2 * sizeof(void *)); - x->outlets[0] = outlet_new(&x->ob, gensym("FullPacket")); - x->outlets[1] = outlet_new(&x->ob, gensym("FullPacket")); -#elif defined (OUNLESS) || defined (OWHEN) - if(n == 0 || n > 1){ - object_error((t_object *)x, "invalid number of expressions: %d", n); - return NULL; + + if (firsttime) // raise cords over everything else + sys_vgui(".x%lx.c raise cord\n", canvas); + + } +} + + +static void oexprcodebox_vis(t_gobj *z, t_glist *glist, int vis) +{ + t_oexprcodebox *x = (t_oexprcodebox *)z; + opd_textbox_vis(x->textbox, glist, vis); +} + +static void oexprcodebox_displace(t_gobj *z, t_glist *glist,int dx, int dy) +{ + + t_oexprcodebox *x = (t_oexprcodebox *)z; + + if(!x->textbox->mouseDown) + { + x->ob.te_xpix += dx; + x->ob.te_ypix += dy; + + t_canvas *canvas = glist_getcanvas(glist); + + sys_vgui(".x%lx.c move %s %d %d\n", canvas, x->border_tag, dx, dy); + sys_vgui(".x%lx.c move %sBorder %d %d\n", canvas, x->border_tag, dx, dy); + + opd_textbox_displace(x->textbox, glist, dx, dy); + } + +} + +static void oexprcodebox_select(t_gobj *z, t_glist *glist, int state) +{ + //post("%s %d", __func__, state); + t_oexprcodebox *x = (t_oexprcodebox *)z; + t_canvas *canvas = glist_getcanvas(glist); + + opd_textbox_select(x->textbox, glist, state); + + if (glist_isvisible(glist) && gobj_shouldvis(&x->ob.te_g, glist)) + { + sys_vgui(".x%lx.c itemconfigure %sBorder -outline %s\n", canvas, x->border_tag, (state? "#006699" : "#0066CC")); + } +} + +static void oexprcodebox_activate(t_gobj *z, t_glist *glist, int state) +{ + //post("%s %d", __func__, state); + + t_oexprcodebox *x = (t_oexprcodebox *)z; + t_canvas *canvas = glist_getcanvas(glist); + + if(!state) + oexprcodebox_gettext(x); + + opd_textbox_activate(x->textbox, glist, state); + + // sys_vgui(".x%lx.c itemconfigure %s -outline %s\n", glist, x->border_tag, (state? "$select_color" : "$msg_box_fill"));//was "$box_outline" + sys_vgui(".x%lx.c itemconfigure %sBorder -outline %s\n", canvas, x->border_tag, (state? "#006699" : "#0066CC")); + +} + +static void oexprcodebox_delete(t_gobj *z, t_glist *glist) +{ + //post("%s", __func__); + t_oexprcodebox *x = (t_oexprcodebox *)z; + t_opd_textbox *t = x->textbox; + t_canvas *canvas = glist_getcanvas(glist); + + //post("%x %s %d", x, __func__, canvas->gl_editor); + + if(!t->firsttime && canvas->gl_editor) + { + // opd_textbox_nofocus_callback(t); + + sys_vgui(".x%lx.c delete %s\n", canvas, x->border_tag); + sys_vgui(".x%lx.c delete %sBorder\n", canvas, x->border_tag); + + opd_textbox_delete(t, glist); + + t_object *ob = pd_checkobject(&x->ob.te_pd); + if(ob && !t->firsttime && glist_isvisible(glist)) + { + glist_eraseiofor(glist, ob, t->iolets_tag); + canvas_deletelinesfor(canvas, ob); } - x->outlet = outlet_new(&x->ob, gensym("FullPacket")); -#elif defined (OCOND) - x->num_exprs = n; - // implicit 't' as the last condition - x->outlets = osc_mem_alloc((n + 1) * sizeof(void *)); - int i; - for(i = 0; i <= n; i++) { - x->outlets[i] = outlet_new(&x->ob, gensym("FullPacket"));; + } + +} + + +static int oexprcodebox_click(t_gobj *z, struct _glist *glist, + int xpix, int ypix, int shift, int alt, int dbl, int doit) +{ + /*t_oexprcodebox *x = (t_oexprcodebox *)z; + { + if(doit && x->textbox->resize_hit) + { + oexprcodebox_doClick(x, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, (t_floatarg)0, (t_floatarg)alt); } - /* - x->outlets_desc = (char **)osc_mem_alloc((x->num_exprs + 1) * sizeof(char *)); - for(i = 0; i < x->num_exprs; i++){ - x->outlets_desc[i] = (char *)osc_mem_alloc(128); - sprintf(x->outlets_desc[i], "Input OSC packet if expression %d returns true or non-zero", i+1); - } - x->outlets_desc[x->num_exprs] = (char *)osc_mem_alloc(128); - sprintf(x->outlets_desc[x->num_exprs], "Input OSC packet if all expressions return false or zero"); - */ -#else - x->outlet = outlet_new(&x->ob, gensym("FullPacket")); -#endif + return (1); + }*/ + return 1; +} + +static void oexprcodebox_save(t_gobj *z, t_binbuf *b) +{ + t_oexprcodebox *x = (t_oexprcodebox *)z; + t_opd_textbox *t = x->textbox; + //post("%x %s", x, __func__); + + opd_textbox_setHexFromText(t, t->text); + + binbuf_addv(b, "ssiisiis", gensym("#X"),gensym("obj"),(t_int)x->ob.te_xpix, (t_int)x->ob.te_ypix, gensym("o.expr.codebox"), t->width, t->height, gensym("binhex")); + + long chunksize = 32; + char buf[chunksize+3]; + long len = strlen(t->hex); + long chunks = len / chunksize; + long chad = len % chunksize; + long i,k; + for (k = 0; k < chunks; k++) { + memset(buf, '\0', chunksize+3 ); + buf[0] = 'b'; + buf[1] = '#'; + for (i = 0; i < chunksize; i++) { + buf[i+2] = t->hex[i + (k*chunksize) ]; } - return x; + binbuf_addv(b, "s", gensym(buf)); + } + memset(buf, '\0', chunksize+3 ); + buf[0] = 'b'; + buf[1] = '#'; + + for (i = 0; i < chad; i++) { + buf[i+2] = t->hex[i + (k*chunksize) ]; + } + binbuf_addv(b, "s", gensym(buf)); + + binbuf_addsemi(b); + } -#if defined (OIF) -int oif_setup(void) -#elif defined (OUNLESS) -int ounless_setup(void) -#elif defined (OWHEN) -int owhen_setup(void) -#elif defined (OCOND) -int ocond_setup(void) -#else -int oexprcodebox_setup(void) -#endif +void *oexprcodebox_new(t_symbol *msg, short argc, t_atom *argv) { - t_class *c = class_new(gensym(NAME), (t_newmethod)oexprcodebox_new, (t_method)oexprcodebox_free, sizeof(t_oexprcodebox), 0L, A_GIMME, 0); + t_oexprcodebox *x; + if((x = (t_oexprcodebox *)object_alloc(oexprcodebox_class))) + { + t_opd_textbox *t = opd_textbox_new(oexprcodebox_textbox_class); + + t->glist = (t_glist *)canvas_getcurrent(); + //post("%s %x: glist %x", __func__, x, t->glist); + t->in_new_flag = 1; + t->firsttime = 1; + t->parent = (t_object *)x; + + t->draw_fn = (t_gotfn)oexprcodebox_drawElements; + t->gettext_fn = (t_gotfn)oexprcodebox_gettext; + t->click_fn = NULL; + t->delete_fn = (t_gotfn)oexprcodebox_delete; + + t->mouseDown = 0; + t->selected = 0; + t->editmode = glist_getcanvas(t->glist)->gl_edit; + t->textediting = 0; + + t->resizebox_x_offset = 7; + t->resizebox_y_offset = 5; + t->resizebox_height = 10; + t->resizebox_width = 10; + + + x->textbox = t; + + critical_new(&(x->lock)); + //t_osc_expr *f = NULL; + x->outlets[0] = outlet_new(&x->ob, gensym("FullPacket")); + x->outlets[1] = outlet_new(&x->ob, gensym("FullPacket")); + + x->border_tag = NULL; + + //object name heirarchy: + char buf[MAXPDSTRING]; + + sprintf(buf, "%lxBORDER", (long unsigned int)x); + x->border_tag = (char *)malloc(sizeof(char) * (strlen(buf)+1)); + if(x->border_tag == NULL) + { + printf("out of memory %d\n", __LINE__); + return NULL; + } + strcpy(x->border_tag, buf); + + opd_textbox_atoms(t, argc, argv); + + oexprcodebox_gettext(x); + + t->in_new_flag = 0; + t->softlock = 0; + + t->height = 23; + + + } + return x; +} +int setup_o0x2eexpr0x2ecodebox(void) +{ + t_class *c = class_new(gensym("o.expr.codebox"), (t_newmethod)oexprcodebox_new, (t_method)oexprcodebox_free, sizeof(t_oexprcodebox), 0L, A_GIMME, 0); + class_addmethod(c, (t_method)oexprcodebox_fullPacket, gensym("FullPacket"), A_GIMME, 0); // class_addmethod(c, (t_method)oexprcodebox_assist, gensym("assist"), A_CANT, 0); class_addmethod(c, (t_method)oexprcodebox_bang, gensym("bang"), 0); - class_addmethod(c, (t_method)oexprcodebox_postExprIR, gensym("post-expr-ir"), 0); + class_addmethod(c, (t_method)oexprcodebox_postExprAST, gensym("post-ast"), 0); class_addmethod(c, (t_method)oexprcodebox_doc, gensym("doc"), 0); class_addmethod(c, (t_method)oexprcodebox_doc_func, gensym("doc-func"), A_GIMME, 0); @@ -573,6 +769,19 @@ int oexprcodebox_setup(void) // common_symbols_init(); // osc_error_setHandler(omax_util_liboErrorHandler); + oexprcodebox_widgetbehavior.w_getrectfn = oexprcodebox_getrect; + oexprcodebox_widgetbehavior.w_displacefn = oexprcodebox_displace; + oexprcodebox_widgetbehavior.w_selectfn = oexprcodebox_select; + oexprcodebox_widgetbehavior.w_deletefn = oexprcodebox_delete; + oexprcodebox_widgetbehavior.w_clickfn = oexprcodebox_click; + oexprcodebox_widgetbehavior.w_activatefn = oexprcodebox_activate; + oexprcodebox_widgetbehavior.w_visfn = oexprcodebox_vis; + class_setsavefn(oexprcodebox_class, oexprcodebox_save); + class_setwidget(oexprcodebox_class, &oexprcodebox_widgetbehavior); + + oexprcodebox_textbox_class = opd_textbox_classnew(); + + ODOT_PRINT_VERSION; return 0; diff --git a/src/odot.xcodeproj/project.pbxproj b/src/odot.xcodeproj/project.pbxproj index 3b618667..568dc9ac 100755 --- a/src/odot.xcodeproj/project.pbxproj +++ b/src/odot.xcodeproj/project.pbxproj @@ -240,6 +240,7 @@ /* Begin PBXBuildFile section */ 110A81E4194C4938002358E3 /* o.downcast.c in Sources */ = {isa = PBXBuildFile; fileRef = 52B53CEC17480CFC00237A19 /* o.downcast.c */; }; 112AC8611939427D003244E9 /* o.menu.c in Sources */ = {isa = PBXBuildFile; fileRef = 112AC8601939427D003244E9 /* o.menu.c */; }; + 115D740D198FD26B00F42B88 /* o.expr.codebox.c in Sources */ = {isa = PBXBuildFile; fileRef = 5223ADDB1923EB9000C8FBB5 /* o.expr.codebox.c */; }; 11893E5E1986F462008303DD /* o.compose.c in Sources */ = {isa = PBXBuildFile; fileRef = 9B3930F4195A296C002EDAE5 /* o.compose.c */; }; 11893E6219883506008303DD /* opd_textbox.h in Headers */ = {isa = PBXBuildFile; fileRef = 11893E6119881E34008303DD /* opd_textbox.h */; }; 118D280019394C9500739CB3 /* pqops.c in Sources */ = {isa = PBXBuildFile; fileRef = 52A8396C16F3F893002E273C /* pqops.c */; }; @@ -537,6 +538,13 @@ remoteGlobalIDString = 11F7B52B194C48EF0090045B; remoteInfo = o.downcast.pd; }; + 115D7404198FD23F00F42B88 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 089C1669FE841209C02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 5224C9FB1958BFDF00E37AED; + remoteInfo = "Current Version"; + }; 11893E551986F436008303DD /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 089C1669FE841209C02AAC07 /* Project object */; @@ -2167,6 +2175,7 @@ 08EA7FFBFE8413EDC02AAC07 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = ""; }; 112AC85F19394255003244E9 /* o.menu.pd_darwin */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = o.menu.pd_darwin; sourceTree = BUILT_PRODUCTS_DIR; }; 112AC8601939427D003244E9 /* o.menu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = o.menu.c; path = omenu/o.menu.c; sourceTree = ""; }; + 115D740C198FD23F00F42B88 /* o.expr.codebox.pd.pd_darwin */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = o.expr.codebox.pd.pd_darwin; sourceTree = BUILT_PRODUCTS_DIR; }; 11893E5D1986F436008303DD /* o.compose.pd_darwin */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = o.compose.pd_darwin; sourceTree = BUILT_PRODUCTS_DIR; }; 11893E6119881E34008303DD /* opd_textbox.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = opd_textbox.h; path = o.compose/opd_textbox.h; sourceTree = ""; }; 119FA031191D5814001C3325 /* o.append.pd_darwin */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = o.append.pd_darwin; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -2317,6 +2326,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 115D7407198FD23F00F42B88 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 11893E581986F436008303DD /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -3158,6 +3174,7 @@ 9B3930D3195A286D002EDAE5 /* o.compose.mxo */, 9B3930E3195A2898002EDAE5 /* o.display.mxo */, 11893E5D1986F436008303DD /* o.compose.pd_darwin */, + 115D740C198FD23F00F42B88 /* o.expr.codebox.pd.pd_darwin */, ); name = Products; sourceTree = ""; @@ -3185,6 +3202,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 115D7408198FD23F00F42B88 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 11893E591986F436008303DD /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -3772,6 +3796,24 @@ productReference = 112AC85F19394255003244E9 /* o.menu.pd_darwin */; productType = "com.apple.product-type.library.dynamic"; }; + 115D7402198FD23F00F42B88 /* o.expr.codebox.pd */ = { + isa = PBXNativeTarget; + buildConfigurationList = 115D7409198FD23F00F42B88 /* Build configuration list for PBXNativeTarget "o.expr.codebox.pd" */; + buildPhases = ( + 115D7405198FD23F00F42B88 /* Sources */, + 115D7407198FD23F00F42B88 /* Frameworks */, + 115D7408198FD23F00F42B88 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + 115D7403198FD23F00F42B88 /* PBXTargetDependency */, + ); + name = o.expr.codebox.pd; + productName = o.print.pd; + productReference = 115D740C198FD23F00F42B88 /* o.expr.codebox.pd.pd_darwin */; + productType = "com.apple.product-type.library.dynamic"; + }; 11893E531986F436008303DD /* o.compose.pd */ = { isa = PBXNativeTarget; buildConfigurationList = 11893E5A1986F436008303DD /* Build configuration list for PBXNativeTarget "o.compose.pd" */; @@ -5277,6 +5319,7 @@ 5255240D1504D14600A10E5D /* o.expr */, 119FA074191D5D3A001C3325 /* o.expr.pd */, 5223ADCD1923EB5700C8FBB5 /* o.expr.codebox */, + 115D7402198FD23F00F42B88 /* o.expr.codebox.pd */, 529781521555B6FD0018A44D /* o.flatten */, 119FA07E191D5D43001C3325 /* o.flatten.pd */, 5255241C1504D14B00A10E5D /* o.if */, @@ -5654,6 +5697,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 115D7405198FD23F00F42B88 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 115D740D198FD26B00F42B88 /* o.expr.codebox.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 11893E561986F436008303DD /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -6350,6 +6401,11 @@ target = 11F7B52B194C48EF0090045B /* o.downcast.pd */; targetProxy = 112643F6194E3BA500726422 /* PBXContainerItemProxy */; }; + 115D7403198FD23F00F42B88 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 5224C9FB1958BFDF00E37AED /* Current Version */; + targetProxy = 115D7404198FD23F00F42B88 /* PBXContainerItemProxy */; + }; 11893E541986F436008303DD /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 5224C9FB1958BFDF00E37AED /* Current Version */; @@ -7634,6 +7690,128 @@ }; name = Release; }; + 115D740A198FD23F00F42B88 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CONFIGURATION_BUILD_DIR = "$(SYMROOT)"; + EXECUTABLE_EXTENSION = pd_darwin; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREFIX_HEADER = ""; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + GENERATE_PKGINFO_FILE = NO; + HEADER_SEARCH_PATHS = ( + "$(HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + "$(HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_2)", + "$(HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_3)", + "$(HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_4)", + ); + HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../libo\""; + HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_2 = "\"$(SRCROOT)/../../libomax\""; + HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_3 = "\"$(SRCROOT)/../../pd-src/src\""; + HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_4 = "\"$(SRCROOT)/include\""; + INFOPLIST_FILE = ""; + LIBRARY_SEARCH_PATHS = ( + "$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_2)", + ); + LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../libo\""; + LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_2 = "\"$(SRCROOT)/../../libomax\""; + MACOSX_DEPLOYMENT_TARGET = 10.8; + ONLY_ACTIVE_ARCH = YES; + OTHER_CFLAGS = ( + "-DOMAX_PD_VERSION", + "-DNO_TRANSLATION_SUPPORT", + ); + OTHER_LDFLAGS = ( + "-undefined", + dynamic_lookup, + ); + PRELINK_LIBS = "\"$(SRCROOT)/../../libo/libo.a\" \"$(SRCROOT)/../../libomax/libopd.a\""; + PRODUCT_NAME = o.expr.codebox; + WRAPPER_EXTENSION = ""; + }; + name = Debug; + }; + 115D740B198FD23F00F42B88 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 52CA34441976FF7A008C36B9 /* PD-deprecated.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CONFIGURATION_BUILD_DIR = "$(SYMROOT)"; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = dwarf; + EXECUTABLE_EXTENSION = pd_darwin; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_PREFIX_HEADER = ""; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + GENERATE_PKGINFO_FILE = NO; + HEADER_SEARCH_PATHS = ( + "$(HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + "$(HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_2)", + "$(HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_3)", + "$(HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_4)", + ); + HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../libo\""; + HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_2 = "\"$(SRCROOT)/../../libomax\""; + HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_3 = "\"$(SRCROOT)/../../pd-src/src\""; + HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_4 = "\"$(SRCROOT)/include\""; + INFOPLIST_FILE = ""; + LIBRARY_SEARCH_PATHS = ( + "$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_2)", + ); + LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../libo\""; + LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_2 = "\"$(SRCROOT)/../../libomax\""; + MACOSX_DEPLOYMENT_TARGET = 10.8; + OTHER_CFLAGS = ( + "-DOMAX_PD_VERSION", + "-DNO_TRANSLATION_SUPPORT", + ); + OTHER_LDFLAGS = ( + "-undefined", + dynamic_lookup, + ); + PRELINK_LIBS = "\"$(SRCROOT)/../../libo/libo.a\" \"$(SRCROOT)/../../libomax/libopd.a\""; + PRODUCT_NAME = o.expr.codebox; + SYMROOT = "$(inherited)"; + WRAPPER_EXTENSION = ""; + }; + name = Release; + }; 11893E5B1986F436008303DD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -16796,6 +16974,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 115D7409198FD23F00F42B88 /* Build configuration list for PBXNativeTarget "o.expr.codebox.pd" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 115D740A198FD23F00F42B88 /* Debug */, + 115D740B198FD23F00F42B88 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 11893E5A1986F436008303DD /* Build configuration list for PBXNativeTarget "o.compose.pd" */ = { isa = XCConfigurationList; buildConfigurations = ( From 7e60f176b5b437561a8ba06e8f219d59f5272a8f Mon Sep 17 00:00:00 2001 From: "rama.gottfried" Date: Mon, 11 Aug 2014 19:20:06 -0400 Subject: [PATCH 2/2] tidying up pd-textbox, added margins, fixed a couple mouse binding issues with deselection and displacement --- src/o.compose/o.compose.c | 34 ++++--- src/o.compose/opd_textbox.h | 137 ++++++++++++++++++---------- src/o.expr.codebox/o.expr.codebox.c | 39 +++++--- src/odot.xcodeproj/project.pbxproj | 21 ++++- 4 files changed, 149 insertions(+), 82 deletions(-) diff --git a/src/o.compose/o.compose.c b/src/o.compose/o.compose.c index 8da9675a..406e0269 100644 --- a/src/o.compose/o.compose.c +++ b/src/o.compose/o.compose.c @@ -792,10 +792,8 @@ void ocompose_drawElements(t_object *ob, int firsttime) int x1, y1, x2, y2; ocompose_getrect((t_gobj *)x, t->glist, &x1, &y1, &x2, &y2); - int cx1 = x1;// - 2; - int cy1 = y1;// - 2; - int cx2 = x2;// + 2; - int cy2 = y2;// + 2; + int cx2 = x2 - t->margin_r; + int cy2 = y2 - 10; //<< folds into right margin t_glist *glist = t->glist; t_canvas *canvas = glist_getcanvas(glist); @@ -809,30 +807,28 @@ void ocompose_drawElements(t_object *ob, int firsttime) if (firsttime) { - //post("%x %s FIRST VIS height %d y1 %d y2 %d \n", x, __func__, t->height, y1, y2); + // post("%x %s FIRST VIS height %d y1 %d y2 %d \n", x, __func__, t->height, y1, y2); //border - sys_vgui(".x%lx.c create rectangle %d %d %d %d -outline \"\" -fill \"\" -tags [list %s msg]\n",canvas, x1, y1, x2, y2, x->border_tag); - sys_vgui(".x%lx.c create polygon %d %d %d %d %d %d %d %d %d %d %d %d -outline #0066CC -fill \"\" -tags %sBorder -width 2 \n",canvas, cx1, cy1, cx2, cy1, cx2, cy2-10, cx2-10, cy2-10, cx2-10, cy2, cx1, cy2, x->border_tag); + sys_vgui(".x%lx.c create polygon %d %d %d %d %d %d %d %d %d %d %d %d -outline #0066CC -fill \"white\" -tags %s -width 2 \n",canvas, x1, y1, x2, y1, x2, cy2, cx2, cy2, cx2, cy2, x1, cy2, x->border_tag); - sys_vgui(".x%lx.c create polygon %d %d %d %d %d %d -outline #0066CC -fill \"white\" -tags %s \n",canvas, cx2-10, cy2-10, cx2-10, cy2, cx2, cy2-10, x->corner_tag); + sys_vgui(".x%lx.c create polygon %d %d %d %d %d %d -outline #0066CC -fill \"white\" -tags %s \n",canvas, cx2, cy2, cx2, y2, x2, cy2, x->corner_tag); } else { - //post("%x %s REDRAW height %d y1 %d y2 %d \n", x, __func__, t->height, y1, y2); + // post("%x %s REDRAW height %d y1 %d y2 %d \n", x, __func__, t->height, y1, y2); - sys_vgui(".x%lx.c coords %s %d %d %d %d\n", canvas, x->border_tag, x1, y1, x2, y2); - sys_vgui(".x%lx.c coords %sBorder %d %d %d %d %d %d %d %d %d %d %d %d \n",canvas, x->border_tag, cx1, cy1, cx2, cy1, cx2, cy2-10, cx2-10, cy2-10, cx2-10, cy2, cx1, cy2); - sys_vgui(".x%lx.c coords %s %d %d %d %d %d %d \n",canvas, x->corner_tag, cx2-10, cy2-10, cx2-10, cy2, cx2, cy2-10); + sys_vgui(".x%lx.c coords %s %d %d %d %d %d %d %d %d %d %d %d %d \n",canvas, x->border_tag, x1, y1, x2, y1, x2, cy2, cx2, cy2, cx2, y2, x1, y2); + sys_vgui(".x%lx.c coords %s %d %d %d %d %d %d \n",canvas, x->corner_tag, cx2, cy2, cx2, y2, x2, cy2); } opd_textbox_drawElements(x->textbox, x1, y1, x2, y2, firsttime); - //sys_vgui(".x%lx.c itemconfigure %sBorder -outline %s\n", canvas, x->border_tag, (x->parse_error? "red" : "#0066CC" )); + //sys_vgui(".x%lx.c itemconfigure %s -outline %s\n", canvas, x->border_tag, (x->parse_error? "red" : "#0066CC" )); //sys_vgui(".x%lx.c itemconfigure %s -outline %s\n", canvas, x->corner_tag, (x->parse_error? "red" : "blue" )); sys_vgui(".x%lx.c itemconfigure %s -fill %s \n", canvas, x->corner_tag, (x->draw_new_data_indicator? "#0066CC" : "white")); @@ -874,7 +870,6 @@ static void ocompose_displace(t_gobj *z, t_glist *glist,int dx, int dy) t_canvas *canvas = glist_getcanvas(glist); sys_vgui(".x%lx.c move %s %d %d\n", canvas, x->border_tag, dx, dy); - sys_vgui(".x%lx.c move %sBorder %d %d\n", canvas, x->border_tag, dx, dy); sys_vgui(".x%lx.c move %s %d %d\n", canvas, x->corner_tag, dx, dy); opd_textbox_displace(x->textbox, glist, dx, dy); @@ -891,7 +886,7 @@ static void ocompose_select(t_gobj *z, t_glist *glist, int state) if (glist_isvisible(glist) && gobj_shouldvis(&x->ob.te_g, glist)){ - sys_vgui(".x%lx.c itemconfigure %sBorder -outline %s\n", canvas, x->border_tag, (state? "#006699" : "#0066CC")); + sys_vgui(".x%lx.c itemconfigure %s -outline %s\n", canvas, x->border_tag, (state? "#006699" : "#0066CC")); sys_vgui(".x%lx.c itemconfigure %s -outline %s\n", canvas, x->corner_tag, (state? "#006699" : "#0066CC")); sys_vgui(".x%lx.c itemconfigure %s -fill %s\n", canvas, x->corner_tag, (x->draw_new_data_indicator? (state? "#006699" : "#0066CC") : "white")); @@ -910,8 +905,7 @@ static void ocompose_activate(t_gobj *z, t_glist *glist, int state) opd_textbox_activate(x->textbox, glist, state); - // sys_vgui(".x%lx.c itemconfigure %s -outline %s\n", glist, x->border_tag, (state? "$select_color" : "$msg_box_fill"));//was "$box_outline" - sys_vgui(".x%lx.c itemconfigure %sBorder -outline %s\n", canvas, x->border_tag, (state? "#006699" : "#0066CC")); + sys_vgui(".x%lx.c itemconfigure %s -outline %s\n", canvas, x->border_tag, (state? "#006699" : "#0066CC")); sys_vgui(".x%lx.c itemconfigure %s -outline %s\n", canvas, x->corner_tag, (state? "#006699" : "#0066CC")); sys_vgui(".x%lx.c itemconfigure %s -fill %s\n", canvas, x->corner_tag, (x->draw_new_data_indicator? (state? "#006699" : "#0066CC") : "white")); @@ -932,7 +926,6 @@ static void ocompose_delete(t_gobj *z, t_glist *glist) // opd_textbox_nofocus_callback(t); sys_vgui(".x%lx.c delete %s\n", canvas, x->border_tag); - sys_vgui(".x%lx.c delete %sBorder\n", canvas, x->border_tag); sys_vgui(".x%lx.c delete %s\n", canvas, x->corner_tag); opd_textbox_delete(t, glist); @@ -1068,6 +1061,11 @@ void *ocompose_new(t_symbol *msg, short argc, t_atom *argv) t->editmode = glist_getcanvas(t->glist)->gl_edit; t->textediting = 0; + t->margin_t = 1; + t->margin_l = 1; + t->margin_b = 1; + t->margin_r = 10; + t->resizebox_x_offset = 2; t->resizebox_y_offset = 2; t->resizebox_height = 10; diff --git a/src/o.compose/opd_textbox.h b/src/o.compose/opd_textbox.h index f6437081..57160f1a 100644 --- a/src/o.compose/opd_textbox.h +++ b/src/o.compose/opd_textbox.h @@ -50,7 +50,10 @@ typedef struct _opd_textbox int resizebox_width; int resizebox_x_offset; int resizebox_y_offset; - uint16_t resize_hit; + + int margin_t, margin_b, margin_l, margin_r; + + uint16_t _hit; t_gotfn draw_fn; t_gotfn gettext_fn; @@ -83,14 +86,14 @@ void opd_textbox_unbindCanvasEvents(t_opd_textbox *x) if(x->c_bind) { t_canvas *canvas = glist_getcanvas(x->glist); - // sys_vgui("::opd_textbox::unbind .x%lx.c {::opd_textbox::sendto %s resize_mousemove %%x %%y} \n", canvas, x->receive_name); + // sys_vgui("::opd_textbox::unbind .x%lx.c {::opd_textbox::sendto %s mousemove %%x %%y} \n", canvas, x->receive_name); #ifdef OPD_TEXTBOX_DEBUG post("%x %s ...", x, __func__); #endif - sys_vgui("::opd_textbox::unbind .x%lx {::opd_textbox::sendto %s resize_mousedown %%x %%y} \n", canvas, x->receive_name); - sys_vgui("::opd_textbox::unbind .x%lx {::opd_textbox::sendto %s resize_mouseup} \n", canvas, x->receive_name); + sys_vgui("::opd_textbox::unbind .x%lx {::opd_textbox::sendto %s mousedown %%x %%y} \n", canvas, x->receive_name); + sys_vgui("::opd_textbox::unbind .x%lx {::opd_textbox::sendto %s mouseup} \n", canvas, x->receive_name); //sys_vgui("focus .x%lx\n", canvas, (long)x); @@ -113,9 +116,9 @@ void opd_textbox_bindCanvasEvents(t_opd_textbox *x) #endif t_canvas *canvas = glist_getcanvas(x->glist); - sys_vgui("bind .x%lx {+::opd_textbox::sendto %s resize_mousedown %%x %%y} \n", canvas, x->receive_name); - sys_vgui("bind .x%lx {+::opd_textbox::sendto %s resize_mouseup} \n", canvas, x->receive_name); - // sys_vgui("bind .x%lx.c {+::opd_textbox::sendto %s resize_mousemove %%x %%y} \n", canvas, x->receive_name); + sys_vgui("bind .x%lx {+::opd_textbox::sendto %s mousedown %%x %%y} \n", canvas, x->receive_name); + sys_vgui("bind .x%lx {+::opd_textbox::sendto %s mouseup} \n", canvas, x->receive_name); + // sys_vgui("bind .x%lx.c {+::opd_textbox::sendto %s mousemove %%x %%y} \n", canvas, x->receive_name); // sys_vgui("::pdwindow::post \"check [bind .x%lx.c ] \n\" \n", canvas); x->c_bind = 1; @@ -136,10 +139,11 @@ void opd_textbox_drawParent(t_opd_textbox *t, int firstime) void opd_textbox_setHeight(t_opd_textbox *t, float y) { - int h = ((int)y - text_ypix(t->parent, t->glist) + 5); + int h = ((int)y - text_ypix(t->parent, t->glist)) + t->margin_t; h = (h > 23) ? h : 23; - //post("%x %s y %f te_ypix %d h %d", t, __func__, y, text_ypix(t->parent, t->glist), h); +// post("y %d ypix %d t->margin_b %d t->margin_t %d", (int)y, text_ypix(t->parent, t->glist), t->margin_b, t->margin_t); +// post("%x %s h %d", t, __func__, h); t->softlock = 0; if((h != t->height) || t->forceredraw) @@ -173,7 +177,7 @@ void opd_textbox_getRectAndDraw(t_opd_textbox *t, int forceredraw) } -void opd_textbox_resize_mousedown(t_opd_textbox *t) +void opd_textbox_mousedown(t_opd_textbox *t) { #ifdef OPD_TEXTBOX_DEBUG post("%x %s", t, __func__); @@ -186,13 +190,11 @@ void opd_textbox_resize_mousedown(t_opd_textbox *t) { if(!t->selected) gobj_select(&t->parent->te_g, t->glist, 1); -// gobj_select((t_gobj *)t->parent, t->glist, 1); - t->mouseDown = 1; t->xref = mx; t->wref = t->width; - sys_vgui("bind .x%lx.c {+::opd_textbox::sendto %s resize_mousemove %%x %%y} \n", glist_getcanvas(t->glist), t->receive_name); + sys_vgui("bind .x%lx.c {+::opd_textbox::sendto %s mousemove %%x %%y} \n", glist_getcanvas(t->glist), t->receive_name); } else if ((t->textediting || t->selected) && (mx < x1 || mx > x2 || my < y1 || my > y2)) { @@ -200,10 +202,10 @@ void opd_textbox_resize_mousedown(t_opd_textbox *t) } } -void opd_textbox_resize_mousemove(t_opd_textbox *t, float x, float y) +void opd_textbox_mousemove(t_opd_textbox *t, float x, float y) { #ifdef OPD_TEXTBOX_DEBUG - post("%x %s", t, __func__); + // post("%x %s", t, __func__); #endif if(t->mouseDown && glist_getcanvas(t->glist)->gl_edit) @@ -221,19 +223,18 @@ void opd_textbox_resize_mousemove(t_opd_textbox *t, float x, float y) ;//post("mdown %d edit %d", t->mouseDown, glist_getcanvas(t->glist)->gl_edit); } -void opd_textbox_resize_mouseup(t_opd_textbox *t) +void opd_textbox_mouseup(t_opd_textbox *t) { #ifdef OPD_TEXTBOX_DEBUG post("%x %s", t, __func__); #endif - if(t->mouseDown) { + t->mouseDown = 0; gobj_select(&t->parent->te_g, t->glist, 0); -// gobj_select((t_gobj *)t->parent, t->glist, 0); - sys_vgui("::opd_textbox::unbind .x%lx.c {::opd_textbox::sendto %s resize_mousemove %%x %%y} \n", glist_getcanvas(t->glist), t->receive_name); +// gobj_select((t_gobj *)t->parent, t->glist, 0); //<< same as ->te_g + sys_vgui("::opd_textbox::unbind .x%lx.c {::opd_textbox::sendto %s mousemove %%x %%y} \n", glist_getcanvas(t->glist), t->receive_name); - t->mouseDown = 0; opd_textbox_drawParent(t, 0); } @@ -262,7 +263,7 @@ int opd_textbox_resizeHitTest(t_opd_textbox *x, int mx, int my) test = (mx > rx1 && mx < rx2 && my > ry1 && my < ry2); - if(test != x->resize_hit) + if(test != x->_hit) { if(c->gl_edit) { @@ -275,7 +276,7 @@ int opd_textbox_resizeHitTest(t_opd_textbox *x, int mx, int my) sys_vgui(".x%lx configure -cursor %s\n", c, cursormode); } - x->resize_hit = test; + x->_hit = test; } } return test; @@ -292,7 +293,7 @@ int opd_textbox_motion(t_opd_textbox *x) int mx,my; glist_getnextxy(c, &mx, &my); //<< mouse position test = opd_textbox_resizeHitTest(x, mx, my); - opd_textbox_resize_mousemove(x, (float)mx, (float)my); + opd_textbox_mousemove(x, (float)mx, (float)my); } else ;//post("gl_edit %d isvis %d istop %d", c->gl_edit, glist_isvisible(c), glist_istoplevel(c)); @@ -307,7 +308,8 @@ void opd_textbox_bind_text_events(t_opd_textbox *t) sys_vgui("bind .x%lx.t%lxTEXT {+pdsend {%s keyup %%N }}\n", canvas, (long)t, t->receive_name); //focusout for clicking to other windows other than the main canvas - //sys_vgui("bind .x%lx.t%lxTEXT {+pdsend {%s nofocus }}\n", canvas, (long)t, t->receive_name); + sys_vgui("bind .x%lx.t%lxTEXT {+pdsend {%s nofocus }}\n", canvas, (long)t, t->receive_name); + sys_vgui("bind .x%lx.t%lxTEXT <1> {+pdsend {%s mousedown }}\n", canvas, (long)t, t->receive_name); } @@ -321,9 +323,11 @@ void opd_textbox_getTextAndCreateEditor(t_opd_textbox *t, int firsttime) if(firsttime) { t->new_texteditor = 1; - - int x1 = text_xpix(t->parent, t->glist); - int y1 = text_ypix(t->parent, t->glist); + int pix_buffer = 2; + int x1 = text_xpix(t->parent, t->glist) + t->margin_l - pix_buffer - 1; + int y1 = text_ypix(t->parent, t->glist) + t->margin_t - pix_buffer - 1; + int width = t->width - t->margin_l - t->margin_r - pix_buffer - 6; + int height = t->height - t->margin_t - t->margin_b - pix_buffer - 6; // post("%x %s %d x1 %d y1 %d x2 %d y2 %d", t, __func__, firsttime, x1, y1, x1+t->width, y1+t->height); t_canvas *canvas = glist_getcanvas(t->glist); @@ -331,15 +335,17 @@ void opd_textbox_getTextAndCreateEditor(t_opd_textbox *t, int firsttime) // gobj_select(&t->parent->te_g, t->glist, 0); // << deselect to disable PD key motions etc. glist_noselect(t->glist); sys_vgui(".x%lx.c itemconfigure text%lx -fill white \n", canvas, (long)t); + sys_vgui("text .x%lx.t%lxTEXT -font {{%s} %d %s} -undo true -fg \"black\" -bg \"white\" -takefocus 1 -state normal -highlightthickness 0 -wrap word -spacing3 0 \n", canvas, (long)t, sys_font, glist_getfont(t->glist), sys_fontweight ); //-tabs {%d left} , glist_getfont(t->glist) * ? - sys_vgui("place .x%lx.t%lxTEXT -x [expr %d - [.x%lx.c canvasx 0]] -y [expr %d - [.x%lx.c canvasy 0]] -width %d -height %d\n", canvas, (long)t, x1+4, canvas, y1+4, canvas, t->width-15, t->height-6); + sys_vgui("place .x%lx.t%lxTEXT -x [expr %d - [.x%lx.c canvasx 0]] -y [expr %d - [.x%lx.c canvasy 0]] -width %d -height %d\n", canvas, (long)t, x1, canvas, y1, canvas, width, height); if(t->text) sys_vgui(".x%lx.t%lxTEXT insert 1.0 [subst -nobackslash -nocommands -novariables {%s} ] \n", canvas, (long)t, t->text); - sys_vgui("event generate .x%lx.t%lxTEXT <1> -x %d -y %d \n", canvas, (long)t, x1 + 10, y1 + 5); - sys_vgui("event generate .x%lx.t%lxTEXT -x %d -y %d \n", canvas, (long)t, x1 + 10, y1 + 5); + + sys_vgui("event generate .x%lx.t%lxTEXT <1> -x %d -y %d \n", canvas, (long)t, x1 + 5, y1 + 5); + sys_vgui("event generate .x%lx.t%lxTEXT -x %d -y %d \n", canvas, (long)t, x1 + 5, y1 + 5); sys_vgui(".x%lx.t%lxTEXT tag add sel 0.0 end\n", canvas, (long)t); opd_textbox_bind_text_events(t); @@ -370,7 +376,7 @@ void opd_textbox_storeTextAndExitEditorTick(t_opd_textbox *t) t->textediting = 0; // opd_textbox_nofocus_callback(t); - sys_vgui(".x%lx.c itemconfigure text%lx -fill black -width %d -text [subst -nobackslash -nocommands -novariables [string trimright {%s} ]] \n", canvas, (long)t, t->width-15, t->text); + sys_vgui(".x%lx.c itemconfigure text%lx -fill black -width %d -text [subst -nobackslash -nocommands -novariables [string trimright {%s} ]] \n", canvas, (long)t, t->width - t->margin_l - t->margin_r, t->text); sys_vgui("destroy .x%lx.t%lxTEXT\n", canvas, (long)t); gobj_select(&t->parent->te_g, t->glist, 0); @@ -443,6 +449,7 @@ void opd_textbox_outsideclick_callback(t_opd_textbox *t) sys_vgui("focus .x%lx.c\n", canvas); gobj_select(&t->parent->te_g, t->glist, 0); //<< opd_textbox_storeTextAndExitEditor(x); called from select function */ + t->mouseDown = 0; opd_textbox_nofocus_callback(t); //same for @@ -526,7 +533,7 @@ void opd_textbox_key_callback(t_opd_textbox *t, t_symbol *s, int argc, t_atom *a } } } else { - sys_vgui(".x%lx.c itemconfigure text%lx -width %d -text [subst -nobackslash -nocommands -novariables [.x%lx.t%lxTEXT get 0.0 end-1c] ] \n", glist_getcanvas(t->glist), (long)t, t->width-15, glist_getcanvas(t->glist), (long)t); + sys_vgui(".x%lx.c itemconfigure text%lx -width %d -text [subst -nobackslash -nocommands -novariables [.x%lx.t%lxTEXT get 0.0 end-1c] ] \n", glist_getcanvas(t->glist), (long)t, t->width - t->margin_l - t->margin_r, glist_getcanvas(t->glist), (long)t); opd_textbox_getRectAndDraw(t, 0); } @@ -713,7 +720,7 @@ void opd_textbox_resetText(t_opd_textbox *t, char *s) else if(glist_isvisible(t->glist)) { //post("%s %d", __func__, glist_isvisible(t->glist)); - sys_vgui(".x%lx.c itemconfigure text%lx -width %d -text [subst -nobackslash -nocommands -novariables [string trimright {%s} ]] \n", glist_getcanvas(t->glist), (long)t, t->width-15, t->text); + sys_vgui(".x%lx.c itemconfigure text%lx -width %d -text [subst -nobackslash -nocommands -novariables [string trimright {%s} ]] \n", glist_getcanvas(t->glist), (long)t, t->width - t->margin_l - t->margin_r , t->text); opd_textbox_getRectAndDraw(t, 1); } @@ -733,6 +740,13 @@ int opd_textbox_drawElements(t_opd_textbox *x, int x1, int y1, int x2, int y2, i // post("%x %s isvisible %d isgraph %d gl_editor %d", x, __func__, glist_isvisible(glist), glist_isgraph(glist), canvas->gl_editor); + int pix_buffer = 2; + + int tx1 = x1 + x->margin_l + pix_buffer; + int ty1 = y1 + x->margin_t + pix_buffer; + int tw = x->width - x->margin_l - x->margin_r - pix_buffer; + int th = x->height - x->margin_b - x->margin_t - pix_buffer; //height maybe needs to be added to text height... + int rw = x->resizebox_width / 2; int rh = x->resizebox_height / 2; int rx1 = x2 - rw + x->resizebox_x_offset; @@ -753,7 +767,7 @@ int opd_textbox_drawElements(t_opd_textbox *x, int x1, int y1, int x2, int y2, i //sys_vgui("::pdwindow::post \"canvas motion after? [bind .x%lx.c ] // search for: $::%s::canvas%lxMOTION // result [regsub -all $::%s::canvas%lxMOTION \"[bind .x%lx.c ]\" \"FOO\" ] // \n\" \n", canvas, x->tcl_namespace, canvas, x->tcl_namespace, canvas, canvas); //create text display - sys_vgui(".x%lx.c create text %d %d -anchor nw -width %d -font {{%s} %d %s} -tags text%lx -text [subst -nobackslash -nocommands -novariables [string trimright {%s} ]] -fill \"black\" \n", canvas, x1+5, y1+5, x->width-15, sys_font, glist_getfont(glist), sys_fontweight, (long)x, x->text); + sys_vgui(".x%lx.c create text %d %d -anchor nw -width %d -font {{%s} %d %s} -tags text%lx -text [subst -nobackslash -nocommands -novariables [string trimright {%s} ]] -fill \"black\" \n", canvas, tx1, ty1, tw, sys_font, glist_getfont(glist), sys_fontweight, (long)x, x->text); // get height of text bbox, send to "setheight" to set height and redraw in the case of cmd-d duplicate, this gets called first, and then is displaced, so the bbox value is actually pre-displacement, see setheight function above opd_textbox_getRectAndDraw(x, 1); @@ -771,11 +785,13 @@ int opd_textbox_drawElements(t_opd_textbox *x, int x1, int y1, int x2, int y2, i if (x->textediting) { - sys_vgui("place .x%lx.t%lxTEXT -x [expr %d - [.x%lx.c canvasx 0]] -y [expr %d - [.x%lx.c canvasy 0]] -width %d -height %d\n", canvas, (long)x, x1+4, canvas, y1+4, canvas, x->width-16, x->height-6); + sys_vgui("place .x%lx.t%lxTEXT -x [expr %d - [.x%lx.c canvasx 0]] -y [expr %d - [.x%lx.c canvasy 0]] -width %d -height %d\n", canvas, (long)x, tx1-1, canvas, ty1-1, canvas, tw, th); + + //sys_vgui("place .x%lx.t%lxTEXT -x [expr %d - [.x%lx.c canvasx 0]] -y [expr %d - [.x%lx.c canvasy 0]] -width %d -height %d\n", canvas, (long)x, x1+4, canvas, y1+4, canvas, x->width-16, x->height-6); } else if (x->text[0] != '\0') { - sys_vgui(".x%lx.c itemconfigure text%lx -fill \"black\" -width %d -text [subst -nobackslash -nocommands -novariables [string trimright {%s} ]] \n", canvas, (long)x, x->width-16, x->text); + sys_vgui(".x%lx.c itemconfigure text%lx -fill \"black\" -width %d -text [subst -nobackslash -nocommands -novariables [string trimright {%s} ]] \n", canvas, (long)x, tw, x->text); //[regsub -all -line {^[\t]+} {%s} \" \" ] << replace \t with spaces @@ -792,7 +808,7 @@ int opd_textbox_drawElements(t_opd_textbox *x, int x1, int y1, int x2, int y2, i static void opd_textbox_delete(t_opd_textbox *x, t_glist *glist) { #ifdef OPD_TEXTBOX_DEBUG - post("%x %s", t, __func__); + post("%x %s", x, __func__); #endif t_canvas *canvas = glist_getcanvas(glist); @@ -811,7 +827,11 @@ void opd_textbox_unbind_tick(t_opd_textbox *x) pd_unbind(&x->ob.ob_pd, gensym(x->receive_name)); x->send_bind = 0; opd_textbox_unbindCanvasEvents(x); + +#ifdef OPD_TEXTBOX_DEBUG post("unbind c_bind? %d", x->c_bind); +#endif + } @@ -869,8 +889,9 @@ static void opd_textbox_vis(t_opd_textbox *x, t_glist *glist, int vis) } else { + int delay = glist_isgraph(glist) ? 100 : 0; if(x->send_bind) - clock_delay(x->unbind_delay, 0); + clock_delay(x->unbind_delay, delay); //if(!x->firsttime) { @@ -882,10 +903,16 @@ static void opd_textbox_vis(t_opd_textbox *x, t_glist *glist, int vis) static void opd_textbox_displace(t_opd_textbox *x, t_glist *glist, int dx, int dy) { - //post("%x %s mousedown %d dx %d dy %d", x, __func__, x->mouseDown, dx, dy); +#ifdef OPD_TEXTBOX_DEBUG + post("%x %s mousedown %d dx %d dy %d", x, __func__, x->mouseDown, dx, dy); +#endif - int x2 = x->parent->te_xpix + x->width; - int y2 = x->parent->te_ypix + x->height; + + int x1 = text_xpix(x->parent, glist); + int y1 = text_ypix(x->parent, glist); + int x2 = x1 + x->width; + int y2 = y1 + x->height; + t_canvas *canvas = glist_getcanvas(glist); @@ -897,8 +924,14 @@ static void opd_textbox_displace(t_opd_textbox *x, t_glist *glist, int dx, int d if(x->textediting) { - sys_vgui("place .x%lx.t%lxTEXT -x [expr %d - [.x%lx.c canvasx 0]] -y [expr %d - [.x%lx.c canvasy 0]] -width %d -height %d\n", canvas, (long)x, x->ob.te_xpix+4, canvas, x->ob.te_ypix+4, canvas, x->width-10, x->height-10); + int pix_buffer = 2; + + int tx1 = x1 + x->margin_l + pix_buffer; + int ty1 = y1 + x->margin_t + pix_buffer; + int tw = x->width - x->margin_l - x->margin_r - pix_buffer; + int th = x->height - x->margin_b - x->margin_t - pix_buffer; //height maybe needs to be added to text height... + sys_vgui("place .x%lx.t%lxTEXT -x [expr %d - [.x%lx.c canvasx 0]] -y [expr %d - [.x%lx.c canvasy 0]] -width %d -height %d\n", canvas, (long)x, tx1-1, canvas, ty1-1, canvas, tw, th); } t_object *ob = pd_checkobject(&x->parent->te_pd); @@ -942,7 +975,7 @@ void opd_textbox_select(t_opd_textbox *x, t_glist *glist, int state) if(opd_textbox_motion(x)) { - opd_textbox_resize_mousedown(x); + opd_textbox_mousedown(x); } opd_textbox_drawParent(x, 0); @@ -957,8 +990,11 @@ static void opd_textbox_activate(t_opd_textbox *x, t_glist *glist, int state) x->mouseDown = 0; - if(state) + if(state && !x->textediting) + { + x->selected = 1; opd_textbox_getTextAndCreateEditor(x, 1); + } else opd_textbox_storeTextAndExitEditor(x); @@ -1033,12 +1069,17 @@ t_opd_textbox *opd_textbox_new(t_class *c) t->streamflag = 0; t->yscroll = 0; - t->resize_hit = 0; + t->_hit = 0; t->resizebox_x_offset = 0; t->resizebox_y_offset = 0; t->resizebox_height = 10; t->resizebox_width = 10; + t->margin_t = 0; + t->margin_l = 0; + t->margin_b = 0; + t->margin_r = 0; + char buf[MAXPDSTRING]; sprintf(buf, "%lxIOLETS", (long unsigned int)t); @@ -1117,9 +1158,9 @@ t_class *opd_textbox_classnew(void) class_addmethod(c, (t_method)opd_textbox_nofocus_callback, gensym("nofocus"), 0); class_addmethod(c, (t_method)opd_textbox_key_callback, gensym("key"), A_GIMME, 0); class_addmethod(c, (t_method)opd_textbox_keyup_callback, gensym("keyup"), A_GIMME, 0); - class_addmethod(c, (t_method)opd_textbox_resize_mousedown, gensym("resize_mousedown"), 0); - class_addmethod(c, (t_method)opd_textbox_resize_mousemove, gensym("resize_mousemove"), A_DEFFLOAT, A_DEFFLOAT, 0); - class_addmethod(c, (t_method)opd_textbox_resize_mouseup, gensym("resize_mouseup"), 0); + class_addmethod(c, (t_method)opd_textbox_mousedown, gensym("mousedown"), 0); + class_addmethod(c, (t_method)opd_textbox_mousemove, gensym("mousemove"), A_DEFFLOAT, A_DEFFLOAT, 0); + class_addmethod(c, (t_method)opd_textbox_mouseup, gensym("mouseup"), 0); class_addmethod(c, (t_method)opd_textbox_mousewheel_callback, gensym("mousewheel"), 0); class_addmethod(c, (t_method)opd_textbox_setHeight, gensym("setheight"), A_DEFFLOAT, 0); diff --git a/src/o.expr.codebox/o.expr.codebox.c b/src/o.expr.codebox/o.expr.codebox.c index 7305d0b5..3b2975c7 100755 --- a/src/o.expr.codebox/o.expr.codebox.c +++ b/src/o.expr.codebox/o.expr.codebox.c @@ -498,10 +498,10 @@ void oexprcodebox_drawElements(t_object *ob, int firsttime) int x1, y1, x2, y2; oexprcodebox_getrect((t_gobj *)x, t->glist, &x1, &y1, &x2, &y2); - int cx1 = x1;// - 2; - int cy1 = y1;// - 2; - int cx2 = x2;// + 2; - int cy2 = y2;// + 2; + int rx1 = x1 + t->margin_l; + int ry1 = y1 + t->margin_t; + int rx2 = x2 - t->margin_r; + int ry2 = y2 - t->margin_b; t_glist *glist = t->glist; t_canvas *canvas = glist_getcanvas(glist); @@ -512,21 +512,27 @@ void oexprcodebox_drawElements(t_object *ob, int firsttime) { if (firsttime) { - //post("%x %s FIRST VIS height %d y1 %d y2 %d \n", x, __func__, t->height, y1, y2); + // post("%x %s FIRST VIS height %d y1 %d y2 %d \n", x, __func__, t->height, y1, y2); //border sys_vgui(".x%lx.c create rectangle %d %d %d %d -outline \"#0066CC\" -fill \"#0066CC\" -tags %s \n", canvas, x1, y1, x2, y2, x->border_tag); - sys_vgui(".x%lx.c create rectangle %d %d %d %d -outline #0066CC -fill \"white\" -tags %sBorder -width 2 \n",canvas, cx1+1, cy1+4, cx2 - 1, cy2, x->border_tag); + sys_vgui(".x%lx.c create rectangle %d %d %d %d -outline \"\" -fill \"white\" -tags %sBorder -width 1 \n",canvas, rx1, ry1, rx2, ry2, x->border_tag); } else { - //post("%x %s REDRAW height %d y1 %d y2 %d \n", x, __func__, t->height, y1, y2); + //post("%x %s REDRAW height %d width %d \n", x, __func__, t->height, t->width ); sys_vgui(".x%lx.c coords %s %d %d %d %d\n", canvas, x->border_tag, x1, y1, x2, y2); - sys_vgui(".x%lx.c coords %sBorder %d %d %d %d \n",canvas, x->border_tag, cx1+1, cy1+4, cx2 - 1, cy2 - 2); + sys_vgui(".x%lx.c coords %sBorder %d %d %d %d \n",canvas, x->border_tag, rx1, ry1, rx2, ry2); } + + char *color = (x->textbox->selected? "#006699" : "#0066CC"); + sys_vgui(".x%lx.c itemconfigure %s -outline %s -fill %s \n", canvas, x->border_tag, color, color); + sys_vgui(".x%lx.c itemconfigure %sBorder -outline %s\n", canvas, x->border_tag, color); + + opd_textbox_drawElements(x->textbox, x1, y1, x2, y2, firsttime); //draw IO @@ -579,7 +585,9 @@ static void oexprcodebox_select(t_gobj *z, t_glist *glist, int state) if (glist_isvisible(glist) && gobj_shouldvis(&x->ob.te_g, glist)) { - sys_vgui(".x%lx.c itemconfigure %sBorder -outline %s\n", canvas, x->border_tag, (state? "#006699" : "#0066CC")); + char *color = (state? "#006699" : "#0066CC"); + sys_vgui(".x%lx.c itemconfigure %s -outline %s -fill %s \n", canvas, x->border_tag, color, color); + sys_vgui(".x%lx.c itemconfigure %sBorder -outline %s\n", canvas, x->border_tag, color); } } @@ -596,7 +604,9 @@ static void oexprcodebox_activate(t_gobj *z, t_glist *glist, int state) opd_textbox_activate(x->textbox, glist, state); // sys_vgui(".x%lx.c itemconfigure %s -outline %s\n", glist, x->border_tag, (state? "$select_color" : "$msg_box_fill"));//was "$box_outline" - sys_vgui(".x%lx.c itemconfigure %sBorder -outline %s\n", canvas, x->border_tag, (state? "#006699" : "#0066CC")); + char *color = (state? "#006699" : "#0066CC"); + sys_vgui(".x%lx.c itemconfigure %s -outline %s -fill %s \n", canvas, x->border_tag, color, color); + sys_vgui(".x%lx.c itemconfigure %sBorder -outline %s\n", canvas, x->border_tag, color); } @@ -703,7 +713,12 @@ void *oexprcodebox_new(t_symbol *msg, short argc, t_atom *argv) t->selected = 0; t->editmode = glist_getcanvas(t->glist)->gl_edit; t->textediting = 0; - + + t->margin_t = 10; + t->margin_l = 1; + t->margin_b = 1; + t->margin_r = 1; + t->resizebox_x_offset = 7; t->resizebox_y_offset = 5; t->resizebox_height = 10; @@ -773,7 +788,7 @@ int setup_o0x2eexpr0x2ecodebox(void) oexprcodebox_widgetbehavior.w_displacefn = oexprcodebox_displace; oexprcodebox_widgetbehavior.w_selectfn = oexprcodebox_select; oexprcodebox_widgetbehavior.w_deletefn = oexprcodebox_delete; - oexprcodebox_widgetbehavior.w_clickfn = oexprcodebox_click; + oexprcodebox_widgetbehavior.w_clickfn = NULL; oexprcodebox_widgetbehavior.w_activatefn = oexprcodebox_activate; oexprcodebox_widgetbehavior.w_visfn = oexprcodebox_vis; class_setsavefn(oexprcodebox_class, oexprcodebox_save); diff --git a/src/odot.xcodeproj/project.pbxproj b/src/odot.xcodeproj/project.pbxproj index 568dc9ac..d2a1056b 100755 --- a/src/odot.xcodeproj/project.pbxproj +++ b/src/odot.xcodeproj/project.pbxproj @@ -58,7 +58,6 @@ buildPhases = ( ); dependencies = ( - 11893E601986F4C7008303DD /* PBXTargetDependency */, 5224CA061958C21600E37AED /* PBXTargetDependency */, 1110757A195786660090D286 /* PBXTargetDependency */, 1110757C195786660090D286 /* PBXTargetDependency */, @@ -69,10 +68,12 @@ 52183DE519218CF200F61786 /* PBXTargetDependency */, 52183DE719218CF200F61786 /* PBXTargetDependency */, 52183DE919218CF200F61786 /* PBXTargetDependency */, + 11893E601986F4C7008303DD /* PBXTargetDependency */, 52183DEB19218CF200F61786 /* PBXTargetDependency */, 112643F7194E3BA500726422 /* PBXTargetDependency */, 52183DED19218CF200F61786 /* PBXTargetDependency */, 52183DEF19218CF200F61786 /* PBXTargetDependency */, + 11B7FFBA19997FF0000F9EBF /* PBXTargetDependency */, 52183DF119218CF200F61786 /* PBXTargetDependency */, 52183DF319218CF200F61786 /* PBXTargetDependency */, 52183DF519218CF200F61786 /* PBXTargetDependency */, @@ -559,6 +560,13 @@ remoteGlobalIDString = 11893E531986F436008303DD; remoteInfo = o.compose.pd; }; + 11B7FFB919997FF0000F9EBF /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 089C1669FE841209C02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 115D7402198FD23F00F42B88; + remoteInfo = o.expr.codebox.pd; + }; 520D542F195B8200007CE02D /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 089C1669FE841209C02AAC07 /* Project object */; @@ -2175,7 +2183,7 @@ 08EA7FFBFE8413EDC02AAC07 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = ""; }; 112AC85F19394255003244E9 /* o.menu.pd_darwin */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = o.menu.pd_darwin; sourceTree = BUILT_PRODUCTS_DIR; }; 112AC8601939427D003244E9 /* o.menu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = o.menu.c; path = omenu/o.menu.c; sourceTree = ""; }; - 115D740C198FD23F00F42B88 /* o.expr.codebox.pd.pd_darwin */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = o.expr.codebox.pd.pd_darwin; sourceTree = BUILT_PRODUCTS_DIR; }; + 115D740C198FD23F00F42B88 /* o.expr.codebox.pd_darwin */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = o.expr.codebox.pd_darwin; sourceTree = BUILT_PRODUCTS_DIR; }; 11893E5D1986F436008303DD /* o.compose.pd_darwin */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = o.compose.pd_darwin; sourceTree = BUILT_PRODUCTS_DIR; }; 11893E6119881E34008303DD /* opd_textbox.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = opd_textbox.h; path = o.compose/opd_textbox.h; sourceTree = ""; }; 119FA031191D5814001C3325 /* o.append.pd_darwin */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = o.append.pd_darwin; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -3174,7 +3182,7 @@ 9B3930D3195A286D002EDAE5 /* o.compose.mxo */, 9B3930E3195A2898002EDAE5 /* o.display.mxo */, 11893E5D1986F436008303DD /* o.compose.pd_darwin */, - 115D740C198FD23F00F42B88 /* o.expr.codebox.pd.pd_darwin */, + 115D740C198FD23F00F42B88 /* o.expr.codebox.pd_darwin */, ); name = Products; sourceTree = ""; @@ -3811,7 +3819,7 @@ ); name = o.expr.codebox.pd; productName = o.print.pd; - productReference = 115D740C198FD23F00F42B88 /* o.expr.codebox.pd.pd_darwin */; + productReference = 115D740C198FD23F00F42B88 /* o.expr.codebox.pd_darwin */; productType = "com.apple.product-type.library.dynamic"; }; 11893E531986F436008303DD /* o.compose.pd */ = { @@ -6416,6 +6424,11 @@ target = 11893E531986F436008303DD /* o.compose.pd */; targetProxy = 11893E5F1986F4C7008303DD /* PBXContainerItemProxy */; }; + 11B7FFBA19997FF0000F9EBF /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 115D7402198FD23F00F42B88 /* o.expr.codebox.pd */; + targetProxy = 11B7FFB919997FF0000F9EBF /* PBXContainerItemProxy */; + }; 520D5430195B8200007CE02D /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 9B3930D4195A2898002EDAE5 /* o.display */;