Commit f46ddd64 authored by Jonathan Wilkes's avatar Jonathan Wilkes

Merge branch 'update-cyclone'

parents 5bfda305 7976cc61
......@@ -16,3 +16,6 @@
[submodule "externals/lyonpotpourri"]
path = externals/lyonpotpourri
url = https://github.com/ericlyon/lyonpotpourri3.0.git
[submodule "externals/cyclone"]
path = externals/cyclone
url = https://git.purrdata.net/jwilkes/pd-cyclone.git
......@@ -431,16 +431,26 @@ cxc_clean:
#------------------------------------------------------------------------------#
# CYCLONE
cyclone:
make -C $(externals_src)/miXed/cyclone -f Makefile.libdir \
PD_PATH=$(pd_src) PD_INCLUDE=$(DESTDIR)$(includedir)
ifeq ($(OS_NAME),windows)
make -C $(externals_src)/cyclone \
pdbinpath=$(pd_src)/src PDINCLUDEDIR=$(DESTDIR)$(includedir)
else
make -C $(externals_src)/cyclone \
PDDIR=$(pd_src)
endif
cyclone_install:
make -C $(externals_src)/miXed/cyclone -f Makefile.libdir \
make -C $(externals_src)/cyclone \
DESTDIR="$(DESTDIR)" objectsdir="$(objectsdir)" \
install
install -p $(externals_src)/cyclone/documentation/purr_help/*.pd \
$(DESTDIR)$(objectsdir)/cyclone
install -p \
$(externals_src)/cyclone/documentation/purr_help/abs_GUI/*.pd \
$(DESTDIR)$(objectsdir)/cyclone
cyclone_clean:
make -C $(externals_src)/miXed/cyclone -f Makefile.libdir \
make -C $(externals_src)/cyclone \
clean
#------------------------------------------------------------------------------#
......
Subproject commit 35e62cb06b0003d174aa7fb387ff782c9970cb9f
......@@ -350,18 +350,18 @@ static void grid_properties(t_gobj *z, t_glist *owner)
gui_start_vmess("gui_external_dialog", "ss", gfx_tag, "grid");
gui_start_array();
gui_s("receive_symbol"); gui_s(x->x_name->s_name);
gui_s("width"); gui_i(x->x_width);
gui_s("min"); gui_f(x->x_min);
gui_s("max"); gui_f(x->x_max);
gui_s("height"); gui_i(x->x_height);
gui_s("y-min"); gui_f(x->y_min);
gui_s("y-max"); gui_f(x->y_max);
gui_s("grid_toggle"); gui_i(x->x_grid);
gui_s("x-steps"); gui_f(x->x_xstep);
gui_s("y-steps"); gui_f(x->x_ystep);
gui_s("x-lines"); gui_i(x->x_xlines);
gui_s("y-lines"); gui_i(x->x_ylines);
gui_s("symbol"); gui_s("receive_symbol"); gui_s(x->x_name->s_name);
gui_s("int"); gui_s("width"); gui_i(x->x_width);
gui_s("int"); gui_s("min"); gui_f(x->x_min);
gui_s("float"); gui_s("max"); gui_f(x->x_max);
gui_s("int"); gui_s("height"); gui_i(x->x_height);
gui_s("float"); gui_s("y-min"); gui_f(x->y_min);
gui_s("float"); gui_s("y-max"); gui_f(x->y_max);
gui_s("toggle"); gui_s("show_grid"); gui_i(x->x_grid);
gui_s("float"); gui_s("x-steps"); gui_f(x->x_xstep);
gui_s("float"); gui_s("y-steps"); gui_f(x->x_ystep);
gui_s("int"); gui_s("x-lines"); gui_i(x->x_xlines);
gui_s("int"); gui_s("y-lines"); gui_i(x->x_ylines);
gui_end_array();
gui_end_vmess();
......@@ -450,6 +450,11 @@ static void grid_displace(t_gobj *z, t_glist *glist, int dx, int dy)
x->y_current += dy;
if (xold != text_xpix(&x->x_obj, glist) || yold != text_ypix(&x->x_obj, glist))
{
gui_vmess("gui_text_displace", "xxii",
glist,
x,
dx,
dy);
//grid_draw_move(x, x->x_glist);
canvas_fixlinesfor(glist, (t_text *)z);
}
......@@ -882,10 +887,10 @@ void grid_setup(void)
/* Big hack for receiving edit-mode resize anchor clicks from
g_editor.c. */
class_addmethod(grid_class, (t_method)grid_click_for_resizing,
gensym("_click_for_resizing"),
gensym("_click"),
A_FLOAT, A_FLOAT, A_FLOAT, 0);
class_addmethod(grid_class, (t_method)grid_motion_for_resizing,
gensym("_motion_for_resizing"),
gensym("_motion"),
A_FLOAT, A_FLOAT, 0);
grid_widgetbehavior.w_getrectfn = grid_getrect;
grid_widgetbehavior.w_displacefn = grid_displace;
......
......@@ -86,30 +86,31 @@ function ok() {
// value: a value for the input
function parse_attrs(attrs) {
var ret = [],
elem;
attrs.forEach(function(token, i) {
if (i % 2 === 0) {
elem = {};
token = token.split("_");
if (token.length > 1) {
elem.type = token[token.length - 1];
if (elem.type !== "symbol" &&
elem.type !== "toggle") {
// no suffix defaults to "number"
elem.type = "number";
elem,
gate = false;
attrs.forEach(function(attr, i) {
if (i % 3 === 0) {
elem = gate ? elem : {};
gate = attr === "enum";
elem.type = attr;
} else if (i % 3 === 1) {
elem.name = attr;
elem.label = attr.replace("_", " ");
} else {
if (elem.type === "enum") {
if (elem.options) {
elem.options.push(attr);
} else {
// remove the type suffix
token = token.slice(0, -1);
elem.options = [attr];
}
} else {
elem.type = "number";
elem.value = attr;
}
elem.name = token.join("_");
elem.label = token.join(" ");
} else {
elem.value = token;
// now push the object onto the array
ret.push(elem);
if (elem.type !== "enum") {
elem.type = elem.type === "enum_index" ? "enum" : elem.type;
ret.push(elem);
}
}
});
return ret;
......@@ -134,7 +135,6 @@ function register_window_id(gfxstub, args) {
translate_form();
build_form(external_name, array_of_objects);
// We don't turn on rendering of the "container" div until
// We've finished displaying all the spans and populating the
// labels and form elements. That makes it more efficient and
......@@ -160,7 +160,10 @@ function translate_form() {
function get_input_type(t) {
return t === "symbol" ? "text" :
t === "number" ? "text" :
t === "int" ? "text" :
t === "float" ? "text" :
t === "color" ? "color" :
t === "enum" ? "select" :
t === "toggle" ? "checkbox":
"text";
}
......@@ -168,23 +171,39 @@ function get_input_type(t) {
function build_form(external_name, array_of_objects) {
var fieldset = document.querySelector("fieldset");
document.querySelector("legend").textContent = external_name;
array_of_objects.forEach(function(elem) {
var input_elem = document.createElement("input"),
label = document.createElement("label");
input_elem.type = get_input_type(elem.type);
if (input_elem.type === "checkbox") {
input_elem.checked = elem.value !== 0;
input_elem.onchange = function() {
elem.value = input_elem.checked ? 1 : 0;
array_of_objects.forEach(function(ob) {
var elem,
label,
type = get_input_type(ob.type);
if (type === "select") {
elem = document.createElement("select");
ob.options.forEach(function(e) {
var option = document.createElement("option");
option.textContent = e;
elem.appendChild(option);
});
elem.selectedIndex = ob.value;
elem.onchange = function() {
ob.value = elem.selectedIndex;
}
} else if (type === "checkbox") {
elem = document.createElement("input");
elem.type = "checkbox";
elem.checked = ob.value !== 0;
elem.onchange = function() {
ob.value = elem.checked ? 1 : 0;
};
} else {
input_elem.value = elem.value;
input_elem.onchange = function() {
elem.value = input_elem.value;
elem = document.createElement("input");
elem.type = type;
elem.value = ob.value;
elem.onchange = function() {
ob.value = elem.value;
}
}
label.textContent = elem.label;
label.appendChild(input_elem);
label = document.createElement("label");
label.textContent = ob.label;
label.appendChild(elem);
fieldset.appendChild(label);
// stop-gap until we make this prettier through css: insert a break
fieldset.appendChild(document.createElement("br"));
......
......@@ -3751,6 +3751,7 @@ function gui_scope_draw_bg(cid, tag, fg_color, bg_color, w, h, grid_width, dx, d
path_string = "",
fg_xy_path, // to be used for the foreground lines
fg_mono_path,
border,
i, x, y, align_x, align_y;
// Path strings for the grid lines
// vertical lines...
......@@ -3767,6 +3768,7 @@ function gui_scope_draw_bg(cid, tag, fg_color, bg_color, w, h, grid_width, dx, d
d: path_string,
fill: "none",
stroke: "black",
class: "grid",
"stroke-width": grid_width,
});
// We go ahead and create a path to be used in the foreground. We'll
......@@ -3783,10 +3785,18 @@ function gui_scope_draw_bg(cid, tag, fg_color, bg_color, w, h, grid_width, dx, d
stroke: fg_color,
class: "fgmono"
});
border = create_item(cid, "rect", {
style: "fill: none;",
width: w,
height: h,
class: "border",
"stroke-width": grid_width
});
g.appendChild(bg);
g.appendChild(path);
g.appendChild(fg_xy_path);
g.appendChild(fg_mono_path);
g.appendChild(border);
}
function scope_configure_fg(cid, tag, type, data_array) {
......@@ -3805,13 +3815,13 @@ function gui_scope_configure_fg_mono(cid, tag, data_array) {
scope_configure_fg(cid, tag, ".fgmono", data_array);
}
function gui_scope_configure_bg_color(cid, tag, color) {
function scope_configure_bg_color(cid, tag, color) {
var g = get_gobj(cid, tag),
elem = g.querySelector(".bg");
configure_item(elem, { fill: color });
}
function gui_scope_configure_fg_color(cid, tag, color) {
function scope_configure_fg_color(cid, tag, color) {
var g = get_gobj(cid, tag),
xy = g.querySelector(".fgxy"),
mono = g.querySelector(".fgmono");
......@@ -3819,11 +3829,33 @@ function gui_scope_configure_fg_color(cid, tag, color) {
configure_item(mono, { stroke: color });
}
function scope_configure_grid_color(cid, tag, color) {
var g = get_gobj(cid, tag),
grid = g.querySelector(".grid");
configure_item(grid, { stroke: color });
}
function gui_scope_configure_color(cid, tag, layer, color) {
if (layer === "fg") {
scope_configure_fg_color(cid, tag, color);
} else if (layer === "bg") {
scope_configure_bg_color(cid, tag, color);
} else if (layer === "grid") {
scope_configure_grid_color(cid, tag, color);
}
}
function gui_scope_clear_fg(cid, tag) {
scope_configure_fg(cid, tag, ".fgxy", []);
scope_configure_fg(cid, tag, ".fgmono", []);
}
function gui_scope_erase_innards(cid, tag) {
var g = get_gobj(cid, tag);
// Nuke it
g.innerHTML = '';
}
// unauthorized/grid
function get_grid_data(w, h, x_l, y_l) {
......
......@@ -3307,7 +3307,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which,
int noutlet;
int ninlet;
/* resize? only for "true" text boxes, canvases, iemguis,
and -- using an awful hack-- for the Scope~ and grid
and -- using an awful hack-- for the scope~ and grid
objects by checking for the class name below.
One exception-- my_canvas. It has a weirdo interface
......@@ -3320,7 +3320,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which,
*/
if (ob && (ob->te_iemgui
&& pd_class((t_pd *)ob) != my_canvas_class
|| pd_class(&ob->te_pd)->c_name == gensym("Scope~")
|| pd_class(&ob->te_pd)->c_name == gensym("scope~")
|| pd_class(&ob->te_pd)->c_name == gensym("grid"))
&& xpos >= x2-4 && ypos > y2-6)
{
......@@ -3339,7 +3339,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which,
}
else
{
pd_vmess((t_pd *)ob, gensym("_click_for_resizing"),
pd_vmess((t_pd *)ob, gensym("_click"),
"fff", (t_float)1, (t_float)xpos, (t_float)ypos);
}
}
......@@ -5277,10 +5277,10 @@ void canvas_motion(t_canvas *x, t_floatarg xpos, t_floatarg ypos,
pd_vmess(sh, gensym("_motion"), "ff", (t_float)xpos, (t_float)ypos);
//pd_vmess(sh, gensym("_click"), "fff", 0, xpos, ypos);
}
else if (ob && (pd_class(&ob->te_pd)->c_name == gensym("Scope~")
else if (ob && (pd_class(&ob->te_pd)->c_name == gensym("scope~")
|| pd_class(&ob->te_pd)->c_name == gensym("grid")))
{
pd_vmess((t_pd *)ob, gensym("_motion_for_resizing"),
pd_vmess((t_pd *)ob, gensym("_motion"),
"ff", (t_float)xpos, (t_float)ypos);
}
else post("not resizable");
......
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