diff options
author | N.N. <krzyszcz@users.sourceforge.net> | 2004-03-29 17:09:53 +0000 |
---|---|---|
committer | N.N. <krzyszcz@users.sourceforge.net> | 2004-03-29 17:09:53 +0000 |
commit | 14b05069b61d8d86d52415acb1adea7a61547ac6 (patch) | |
tree | c1a5e683b309349d4c261476154897fba6c0578b /shared | |
parent | 6f0f6fb5c0fe8ab2548c84a65fb6d1ee9363e317 (diff) |
toxy alpha10
svn path=/trunk/externals/miXed/; revision=1502
Diffstat (limited to 'shared')
-rw-r--r-- | shared/common/port.c | 6 | ||||
-rw-r--r-- | shared/hammer/gui.c | 25 | ||||
-rw-r--r-- | shared/toxy/scriptlet.c | 47 | ||||
-rw-r--r-- | shared/unstable/fringe.c | 12 |
4 files changed, 74 insertions, 16 deletions
diff --git a/shared/common/port.c b/shared/common/port.c index fa81bc0..26f24ca 100644 --- a/shared/common/port.c +++ b/shared/common/port.c @@ -35,7 +35,13 @@ enum { PORT_OK, PORT_NEXT, /* next line, please */ PORT_UNKNOWN, PORT_CORRUPT, PORT_FATAL }; +/* without access to sys_defaultfont, we just mimic defs from s_main.c */ +#ifdef MSW +#define PORT_DEFFONTSIZE 12. +#else #define PORT_DEFFONTSIZE 10. +#endif + #define PORT_XSTRETCH 1.25 #define PORT_YSTRETCH 1.1 #define PORT_WSTRETCH 1.25 diff --git a/shared/hammer/gui.c b/shared/hammer/gui.c index 5e98ff8..131ddfe 100644 --- a/shared/hammer/gui.c +++ b/shared/hammer/gui.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2003 krzYszcz and others. +/* Copyright (c) 2003-2004 krzYszcz and others. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ @@ -131,9 +131,11 @@ static void hammergui__remouse(t_hammergui *snk) static void hammergui_dobindfocus(t_hammergui *snk) { sys_vgui("bind Canvas <<hammerfocusin>> \ - {pd [concat %s _focus %%W 1 \\;]}\n", snk->g_gui->s_name); + {if {[hammergui_ispatcher %%W]} \ + {pd [concat %s _focus %%W 1 \\;]}}\n", snk->g_gui->s_name); sys_vgui("bind Canvas <<hammerfocusout>> \ - {pd [concat %s _focus %%W 0 \\;]}\n", snk->g_gui->s_name); + {if {[hammergui_ispatcher %%W]} \ + {pd [concat %s _focus %%W 0 \\;]}}\n", snk->g_gui->s_name); } static void hammergui__refocus(t_hammergui *snk) @@ -152,9 +154,11 @@ static void hammergui__refocus(t_hammergui *snk) static void hammergui_dobindvised(t_hammergui *snk) { sys_vgui("bind Canvas <<hammervised>> \ - {pd [concat %s _vised %%W 1 \\;]}\n", snk->g_gui->s_name); + {if {[hammergui_ispatcher %%W]} \ + {pd [concat %s _vised %%W 1 \\;]}}\n", snk->g_gui->s_name); sys_vgui("bind Canvas <<hammerunvised>> \ - {pd [concat %s _vised %%W 0 \\;]}\n", snk->g_gui->s_name); + {if {[hammergui_ispatcher %%W]} \ + {pd [concat %s _vised %%W 0 \\;]}}\n", snk->g_gui->s_name); } static void hammergui__revised(t_hammergui *snk) @@ -192,6 +196,17 @@ static void hammergui_setup(void) class_addmethod(hammergui_class, (t_method)hammergui__vised, ps__vised, A_SYMBOL, A_FLOAT, 0); + /* Protect against pdCmd being called (via "Canvas <Destroy>" binding) + during Tcl_Finalize(). FIXME this should be a standard exit handler. */ + sys_gui("proc hammergui_exithook {cmd op} {proc pd {} {}}\n"); + sys_gui("trace add execution exit enter hammergui_exithook\n"); + + sys_gui("proc hammergui_ispatcher {cv} {\n"); + sys_gui(" if {[string range $cv 0 1] == \".x\""); + sys_gui(" && [string range $cv end-1 end] == \".c\"} {\n"); + sys_gui(" return 1} else {return 0}\n"); + sys_gui("}\n"); + sys_gui("proc hammergui_remouse {} {\n"); sys_gui(" bind all <<hammerdown>> {}\n"); sys_gui(" bind all <<hammerup>> {}\n"); diff --git a/shared/toxy/scriptlet.c b/shared/toxy/scriptlet.c index f7ce800..a2f5ee0 100644 --- a/shared/toxy/scriptlet.c +++ b/shared/toxy/scriptlet.c @@ -200,30 +200,56 @@ static char *scriptlet_dedot(t_scriptlet *sp, char *ibuf, char *obuf, t_canvas *cv; if (cv = scriptlet_canvasvalidate(sp, 0)) { + t_glist *glist; if (!strncmp(&ibuf[1], "tag", 3)) { t_rtext *rt; - if (cv->gl_owner && glist_isvisible(cv->gl_owner) && - cv->gl_owner->gl_editor && - (rt = glist_findrtext(cv->gl_owner, (t_object *)cv))) + glist = cv->gl_owner; + if (glist && glist_isvisible(glist) && glist->gl_editor + && (rt = glist_findrtext(glist, (t_object *)cv))) sprintf(obuf, "%s", rtext_gettag(rt)); else obuf[0] = 0; len = 4; } - else if (!strncmp(&ibuf[1], "owner", 5)) + else if (!strncmp(&ibuf[1], "parent", 6)) { - if (cv->gl_owner && glist_isvisible(cv->gl_owner)) - sprintf(obuf, ".x%x", (int)cv->gl_owner); + glist = cv->gl_owner; + if (glist && glist_isvisible(glist)) + sprintf(obuf, ".x%x", (int)glist); else obuf[0] = 0; - len = 6; + len = 7; } else if (!strncmp(&ibuf[1], "root", 4)) { - sprintf(obuf, ".x%x", (int)canvas_getrootfor(cv)); + glist = canvas_getrootfor(cv); + if (glist && glist_isvisible(glist)) + sprintf(obuf, ".x%x", (int)glist); + else + obuf[0] = 0; len = 5; } + else if (!strncmp(&ibuf[1], "owner", 5)) + { + if (glist = canvas_getrootfor(cv)) + glist = glist->gl_owner; + if (glist && glist_isvisible(glist)) + sprintf(obuf, ".x%x", (int)glist); + else + obuf[0] = 0; + len = 6; + } + else if (!strncmp(&ibuf[1], "top", 3)) + { + glist = cv; + while (glist->gl_owner) glist = glist->gl_owner; + if (glist && glist_isvisible(glist)) + sprintf(obuf, ".x%x", (int)glist); + else + obuf[0] = 0; + len = 4; + } /* LATER find out when gl_<coords> are updated, think how to better sync them to Tk. */ else if (!strncmp(&ibuf[1], "x1", 2)) @@ -256,6 +282,11 @@ static char *scriptlet_dedot(t_scriptlet *sp, char *ibuf, char *obuf, sprintf(obuf, "%d", glist_isgraph(cv)); len = 4; } + else if (!strncmp(&ibuf[1], "dir", 3)) + { + sprintf(obuf, "%s", canvas_getdir(cv)->s_name); + len = 4; + } else loud_error(sp->s_owner, "bad field '%s'", &ibuf[1]); } } diff --git a/shared/unstable/fringe.c b/shared/unstable/fringe.c index cf29ec6..913d201 100644 --- a/shared/unstable/fringe.c +++ b/shared/unstable/fringe.c @@ -9,6 +9,8 @@ #include "unstable/forky.h" #include "unstable/fringe.h" +//#define FRINGE_DEBUG + static int gobj_getindex(t_glist *gl, t_gobj *ob) { t_gobj *ob1; @@ -57,7 +59,7 @@ static void gobj_stowconnections(t_glist *gl, t_gobj *ob, t_binbuf *bb) gobj_getindex(gl, (t_gobj *)lt.tr_ob), lt.tr_outno, gobj_getindex(gl, (t_gobj *)lt.tr_ob2), lt.tr_inno); } -#if 0 +#ifdef FRINGE_DEBUG post("packed connections:"); binbuf_print(bb); #endif @@ -65,9 +67,13 @@ static void gobj_stowconnections(t_glist *gl, t_gobj *ob, t_binbuf *bb) static void gobj_restoreconnections(t_glist *gl, t_binbuf *bb) { - pd_bind((t_pd *)gl, gensym("#X")); +#ifdef FRINGE_DEBUG + post("restoring connections:"); + binbuf_print(bb); +#endif + canvas_setcurrent(gl); binbuf_eval(bb, 0, 0, 0); - pd_unbind((t_pd *)gl, gensym("#X")); + canvas_unsetcurrent(gl); } void gobj_recreate(t_glist *gl, t_gobj *ob, t_binbuf *bb) |