Commit fbf33670 authored by Ivica Bukvic's avatar Ivica Bukvic
Browse files

Implemented dynamic cord color and width for msg and signal cords and introduced K-12 module

parent cafd5a38
......@@ -916,10 +916,10 @@ static void canvas_drawlines(t_canvas *x)
while (oc = linetraverser_next(&t))
{
issignal = (outlet_getsymbol(t.tr_outlet) == &s_signal ? 1 : 0);
sys_vgui(".x%lx.c create line %d %d %d %d -width %d -fill %s \
sys_vgui(".x%lx.c create line %d %d %d %d -width %s -fill %s \
-tags {l%lx all_cords}\n",
glist_getcanvas(x), t.tr_lx1, t.tr_ly1, t.tr_lx2, t.tr_ly2,
(issignal ? 2:1), (issignal ? "$signal_cord" : "$msg_cord"),
(issignal ? "$signal_cord_width" : "$msg_cord_width"), (issignal ? "$signal_cord" : "$msg_cord"),
oc);
}
}
......
......@@ -2578,9 +2578,10 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which,
x->gl_editor->e_xwas = xpos;
x->gl_editor->e_ywas = ypos;
sys_vgui(
".x%lx.c create line %d %d %d %d -width %d -tags x\n",
".x%lx.c create line %d %d %d %d -fill %s -width %s -tags x\n",
x, xpos, ypos, xpos, ypos,
(issignal ? 2 : 1));
(issignal ? "$signal_cord" : "$msg_cord"),
(issignal ? "$signal_cord_width" : "$msg_cord_width"));
}
else
// jsarlo
......@@ -2995,11 +2996,11 @@ void canvas_doconnect(t_canvas *x, int xpos, int ypos, int which, int doit)
((x22-x21-IOWIDTH) * closest2)/(ninlet2-1) : 0)
+ IOMIDDLE;
ly2 = y21;
sys_vgui(".x%lx.c create line %d %d %d %d -fill %s -width %d -tags {l%lx all_cords}\n",
sys_vgui(".x%lx.c create line %d %d %d %d -fill %s -width %s -tags {l%lx all_cords}\n",
glist_getcanvas(x),
lx1, ly1, lx2, ly2,
(issignal ? "$signal_cord" : "$msg_cord"),
(issignal ? 2 : 1),
(issignal ? "$signal_cord_width" : "$msg_cord_width"),
oc);
if (canvas_cnct_inlet_tag[0] != 0)
{
......@@ -4534,9 +4535,9 @@ void canvas_connect(t_canvas *x, t_floatarg fwhoout, t_floatarg foutno,
if (!(oc = obj_connect(objsrc, outno, objsink, inno))) goto bad;
if (glist_isvisible(x))
{
sys_vgui(".x%lx.c create line %d %d %d %d -width %d -fill %s -tags {l%lx all_cords}\n",
sys_vgui(".x%lx.c create line %d %d %d %d -width %s -fill %s -tags {l%lx all_cords}\n",
glist_getcanvas(x), 0, 0, 0, 0,
(obj_issignaloutlet(objsrc, outno) ? 2 : 1),
(obj_issignaloutlet(objsrc, outno) ? "$signal_cord_width" : "$msg_cord_width"),
(obj_issignaloutlet(objsrc, outno) ? "$signal_cord" : "$msg_cord"), oc);
canvas_fixlinesfor(x, objsrc);
}
......@@ -4906,6 +4907,13 @@ static void canvas_tip(t_canvas *x, t_symbol *s, int argc, t_atom *argv)
}
}
static void canvas_undo_add_from_tcl(t_canvas *x) {
canvas_editmode(x, 1.);
canvas_undo_add(glist_getcanvas(x), 9, "create",
(void *)canvas_undo_set_create(glist_getcanvas(x)));
}
void g_editor_setup(void)
{
/* ------------------------ events ---------------------------------- */
......@@ -4978,6 +4986,8 @@ void g_editor_setup(void)
gensym("copyfromexternalbuffer"), A_GIMME, A_NULL);
class_addmethod(canvas_class, (t_method)canvas_reset_copyfromexternalbuffer,
gensym("reset_copyfromexternalbuffer"), A_NULL);
class_addmethod(canvas_class, (t_method)canvas_undo_add_from_tcl,
gensym("undo_add"), A_NULL);
/* -------------- connect method used in reading files ------------------ */
class_addmethod(canvas_class, (t_method)canvas_connect,
......
This diff is collapsed.
......@@ -49,6 +49,7 @@ int sys_hipriority = -1; /* -1 = don't care; 0 = no; 1 = yes */
int sys_guisetportnumber; /* if started from the GUI, this is the port # */
int sys_nosleep = 0; /* skip all "sleep" calls and spin instead */
int sys_console = 0; /* default settings for the console is off */
int sys_k12_mode = 0; /* by default k12 mode is off */
char *sys_guicmd;
t_symbol *sys_libdir;
......@@ -289,6 +290,12 @@ int sys_main(int argc, char **argv)
sys_reopen_audio();
if (sys_console) sys_vgui("pdtk_toggle_console 1\n");
if (sys_k12_mode) {
t_namelist *path = pd_extrapath;
while (path->nl_next)
path = path->nl_next;
sys_vgui("pdtk_enable_k12_mode %s\n", path->nl_string);
}
/* run scheduler until it quits */
return (m_mainloop());
......@@ -382,6 +389,7 @@ static char *(usagemessage[]) = {
"-extraflags <s> -- string argument to send schedlib\n",
"-batch -- run off-line as a batch process\n",
"-autopatch -- enable auto-patching new from selected objects\n",
"-k12 -- enable K-12 education mode (requires L2Ork K12 lib)\n",
};
static void sys_parsedevlist(int *np, int *vecp, int max, char *str)
......@@ -773,6 +781,11 @@ int sys_argparse(int argc, char **argv)
{
sys_console = 1;
argc--; argv++;
}
else if (!strcmp(*argv, "-k12"))
{
sys_k12_mode = 1;
argc--; argv++;
}
else if (!strcmp(*argv, "-guiport") && argc > 1 &&
sscanf(argv[1], "%d", &sys_guisetportnumber) >= 1)
......
......@@ -295,6 +295,7 @@ void sys_save_audio_params(
typedef void (*t_printhook)(const char *s);
extern t_printhook sys_printhook; /* set this to override printing */
extern int sys_printtostderr;
extern int sys_k12_mode;
/* jsarlo { */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment