Commit 18b4aafd authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

got scopehandle clicks working... now need to port scopehandle motion by...

got scopehandle clicks working... now need to port scopehandle motion by adding a wrapper in canvas_motion of g_editor.c for Scope~
parent 7395372f
......@@ -1022,6 +1022,14 @@ static void scopehandle__clickhook(t_scopehandle *sh, t_floatarg f, t_floatarg x
sh->h_dragon = newstate;
}
/* wrapper method for forwarding "scopehandle" data */
static void scope_click_for_resizing(t_scope *x, t_floatarg f, t_floatarg xxx,
t_floatarg yyy)
{
t_scopehandle *sh = (t_scopehandle *)x->x_handle;
scopehandle__clickhook(sh, f, xxx, yyy);
}
static void scopehandle__motionhook(t_scopehandle *sh,
t_floatarg f1, t_floatarg f2)
{
......@@ -1140,6 +1148,11 @@ void Scope_tilde_setup(void)
class_addmethod(scope_class, (t_method)scope_click,
gensym("click"),
A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0);
/* Big hack for receiving edit-mode resize anchor clicks from
g_editor.c. */
class_addmethod(scope_class, (t_method)scope_click_for_resizing,
gensym("_click_for_resizing"),
A_FLOAT, A_FLOAT, A_FLOAT, 0);
class_setwidget(scope_class, &scope_widgetbehavior);
forky_setsavefn(scope_class, scope_save);
scopehandle_class = class_new(gensym("_scopehandle"), 0, 0,
......
......@@ -3284,8 +3284,13 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which,
/* look for an outlet we just clicked onto */
int noutlet;
int ninlet;
/* resize? only for "true" text boxes or canvases*/
if (ob && ob->te_iemgui && xpos >= x2-4 && ypos > y2-6)
/* resize? only for "true" text boxes, canvases, iemguis,
and -- using an awful hack-- for the Scope~ object
by checking for the class name below */
if (ob &&
(ob->te_iemgui
|| pd_class(&ob->te_pd)->c_name == gensym("Scope~"))
&& xpos >= x2-4 && ypos > y2-6)
{
if (doit)
{
......@@ -3294,9 +3299,17 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which,
x->gl_editor->e_ywas = y1;
x->gl_editor->e_xnew = xpos;
x->gl_editor->e_ynew = ypos;
t_pd *sh = (t_pd *)((t_iemgui *)ob)->x_handle;
pd_vmess(sh, gensym("_click"), "fff",
(t_float)1, (t_float)xpos, (t_float)ypos);
if (ob->te_iemgui)
{
t_pd *sh = (t_pd *)((t_iemgui *)ob)->x_handle;
pd_vmess(sh, gensym("_click"), "fff",
(t_float)1, (t_float)xpos, (t_float)ypos);
}
else
{
pd_vmess((t_pd *)ob, gensym("_click_for_resizing"),
"fff", (t_float)1, (t_float)xpos, (t_float)ypos);
}
}
else
{
......
Supports Markdown
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