Skip to content
Snippets Groups Projects
Commit d7073d8f authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

brought back the changes to Scope.c made before using the miXed submodule,...

brought back the changes to Scope.c made before using the miXed submodule, plus some changes to get some objects to build correctly on OSX and Windows
parent 2c6c8032
No related branches found
No related tags found
No related merge requests found
...@@ -505,8 +505,15 @@ static void scope_frgb(t_scope *x, t_symbol *s, int ac, t_atom *av) ...@@ -505,8 +505,15 @@ static void scope_frgb(t_scope *x, t_symbol *s, int ac, t_atom *av)
x->x_fggreen = (int)fggreen; x->x_fggreen = (int)fggreen;
x->x_fgblue = (int)fgblue; x->x_fgblue = (int)fgblue;
if (cv = scope_isvisible(x)) if (cv = scope_isvisible(x))
sys_vgui(".x%x.c itemconfigure %s -fill #%2.2x%2.2x%2.2x\n", {
cv, x->x_fgtag, x->x_fgred, x->x_fggreen, x->x_fgblue); char color[20];
sprintf(color, "#%2.2x%2.2x%2.2x",
x->x_fgred, x->x_fggreen, x->x_fgblue);
//sys_vgui(".x%x.c itemconfigure %s -fill #%2.2x%2.2x%2.2x\n",
// cv, x->x_fgtag, x->x_fgred, x->x_fggreen, x->x_fgblue);
gui_vmess("gui_scope_configure_fg_color", "xxs",
cv, x, color);
}
} }
static void scope_brgb(t_scope *x, t_symbol *s, int ac, t_atom *av) static void scope_brgb(t_scope *x, t_symbol *s, int ac, t_atom *av)
...@@ -528,8 +535,15 @@ static void scope_brgb(t_scope *x, t_symbol *s, int ac, t_atom *av) ...@@ -528,8 +535,15 @@ static void scope_brgb(t_scope *x, t_symbol *s, int ac, t_atom *av)
x->x_bggreen = (int)bggreen; x->x_bggreen = (int)bggreen;
x->x_bgblue = (int)bgblue; x->x_bgblue = (int)bgblue;
if (cv = scope_isvisible(x)) if (cv = scope_isvisible(x))
sys_vgui(".x%x.c itemconfigure %s -fill #%2.2x%2.2x%2.2x\n", {
cv, x->x_bgtag, x->x_bgred, x->x_bggreen, x->x_bgblue); char color[20];
sprintf(color, "#%2.2x%2.2x%2.2x",
x->x_bgred, x->x_bggreen, x->x_bgblue);
//sys_vgui(".x%x.c itemconfigure %s -fill #%2.2x%2.2x%2.2x\n",
// cv, x->x_bgtag, x->x_bgred, x->x_bggreen, x->x_bgblue);
gui_vmess("gui_scope_configure_bg_color", "xxs",
cv, x, color);
}
} }
static void scope_getrect(t_gobj *z, t_glist *glist, static void scope_getrect(t_gobj *z, t_glist *glist,
...@@ -556,7 +570,12 @@ static void scope_displace(t_gobj *z, t_glist *glist, int dx, int dy) ...@@ -556,7 +570,12 @@ static void scope_displace(t_gobj *z, t_glist *glist, int dx, int dy)
if (glist_isvisible(glist)) if (glist_isvisible(glist))
{ {
t_canvas *cv = scope_getcanvas(x, glist); t_canvas *cv = scope_getcanvas(x, glist);
sys_vgui(".x%x.c move %s %d %d\n", cv, x->x_tag, dx, dy); //sys_vgui(".x%x.c move %s %d %d\n", cv, x->x_tag, dx, dy);
gui_vmess("gui_scope_displace", "xxii",
cv,
x,
dx,
dy);
canvas_fixlinesfor(cv, t); canvas_fixlinesfor(cv, t);
} }
} }
...@@ -603,6 +622,10 @@ static void scope_delete(t_gobj *z, t_glist *glist) ...@@ -603,6 +622,10 @@ static void scope_delete(t_gobj *z, t_glist *glist)
canvas_deletelinesfor(glist, (t_text *)z); canvas_deletelinesfor(glist, (t_text *)z);
} }
/* We probably don't need this anymore. We're creating the fg paths
when we draw the background, so we only need to configure their
data using the redraw methods. It's no longer used, but we should
probably test a bit more before removing it... */
static void scope_drawfgmono(t_scope *x, t_canvas *cv, static void scope_drawfgmono(t_scope *x, t_canvas *cv,
int x1, int y1, int x2, int y2) int x1, int y1, int x2, int y2)
{ {
...@@ -654,50 +677,61 @@ static void scope_drawfgxy(t_scope *x, t_canvas *cv, ...@@ -654,50 +677,61 @@ static void scope_drawfgxy(t_scope *x, t_canvas *cv,
sprintf(cmd2, "-fill #%2.2x%2.2x%2.2x -width %f -tags {%s %s}\n ", sprintf(cmd2, "-fill #%2.2x%2.2x%2.2x -width %f -tags {%s %s}\n ",
x->x_fgred, x->x_fggreen, x->x_fgblue, x->x_fgred, x->x_fggreen, x->x_fgblue,
SCOPE_FGWIDTH, x->x_fgtag, x->x_tag); SCOPE_FGWIDTH, x->x_fgtag, x->x_tag);
/* Not sure whether we need the conditional here or not... */
if (x->x_bufsize)
{
gui_start_vmess("gui_scope_configure_fg_xy", "xx", cv, x);
gui_start_array();
}
while (nleft > SCOPE_GUICHUNKXY) while (nleft > SCOPE_GUICHUNKXY)
{ {
int i = SCOPE_GUICHUNKXY; int i = SCOPE_GUICHUNKXY;
while (i--) while (i--)
{ {
float oldx = xx, oldy = yy, dx, dy; float oldx = xx, oldy = yy, dx, dy;
xx = x1 + xsc * (*xbp++ - x->x_minval); xx = xsc * (*xbp++ - x->x_minval);
yy = y2 - ysc * (*ybp++ - x->x_minval); yy = y2 - y1 - ysc * (*ybp++ - x->x_minval);
/* using 1-pixel margins */ /* using 1-pixel margins */
dx = (xx > oldx ? 1. : -1.); dx = (xx > oldx ? 1. : -1.);
dy = (yy > oldy ? 1. : -1.); dy = (yy > oldy ? 1. : -1.);
#ifndef SCOPE_DEBUG #ifndef SCOPE_DEBUG
if (xx < x1 || xx > x2 || yy < y1 || yy > y2) if (xx < 0 || xx > (x2 - x1) || yy < 0 || yy > (y2 - y1))
continue; continue;
#endif #endif
sprintf(chunkp, "%s %d %d %d %d %s", cmd1, sprintf(chunkp, "M%d %d %d %d",
(int)(xx - dx), (int)(yy - dy), (int)(xx - dx), (int)(yy - dy),
(int)(xx + dx), (int)(yy + dy), cmd2); (int)(xx + dx), (int)(yy + dy));
chunkp += strlen(chunkp); chunkp += strlen(chunkp);
} }
if (chunkp > chunk) if (chunkp > chunk)
sys_gui(chunk); gui_s(chunk);
chunkp = chunk; chunkp = chunk;
nleft -= SCOPE_GUICHUNKXY; nleft -= SCOPE_GUICHUNKXY;
} }
while (nleft--) while (nleft--)
{ {
float oldx = xx, oldy = yy, dx, dy; float oldx = xx, oldy = yy, dx, dy;
xx = x1 + xsc * (*xbp++ - x->x_minval); xx = xsc * (*xbp++ - x->x_minval);
yy = y2 - ysc * (*ybp++ - x->x_minval); yy = (y2 - y1) - ysc * (*ybp++ - x->x_minval);
/* using 1-pixel margins */ /* using 1-pixel margins */
dx = (xx > oldx ? 1. : -1.); dx = (xx > oldx ? 1. : -1.);
dy = (yy > oldy ? 1. : -1.); dy = (yy > oldy ? 1. : -1.);
#ifndef SCOPE_DEBUG #ifndef SCOPE_DEBUG
if (xx < x1 || xx > x2 || yy < y1 || yy > y2) if (xx < 0 || xx > (x2 - x1) || yy < 0 || yy > (y2 - y1))
continue; continue;
#endif #endif
sprintf(chunkp, "%s %d %d %d %d %s", cmd1, sprintf(chunkp, "M%d %d %d %d",
(int)(xx - dx), (int)(yy - dy), (int)(xx - dx), (int)(yy - dy),
(int)(xx + dx), (int)(yy + dy), cmd2); (int)(xx + dx), (int)(yy + dy));
chunkp += strlen(chunkp); chunkp += strlen(chunkp);
} }
if (chunkp > chunk) if (chunkp > chunk)
sys_gui(chunk); gui_s(chunk);
if (x->x_bufsize)
{
gui_end_array();
gui_end_vmess();
}
} }
static void scope_drawbg(t_scope *x, t_canvas *cv, static void scope_drawbg(t_scope *x, t_canvas *cv,
...@@ -705,29 +739,40 @@ static void scope_drawbg(t_scope *x, t_canvas *cv, ...@@ -705,29 +739,40 @@ static void scope_drawbg(t_scope *x, t_canvas *cv,
{ {
int i; int i;
float dx, dy, xx, yy; float dx, dy, xx, yy;
char fgcolor[20];
char bgcolor[20];
dx = (x2 - x1) * 0.125; dx = (x2 - x1) * 0.125;
dy = (y2 - y1) * 0.25; dy = (y2 - y1) * 0.25;
sys_vgui(".x%x.c create rectangle %d %d %d %d\ sprintf(fgcolor, "#%2.2x%2.2x%2.2x", x->x_fgred, x->x_fggreen, x->x_fgblue);
sprintf(bgcolor, "#%2.2x%2.2x%2.2x", x->x_bgred, x->x_bggreen, x->x_bgblue);
//sys_vgui(".x%x.c create rectangle %d %d %d %d\
-fill #%2.2x%2.2x%2.2x -width %f -tags {%s %s}\n", -fill #%2.2x%2.2x%2.2x -width %f -tags {%s %s}\n",
cv, x1, y1, x2, y2, // cv, x1, y1, x2, y2,
x->x_bgred, x->x_bggreen, x->x_bgblue, // x->x_bgred, x->x_bggreen, x->x_bgblue,
SCOPE_GRIDWIDTH, x->x_bgtag, x->x_tag); // SCOPE_GRIDWIDTH, x->x_bgtag, x->x_tag);
for (i = 0, xx = x1 + dx; i < 7; i++, xx += dx) //for (i = 0, xx = x1 + dx; i < 7; i++, xx += dx)
sys_vgui(".x%x.c create line %f %d %f %d\ // sys_vgui(".x%x.c create line %f %d %f %d\
-width %f -tags {%s %s}\n", cv, xx, y1, xx, y2, -width %f -tags {%s %s}\n", cv, xx, y1, xx, y2,
SCOPE_GRIDWIDTH, x->x_gridtag, x->x_tag); // SCOPE_GRIDWIDTH, x->x_gridtag, x->x_tag);
for (i = 0, yy = y1 + dy; i < 3; i++, yy += dy) //for (i = 0, yy = y1 + dy; i < 3; i++, yy += dy)
sys_vgui(".x%x.c create line %d %f %d %f\ // sys_vgui(".x%x.c create line %d %f %d %f\
-width %f -tags {%s %s}\n", cv, x1, yy, x2, yy, -width %f -tags {%s %s}\n", cv, x1, yy, x2, yy,
SCOPE_GRIDWIDTH, x->x_gridtag, x->x_tag); // SCOPE_GRIDWIDTH, x->x_gridtag, x->x_tag);
} /* Here we draw the background, _and_ we create the paths
for the foreground paths. The paths will get filled with
static void scope_drawmono(t_scope *x, t_canvas *cv) data in scope_drawfgxy, etc. This should be cheaper than
{ creating and destroying a bunch of DOM objects on every
int x1, y1, x2, y2; redraw. */
scope_getrect((t_gobj *)x, x->x_glist, &x1, &y1, &x2, &y2); gui_vmess("gui_scope_draw_bg", "xxssiifff",
scope_drawbg(x, cv, x1, y1, x2, y2); glist_getcanvas(cv),
scope_drawfgmono(x, cv, x1, y1, x2, y2); x,
fgcolor,
bgcolor,
x2 - x1,
y2 - y1,
SCOPE_GRIDWIDTH,
dx,
dy);
} }
static void scope_redrawmono(t_scope *x, t_canvas *cv) static void scope_redrawmono(t_scope *x, t_canvas *cv)
...@@ -741,38 +786,59 @@ static void scope_redrawmono(t_scope *x, t_canvas *cv) ...@@ -741,38 +786,59 @@ static void scope_redrawmono(t_scope *x, t_canvas *cv)
scope_getrect((t_gobj *)x, x->x_glist, &x1, &y1, &x2, &y2); scope_getrect((t_gobj *)x, x->x_glist, &x1, &y1, &x2, &y2);
dx = (float)(x2 - x1) / (float)x->x_bufsize; dx = (float)(x2 - x1) / (float)x->x_bufsize;
sc = ((float)x->x_height - 2.) / (float)(x->x_maxval - x->x_minval); sc = ((float)x->x_height - 2.) / (float)(x->x_maxval - x->x_minval);
xx = x1; //xx = x1;
sys_vgui(".x%x.c coords %s \\\n", cv, x->x_fgtag); xx = 0;
//sys_vgui(".x%x.c coords %s \\\n", cv, x->x_fgtag);
if (x->x_bufsize) {
gui_start_vmess("gui_scope_configure_fg_mono", "xx", cv, x);
gui_start_array();
gui_s("M");
}
while (nleft > SCOPE_GUICHUNKMONO) while (nleft > SCOPE_GUICHUNKMONO)
{ {
int i = SCOPE_GUICHUNKMONO; int i = SCOPE_GUICHUNKMONO;
while (i--) while (i--)
{ {
yy = (y2 - 1) - sc * (*bp++ - x->x_minval); //yy = (y2 - 1) - sc * (*bp++ - x->x_minval);
yy = (y2 - y1 - 1) - sc * (*bp++ - x->x_minval);
#ifndef SCOPE_DEBUG #ifndef SCOPE_DEBUG
if (yy > y2) yy = y2; else if (yy < y1) yy = y1; if (yy > (y2 - y1)) yy = y2 - y1; else if (yy < 0) yy = 0;
#endif #endif
sprintf(chunkp, "%d %d ", (int)xx, (int)yy); sprintf(chunkp, "%d %d ", (int)xx, (int)yy);
chunkp += strlen(chunkp); chunkp += strlen(chunkp);
xx += dx; xx += dx;
} }
strcpy(chunkp, "\\\n"); //strcpy(chunkp, "\\\n");
sys_gui(chunk); gui_s(chunk);
chunkp = chunk; chunkp = chunk;
nleft -= SCOPE_GUICHUNKMONO; nleft -= SCOPE_GUICHUNKMONO;
} }
while (nleft--) while (nleft--)
{ {
yy = (y2 - 1) - sc * (*bp++ - x->x_minval); //yy = (y2 - 1) - sc * (*bp++ - x->x_minval);
yy = (y2 - y1 - 1) - sc * (*bp++ - x->x_minval);
#ifndef SCOPE_DEBUG #ifndef SCOPE_DEBUG
if (yy > y2) yy = y2; else if (yy < y1) yy = y1; if (yy > (y2 - y1)) yy = y2 - y1; else if (yy < 0) yy = 0;
#endif #endif
sprintf(chunkp, "%d %d ", (int)xx, (int)yy); sprintf(chunkp, "%d %d ", (int)xx, (int)yy);
chunkp += strlen(chunkp); chunkp += strlen(chunkp);
xx += dx; xx += dx;
} }
strcpy(chunkp, "\n"); //strcpy(chunkp, "\n");
sys_gui(chunk); if (x->x_bufsize)
{
gui_s(chunk);
gui_end_array();
gui_end_vmess();
}
}
static void scope_drawmono(t_scope *x, t_canvas *cv)
{
int x1, y1, x2, y2;
scope_getrect((t_gobj *)x, x->x_glist, &x1, &y1, &x2, &y2);
scope_drawbg(x, cv, x1, y1, x2, y2);
//scope_drawfgmono(x, cv, x1, y1, x2, y2);
} }
static void scope_drawxy(t_scope *x, t_canvas *cv) static void scope_drawxy(t_scope *x, t_canvas *cv)
...@@ -787,13 +853,14 @@ static void scope_redrawxy(t_scope *x, t_canvas *cv) ...@@ -787,13 +853,14 @@ static void scope_redrawxy(t_scope *x, t_canvas *cv)
{ {
int x1, y1, x2, y2; int x1, y1, x2, y2;
scope_getrect((t_gobj *)x, x->x_glist, &x1, &y1, &x2, &y2); scope_getrect((t_gobj *)x, x->x_glist, &x1, &y1, &x2, &y2);
sys_vgui(".x%x.c delete %s\n", cv, x->x_fgtag); //sys_vgui(".x%x.c delete %s\n", cv, x->x_fgtag);
scope_drawfgxy(x, cv, x1, y1, x2, y2); scope_drawfgxy(x, cv, x1, y1, x2, y2);
} }
static void scope_revis(t_scope *x, t_canvas *cv) static void scope_revis(t_scope *x, t_canvas *cv)
{ {
sys_vgui(".x%x.c delete %s\n", cv, x->x_tag); // sys_vgui(".x%x.c delete %s\n", cv, x->x_tag);
gui_vmess("gui_scope_clear_fg", "xx", cv, x);
if (x->x_xymode) if (x->x_xymode)
scope_drawxy(x, cv); scope_drawxy(x, cv);
else else
...@@ -807,6 +874,15 @@ static void scope_vis(t_gobj *z, t_glist *glist, int vis) ...@@ -807,6 +874,15 @@ static void scope_vis(t_gobj *z, t_glist *glist, int vis)
t_canvas *cv = scope_getcanvas(x, glist); t_canvas *cv = scope_getcanvas(x, glist);
if (vis) if (vis)
{ {
int x1, y1, x2, y2;
scope_getrect(z, glist, &x1, &y1, &x2, &y2);
gui_vmess("gui_gobj_new", "xxsiii",
glist_getcanvas(glist),
x,
"obj",
x1,
y1,
glist_istoplevel(glist));
t_scopehandle *sh = (t_scopehandle *)x->x_handle; t_scopehandle *sh = (t_scopehandle *)x->x_handle;
#if FORKY_VERSION < 37 #if FORKY_VERSION < 37
rtext_new(glist, t, glist->gl_editor->e_rtext, 0); rtext_new(glist, t, glist->gl_editor->e_rtext, 0);
...@@ -823,7 +899,8 @@ static void scope_vis(t_gobj *z, t_glist *glist, int vis) ...@@ -823,7 +899,8 @@ static void scope_vis(t_gobj *z, t_glist *glist, int vis)
t_rtext *rt = glist_findrtext(glist, t); t_rtext *rt = glist_findrtext(glist, t);
if (rt) rtext_free(rt); if (rt) rtext_free(rt);
#endif #endif
sys_vgui(".x%x.c delete %s\n", cv, x->x_tag); //sys_vgui(".x%x.c delete %s\n", cv, x->x_tag);
gui_vmess("gui_gobj_erase", "xx", glist_getcanvas(glist), x);
x->x_canvas = 0; x->x_canvas = 0;
} }
} }
...@@ -872,12 +949,14 @@ static void scope_setxymode(t_scope *x, int xymode) ...@@ -872,12 +949,14 @@ static void scope_setxymode(t_scope *x, int xymode)
t_canvas *cv; t_canvas *cv;
if (cv = scope_isvisible(x)) if (cv = scope_isvisible(x))
{ {
sys_vgui(".x%x.c delete %s\n", cv, x->x_fgtag); //sys_vgui(".x%x.c delete %s\n", cv, x->x_fgtag);
gui_vmess("gui_scope_clear_fg", "xx", cv, x);
if (!xymode) if (!xymode)
{ {
int x1, y1, x2, y2; int x1, y1, x2, y2;
scope_getrect((t_gobj *)x, x->x_glist, &x1, &y1, &x2, &y2); scope_getrect((t_gobj *)x, x->x_glist, &x1, &y1, &x2, &y2);
scope_drawfgmono(x, cv, x1, y1, x2, y2); //scope_drawfgmono(x, cv, x1, y1, x2, y2);
scope_redrawmono(x, cv);
} }
} }
x->x_xymode = xymode; x->x_xymode = xymode;
...@@ -903,68 +982,101 @@ static void scopehandle__clickhook(t_scopehandle *sh, t_floatarg f, t_floatarg x ...@@ -903,68 +982,101 @@ static void scopehandle__clickhook(t_scopehandle *sh, t_floatarg f, t_floatarg x
t_scope *x = sh->h_master; t_scope *x = sh->h_master;
if (xxx) x->scale_offset_x = xxx; // if (xxx) x->scale_offset_x = xxx;
if (yyy) x->scale_offset_y = yyy; // if (yyy) x->scale_offset_y = yyy;
int newstate = (int)f; // int newstate = (int)f;
if (sh->h_dragon && newstate == 0) // if (sh->h_dragon && newstate == 0)
{ // {
/* done dragging */ // /* done dragging */
t_canvas *cv; // t_canvas *cv;
if (sh->h_dragx || sh->h_dragy) { // if (sh->h_dragx || sh->h_dragy) {
x->x_width = x->x_width + sh->h_dragx - x->scale_offset_x; // x->x_width = x->x_width + sh->h_dragx - x->scale_offset_x;
x->x_height = x->x_height + sh->h_dragy - x->scale_offset_y; // x->x_height = x->x_height + sh->h_dragy - x->scale_offset_y;
} // }
if (cv = scope_isvisible(x)) // if (cv = scope_isvisible(x))
{ // {
sys_vgui(".x%x.c delete %s\n", cv, sh->h_outlinetag); // sys_vgui(".x%x.c delete %s\n", cv, sh->h_outlinetag);
scope_revis(x, cv); // scope_revis(x, cv);
sys_vgui("destroy %s\n", sh->h_pathname); // sys_vgui("destroy %s\n", sh->h_pathname);
scope_select((t_gobj *)x, x->x_glist, 1); // scope_select((t_gobj *)x, x->x_glist, 1);
canvas_fixlinesfor(x->x_glist, (t_text *)x); /* 2nd inlet */ // canvas_fixlinesfor(x->x_glist, (t_text *)x); /* 2nd inlet */
} // }
} // }
else if (!sh->h_dragon && newstate) // else if (!sh->h_dragon && newstate)
{ // {
/* dragging */ // /* dragging */
t_canvas *cv; // t_canvas *cv;
if (cv = scope_isvisible(x)) // if (cv = scope_isvisible(x))
{ // {
int x1, y1, x2, y2; // int x1, y1, x2, y2;
scope_getrect((t_gobj *)x, x->x_glist, &x1, &y1, &x2, &y2); // scope_getrect((t_gobj *)x, x->x_glist, &x1, &y1, &x2, &y2);
sys_vgui("lower %s\n", sh->h_pathname); // sys_vgui("lower %s\n", sh->h_pathname);
sys_vgui(".x%x.c create rectangle %d %d %d %d\ // sys_vgui(".x%x.c create rectangle %d %d %d %d\
-outline $select_color -width %f -tags %s\n", // -outline $select_color -width %f -tags %s\n",
cv, x1, y1, x2, y2, SCOPE_SELBDWIDTH, sh->h_outlinetag); // cv, x1, y1, x2, y2, SCOPE_SELBDWIDTH, sh->h_outlinetag);
} // }
sh->h_dragx = 0; // sh->h_dragx = 0;
sh->h_dragy = 0; // sh->h_dragy = 0;
} // }
sh->h_dragon = newstate; sh->h_dragon = f;
} }
static void scopehandle__motionhook(t_scopehandle *sh, static void scopehandle__motionhook(t_scopehandle *sh,
t_floatarg f1, t_floatarg f2) t_floatarg mouse_x, t_floatarg mouse_y)
{ {
if (sh->h_dragon) t_scope *x = (t_scope *)(sh->h_master);
{ int x1, y1, x2, y2, width, height;
t_scope *x = sh->h_master; scope_getrect((t_gobj *)x, x->x_glist, &x1, &y1, &x2, &y2);
int dx = (int)f1, dy = (int)f2; width = mouse_x - x1;
int x1, y1, x2, y2, newx, newy; height = mouse_y - y1;
scope_getrect((t_gobj *)x, x->x_glist, &x1, &y1, &x2, &y2); x->x_width = width < SCOPE_MINWIDTH ? SCOPE_MINWIDTH : width;
newx = x2 - x->scale_offset_x + dx; x->x_height = height < SCOPE_MINHEIGHT ? SCOPE_MINHEIGHT : height;
newy = y2 - x->scale_offset_y + dy;
if (newx > x1 + SCOPE_MINWIDTH && newy > y1 + SCOPE_MINHEIGHT) /* This is just a quick and dirty way to redraw, which has the side
{ effect of erasing the waveform until the next tick. For a more elegant
t_canvas *cv; approach we'd want to call the "revis" function, but that would also
if (cv = scope_isvisible(x)) require an extra gui function for changing the size of the background. */
sys_vgui(".x%x.c coords %s %d %d %d %d\n", if (glist_isvisible(x->x_glist))
cv, sh->h_outlinetag, x1, y1, newx, newy); {
sh->h_dragx = dx; scope_vis((t_gobj *)x, x->x_glist, 0);
sh->h_dragy = dy; scope_vis((t_gobj *)x, x->x_glist, 1);
}
} }
// if (sh->h_dragon)
// {
// t_scope *x = sh->h_master;
// int dx = (int)f1, dy = (int)f2;
// int x1, y1, x2, y2, newx, newy;
// scope_getrect((t_gobj *)x, x->x_glist, &x1, &y1, &x2, &y2);
// newx = x2 - x->scale_offset_x + dx;
// newy = y2 - x->scale_offset_y + dy;
//
// if (newx > x1 + SCOPE_MINWIDTH && newy > y1 + SCOPE_MINHEIGHT)
// {
// t_canvas *cv;
// if (cv = scope_isvisible(x))
// sys_vgui(".x%x.c coords %s %d %d %d %d\n",
// cv, sh->h_outlinetag, x1, y1, newx, newy);
// sh->h_dragx = dx;
// sh->h_dragy = dy;
// }
// }
}
/* 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);
}
/* another wrapper for forwarding "scopehandle" motion data */
static void scope_motion_for_resizing(t_scope *x, t_floatarg xxx,
t_floatarg yyy)
{
t_scopehandle *sh = (t_scopehandle *)x->x_handle;
scopehandle__motionhook(sh, xxx, yyy);
} }
static void scope_free(t_scope *x) static void scope_free(t_scope *x)
...@@ -1061,6 +1173,14 @@ void Scope_tilde_setup(void) ...@@ -1061,6 +1173,14 @@ void Scope_tilde_setup(void)
class_addmethod(scope_class, (t_method)scope_click, class_addmethod(scope_class, (t_method)scope_click,
gensym("click"), gensym("click"),
A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); 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_addmethod(scope_class, (t_method)scope_motion_for_resizing,
gensym("_motion_for_resizing"),
A_FLOAT, A_FLOAT, 0);
class_setwidget(scope_class, &scope_widgetbehavior); class_setwidget(scope_class, &scope_widgetbehavior);
forky_setsavefn(scope_class, scope_save); forky_setsavefn(scope_class, scope_save);
scopehandle_class = class_new(gensym("_scopehandle"), 0, 0, scopehandle_class = class_new(gensym("_scopehandle"), 0, 0,
......
...@@ -97,7 +97,7 @@ static t_int *cycle_perform(t_int *w) ...@@ -97,7 +97,7 @@ static t_int *cycle_perform(t_int *w)
t_float *addr, f1, f2, frac; t_float *addr, f1, f2, frac;
double dphase = x->x_phase + SHARED_UNITBIT32; double dphase = x->x_phase + SHARED_UNITBIT32;
double conv = x->x_conv; double conv = x->x_conv;
int32_t normhipart; int32 normhipart;
t_shared_wrappy wrappy; t_shared_wrappy wrappy;
wrappy.w_d = SHARED_UNITBIT32; wrappy.w_d = SHARED_UNITBIT32;
......
...@@ -31,7 +31,7 @@ static t_int *rand_perform(t_int *w) ...@@ -31,7 +31,7 @@ static t_int *rand_perform(t_int *w)
double ph = x->x_nextphase; double ph = x->x_nextphase;
double tfph = ph + SHARED_UNITBIT32; double tfph = ph + SHARED_UNITBIT32;
t_shared_wrappy wrappy; t_shared_wrappy wrappy;
int32_t normhipart; int32 normhipart;
float rcpsr = x->x_rcpsr; float rcpsr = x->x_rcpsr;
float target = x->x_target; float target = x->x_target;
float scaling = x->x_scaling; float scaling = x->x_scaling;
......
...@@ -39,7 +39,7 @@ static t_int *train_perform(t_int *w) ...@@ -39,7 +39,7 @@ static t_int *train_perform(t_int *w)
double ph = x->x_phase; double ph = x->x_phase;
double tfph = ph + SHARED_UNITBIT32; double tfph = ph + SHARED_UNITBIT32;
t_shared_wrappy wrappy; t_shared_wrappy wrappy;
int32_t normhipart; int32 normhipart;
int on = x->x_on; int on = x->x_on;
int edge = 0; int edge = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment