...
 
Commits (23)
......@@ -216,9 +216,9 @@ $(debsrc):
git archive --format=tar.gz --prefix=$(debdist)/ HEAD | tar xfz -
# Grab the submodules.
for x in $(submodules); do (cd $(debdist) && rm -rf $$x && git -C ../$$x archive --format=tar.gz --prefix=$$x/ HEAD | tar xfz -); done
# Pre-generate and put s_stuff.h into the tarball (see above; the build
# Pre-generate and put s_version.h into the tarball (see above; the build
# version is generated using git which can't be done outside the git repo).
sed 's|^\(#define PD_BUILD_VERSION "\).*"|\1$(PD_BUILD_VERSION)"|' pd/src/s_stuff.h.in > $(debdist)/pd/src/s_stuff.h
sed 's|^\(#define PD_BUILD_VERSION "\).*"|\1$(PD_BUILD_VERSION)"|' pd/src/s_version.h.in > $(debdist)/pd/src/s_version.h
# Create the source tarball.
tar cfz $(debsrc) $(debdist)
rm -rf $(debdist)
......@@ -99,7 +99,7 @@ Packages for Gnu/Linux, Windows, and OSX:
### Build Guide
**NOTE:** The instructions below talk about running the `tar_em_up.sh` build
**NOTE:** The instructions for Windows and OSX below talk about running the `tar_em_up.sh` build
script, which is still the recommended way to build Purr Data right now.
However, Purr Data also has a new (and experimental) toplevel Makefile so that
just typing `make` will build the package. You may find this easier. The
......@@ -263,7 +263,7 @@ that case, but I haven't tested doing it like that. Sorry. Get a better OS...)
./tar_em_up.sh -Z
8. Look in purr-data/packages/win32_inno/Output and click the setup file to
8. Look in the top level directory of the Git repository and click the setup file to
start installing Purr Data to your machine.
### Code of Conduct
......@@ -300,6 +300,9 @@ Contributing is easy:
in the Gitlab UI so we can merge the fix for the next release.
A few guidelines:
* There should be a short and clear commit message for each merge request.
* Short and clear title and description are required for each merge request.
* There should be a short branch name related to the issue, like "update-readme".
* _No prototypes, please_. Purr Data's biggest strength is that users can
turn an idea into working code very quickly. But a prototyping language that
is itself a prototype isn't very useful. That means Purr Data's core code
......
......@@ -103,9 +103,9 @@ $(debsrc):
git -C .. archive --format=tar.gz --prefix=$(debdist)/ HEAD | tar xfz -
# Grab the submodules.
for x in $(submodules); do (cd $(debdist) && rm -rf $$x && git -C ../../$$x archive --format=tar.gz --prefix=$$x/ HEAD | tar xfz -); done
# Pre-generate and put s_stuff.h into the tarball (see above; the build
# Pre-generate and put s_version.h into the tarball (see above; the build
# version is generated using git which can't be done outside the git repo).
sed 's|^\(#define PD_BUILD_VERSION "\).*"|\1$(PD_BUILD_VERSION)"|' ../pd/src/s_stuff.h.in > $(debdist)/pd/src/s_stuff.h
sed 's|^\(#define PD_BUILD_VERSION "\).*"|\1$(PD_BUILD_VERSION)"|' ../pd/src/s_version.h.in > $(debdist)/pd/src/s_version.h
# Create the source tarball.
tar cfz $(debsrc) $(debdist)
rm -rf $(debdist)
......
......@@ -297,12 +297,13 @@ then
# s_stuff.h when we copy it below. XXXNOTE AG: The build seems
# to work just fine even when skipping all this, so why again
# is this needed?
test -f ../../pd/src/s_stuff.h || make -C .. git_version
test -f ../../pd/src/s_version.h || make -C .. git_version
cp ../../pd/src/g_all_guis.h ../../externals/build/include
cp ../../pd/src/g_canvas.h ../../externals/build/include
cp ../../pd/src/m_imp.h ../../externals/build/include
cp ../../pd/src/m_pd.h ../../externals/build/include
cp ../../pd/src/s_stuff.h ../../externals/build/include
cp ../../pd/src/s_version.h ../../externals/build/include
cp ../../pd/src/g_all_guis.h ../../externals/build/include
rm -rf build/
fi
......
......@@ -374,16 +374,16 @@ doc_format:
# AG: The set_version target is broken since it modifies m_pd.h in-place
# during the build, which is a bad thing to do to files which are supposed to
# be kept in a source code repository. Instead, we create s_stuff.h from
# s_stuff.h.in, where the latter is kept in the repo and the former gets
# be kept in a source code repository. Instead, we create s_version.h from
# s_version.h.in, where the latter is kept in the repo and the former gets
# created from the latter by substituting PD_BUILD_VERSION. NOTE: This may
# fail if we're building in a static tarball snapshop of the repo, in which
# case we assume that a pre-generated s_stuff.h is supplied.
# case we assume that a pre-generated s_version.h is supplied.
git_version: $(pd_src)/src/s_stuff.h.in
git_version: $(pd_src)/src/s_version.h.in
@test -d $(cvs_root_dir)/.git && cd $(pd_src)/src/ && \
sed 's|^\(#define PD_BUILD_VERSION "\).*"|\1$(PD_BUILD_VERSION)"|' s_stuff.h.in > s_stuff.h.new && \
(test -f s_stuff.h && diff -q s_stuff.h s_stuff.h.new > /dev/null && rm -f s_stuff.h.new && echo s_stuff.h unchanged || (rm -f s_stuff.h && mv s_stuff.h.new s_stuff.h)) || test -f $(pd_src)/src/s_stuff.h
sed 's|^\(#define PD_BUILD_VERSION "\).*"|\1$(PD_BUILD_VERSION)"|' s_version.h.in > s_version.h.new && \
(test -f s_version.h && diff -q s_version.h s_version.h.new > /dev/null && rm -f s_version.h.new && echo s_version.h unchanged || (rm -f s_version.h && mv s_version.h.new s_version.h)) || test -f $(pd_src)/src/s_version.h
set_version:
# change Pd's version number to reflect the extended build
......
......@@ -46,10 +46,10 @@ endif
@echo " "
@echo "win32_inno install succeeded!"
git_version: $(pd_src)/src/s_stuff.h.in
git_version: $(pd_src)/src/s_version.h.in
@cd $(pd_src)/src/ && \
sed 's|^\(#define PD_BUILD_VERSION "\).*"|\1$(PD_BUILD_VERSION)"|' s_stuff.h.in > s_stuff.h.new && \
(test -f s_stuff.h && diff -q s_stuff.h s_stuff.h.new > /dev/null && rm -f s_stuff.h.new && echo s_stuff.h unchanged || (rm -f s_stuff.h && mv s_stuff.h.new s_stuff.h))
sed 's|^\(#define PD_BUILD_VERSION "\).*"|\1$(PD_BUILD_VERSION)"|' s_version.h.in > s_version.h.new && \
(test -f s_version.h && diff -q s_version.h s_version.h.new > /dev/null && rm -f s_version.h.new && echo s_version.h unchanged || (rm -f s_version.h && mv s_version.h.new s_version.h))
build_pd: git_version
cd $(pd_src)/src && $(MAKE) -f makefile.mingw
......
......@@ -554,7 +554,6 @@ function apply() {
// If this is a dialog to create a new array
// skip the canvas dialog callback
if (!new_array_dialog) {
// Note: the "+" casts Boolean to Number
gop = +get_input("gop");
hide_name = +get_input("hide_name");
......
......@@ -385,6 +385,17 @@
<input type="checkbox" id="save_zoom" name="save_zoom">
<span data-i18n="prefs.gui.zoom.save_zoom"></span>
</label>
<br/>
<label data-i18n="[title]prefs.gui.autopatch_yoffset_checkbox_tt">
<input type="checkbox" id="autopatch_yoffset"
name="autopatch_yoffset"
onchange="autopatch_yoffset_toggle(this.checked);">
<span data-i18n="prefs.gui.autopatch_yoffset"></span></span>:
</label>
<input type="text"
id="autopatch_yoffset_value"
name="autopatch_yoffset_value"
data-i18n="[title]prefs.gui.autopatch_yoffset_tt">
<br/><br/>
<span data-i18n="prefs.gui.browser.browser_title"></span>
<br/>
......@@ -500,6 +511,14 @@ function get_bool_elem(elem) {
return +document.getElementById(elem).checked;
}
function get_autopatch_yoffset() {
if (get_bool_elem("autopatch_yoffset")) {
return document.getElementById("autopatch_yoffset_value").value;
} else {
return "0";
}
}
// startup config data
// XXXTODO: We should maybe include these in the dialog, but the startup tab
......@@ -721,7 +740,14 @@ function apply(save_prefs) {
// Send the gui prefs (currently just the name of the gui preset, the
// status of the save-zoom toggle and various options related to the help
// browser) to Pd
pdgui.pdsend("pd gui-prefs", get_gui_preset(), get_bool_elem("save_zoom"), get_bool_elem("browser_doc"), get_bool_elem("browser_path"), get_bool_elem("browser_init"));
pdgui.pdsend("pd gui-prefs",
get_gui_preset(),
get_bool_elem("save_zoom"),
get_bool_elem("browser_doc"),
get_bool_elem("browser_path"),
get_bool_elem("browser_init"),
get_autopatch_yoffset()
);
// Send the startup config data to Pd
pdgui.pdsend.apply(null, ["pd path-dialog", startup_use_stdpath, startup_verbose].concat(get_path_array()));
......@@ -960,7 +986,13 @@ function midi_prefs_callback(attrs) {
pdgui.resize_window(pd_object_callback);
}
function gui_prefs_callback(name, save_zoom, browser_doc, browser_path, browser_init) {
function autopatch_yoffset_toggle(checked) {
document.getElementById("autopatch_yoffset_value").disabled = !checked;
document.getElementById("autopatch_yoffset").checked = checked;
}
function gui_prefs_callback(name, save_zoom, browser_doc, browser_path,
browser_init, autopatch_yoffset) {
var s = document.getElementById("gui_preset"),
i;
for (i = 0; i < s.options.length; i++) {
......@@ -973,6 +1005,14 @@ function gui_prefs_callback(name, save_zoom, browser_doc, browser_path, browser_
document.getElementById("browser_doc").checked = !!browser_doc;
document.getElementById("browser_path").checked = !!browser_path;
document.getElementById("browser_init").checked = !!browser_init;
if (+autopatch_yoffset !== 0) {
document.getElementById("autopatch_yoffset_value").value =
autopatch_yoffset;
autopatch_yoffset_toggle(true);
} else {
autopatch_yoffset_toggle(false);
}
}
// startup settings
......
......@@ -640,6 +640,7 @@ function nw_create_pd_window_menus(gui, w) {
minit(m.put.number, { enabled: false });
minit(m.put.symbol, { enabled: false });
minit(m.put.comment, { enabled: false });
minit(m.put.dropdown, { enabled: false });
minit(m.put.bang, { enabled: false });
minit(m.put.toggle, { enabled: false });
minit(m.put.number2, { enabled: false });
......
......@@ -389,6 +389,9 @@
"del_tt": "Lösche das ausgewählte Element"
},
"gui": {
"autopatch_yoffset_tt": "Abstand in Pixeln von der Unterseite des Objekts, mit dem das neue Objekt verbunden wird",
"autopatch_yoffset": "Autopatching-Abstand",
"autopatch_yoffset_checkbox_tt": "Aktiviere den benutzerdefinierten vertikalen Autopatching-Abstand",
"presets": {
"gui_preset": "GUI-Preset",
"gui_preset_tt": "Kollektion von Patch-Farben und -Stilen",
......
......@@ -390,6 +390,9 @@
"del_tt": "Delete the selected item"
},
"gui": {
"autopatch_yoffset_tt": "specify a distance in pixels from the bottom of the object to which the new object will be connected",
"autopatch_yoffset": "custom autopatching y-offset",
"autopatch_yoffset_checkbox_tt": "check to enable a custom autopatching y-offset",
"presets": {
"gui_preset": "GUI preset",
"gui_preset_tt": "Collection of patch colors and styles",
......
......@@ -157,7 +157,7 @@ var canvas_events = (function() {
two = text.charAt(1);
return (one === "#" && (two === "N" || two === "X"));
},
grow_svg_for_element= function(elem) {
grow_svg_for_element = function(elem) {
// See if an element overflows the svg bbox, and
// enlarge the svg to accommodate it.
// Note: window.scrollX and window.scrollY might not work
......@@ -817,6 +817,59 @@ var canvas_events = (function() {
close_save_dialog: function() {
document.getElementById("save_before_quit").close();
},
paste_from_pd_file: function(name, clipboard_data) {
var line, lines, i, pd_message;
// This lets the user copy some Pd source file from another
// application and paste the code directly into a canvas window
// (empty or otherwise). It does a quick check to make sure the OS
// clipboard is holding text that could conceivably be Pd source
// code. But that's not 100% foolproof and the engine might crash
// and burn, so be careful! :)
// We only want to check the external buffer and/or send a "paste"
// event to Pd if the canvas is in a "normal" state.
if (canvas_events.get_state() !== "normal") {
return;
}
if (!might_be_a_pd_file(clipboard_data)) {
pdgui.post("paste error: clipboard doesn't appear to contain valid Pd code");
return;
}
// clear the buffer
pdgui.pdsend(name, "copyfromexternalbuffer");
pd_message = "";
lines = clipboard_data.split("\n");
for (i = 0; i < lines.length; i++) {
line = lines[i];
// process pd_message if it ends with a semicolon that
// isn't preceded by a backslash
if (line.slice(-1) === ";" &&
(line.length < 2 || line.slice(-2, -1) !== "\\")) {
if (pd_message === "") {
pd_message = line;
} else {
pd_message = pd_message + " " + line;
}
pdgui.pdsend(name, "copyfromexternalbuffer", pd_message);
pd_message = "";
} else {
pd_message = pd_message + " " + line;
pd_message = pd_message.replace(/\n/g, "");
}
}
// This signals to the engine that we're done filling the external
// buffer, that it can do necessary checks and call some internal
// cleanup code.
pdgui.pdsend(name, "copyfromexternalbuffer");
// Send a canvas "paste" message to Pd
pdgui.pdsend(name, "paste");
// Finally, make sure to reset the buffer so that next time around
// we start from a clean slate. (Otherwise, the engine will just
// add stuff to the existing buffer contents.)
pdgui.pdsend(name, "reset_copyfromexternalbuffer");
},
init: function() {
document.getElementById("saveDialog")
.setAttribute("nwworkingdir", pdgui.get_pwd());
......@@ -1149,60 +1202,6 @@ function instantiate_live_box() {
}
}
function canvas_paste_from_clipboard(name, clipboard_data)
{
var line, lines, i, pd_message;
// This lets the user copy some Pd source file from another application
// and paste the code directly into a canvas window (empty or otherwise).
// It does a quick check to make sure the OS clipboard is holding text
// that could conceivably be Pd source code. But that's not 100% foolproof
// and if it's not then the engine might crash and burn, so be careful! :)
// We only want to check the external buffer and/or send a "paste" event
// to Pd if the canvas is in a "normal" state.
if (canvas_events.get_state() !== "normal") {
return;
}
if (!might_be_a_pd_file(clipboard_data)) {
pdgui.post("paste error: clipboard doesn't appear to contain valid Pd code");
return;
}
// clear the buffer
pdgui.pdsend(name, "copyfromexternalbuffer");
pd_message = "";
lines = clipboard_data.split("\n");
for (i = 0; i < lines.length; i++) {
line = lines[i];
// process pd_message if it ends with a semicolon that
// isn't preceded by a backslash
if (line.slice(-1) === ";" &&
(line.length < 2 || line.slice(-2, -1) !== "\\")) {
if (pd_message === "") {
pd_message = line;
} else {
pd_message = pd_message + " " + line;
}
pdgui.pdsend(name, "copyfromexternalbuffer", pd_message);
pd_message = "";
} else {
pd_message = pd_message + " " + line;
pd_message = pd_message.replace(/\n/g, "");
}
}
// This signals to the engine that we're done filling the external buffer,
// that it can do necessary checks and call some internal cleanup code.
pdgui.pdsend(name, "copyfromexternalbuffer");
// Send a canvas "paste" message to Pd
pdgui.pdsend(name, "paste");
// Finally, make sure to reset the buffer so that next time around we
// start from a clean slate. (Otherwise, the engine will just add stuff to
// the existing buffer contents.)
pdgui.pdsend(name, "reset_copyfromexternalbuffer");
}
// Menus for the Patch window
var canvas_menu = {};
......@@ -1362,7 +1361,7 @@ function nw_create_patch_window_menus(gui, w, name) {
var clipboard = nw.Clipboard.get();
var text = clipboard.get('text');
//pdgui.post("** paste from clipboard: "+text);
canvas_paste_from_clipboard(name, text);
canvas_events.paste_from_pd_file(name, text);
}
});
minit(m.edit.duplicate, {
......
This diff is collapsed.
"use strict";
var cmd_or_ctrl = (process.platform === "darwin") ? "cmd" : "ctrl";
exports.menu = {
"new": { key: "n", modifiers: cmd_or_ctrl },
"open": { key: "o", modifiers: cmd_or_ctrl },
"save": { key: "s", modifiers: cmd_or_ctrl },
"saveas": { key: "s", modifiers: cmd_or_ctrl + "+shift" },
"print": { key: "p", modifiers: cmd_or_ctrl + "+shift" },
"message" : { key: "m", modifiers: cmd_or_ctrl },
"close": { key: "w", modifiers: cmd_or_ctrl },
"quit": { key: "q", modifiers: cmd_or_ctrl },
"undo": { key: "z", modifiers: cmd_or_ctrl },
"redo": { key: "z", modifiers: cmd_or_ctrl + "+shift" },
"selectall":{ key: "a", modifiers: cmd_or_ctrl },
"cut": { key: "x", modifiers: cmd_or_ctrl },
"copy": { key: "c", modifiers: cmd_or_ctrl },
"paste": { key: "v", modifiers: cmd_or_ctrl },
"paste_clipboard": { key: "v", modifiers: cmd_or_ctrl + "+alt" },
"duplicate": { key: "d", modifiers: cmd_or_ctrl },
"undo": { key: "z", modifiers: cmd_or_ctrl },
"reselect": { key: String.fromCharCode(10), modifiers: cmd_or_ctrl },
"clear_console": { key: "l", modifiers: cmd_or_ctrl + "+shift" },
"tidyup": { key: "y", modifiers: cmd_or_ctrl },
"cordinspector": { key: "r", modifiers: cmd_or_ctrl + "+shift" },
"find": { key: "f", modifiers: cmd_or_ctrl },
"findagain":{ key: "g", modifiers: cmd_or_ctrl },
"editmode": { key: "e", modifiers: cmd_or_ctrl },
"preferences": { key: (process.platform === "darwin") ? "," : "p",
modifiers: cmd_or_ctrl },
"zoomin": { key: "=", modifiers: cmd_or_ctrl },
"zoomout": { key: "-", modifiers: cmd_or_ctrl },
"zoomreset": { key: "0", modifiers: cmd_or_ctrl },
"zoomoptimal": { key: "9", modifiers: cmd_or_ctrl },
"zoomhoriz": { key: "9", modifiers: cmd_or_ctrl + "+alt" },
"zoomvert": { key: "9", modifiers: cmd_or_ctrl + "+shift" },
"fullscreen": { key: (process.platform === "darwin") ? "f" : "F11",
modifiers: (process.platform === "darwin") ? "cmd+ctrl" : null },
"object": { key: "1", modifiers: cmd_or_ctrl },
"msgbox": { key: "2", modifiers: cmd_or_ctrl },
"number": { key: "3", modifiers: cmd_or_ctrl },
"symbol": { key: "4", modifiers: cmd_or_ctrl },
"comment": { key: "5", modifiers: cmd_or_ctrl },
"dropdown": { key: "6", modifiers: cmd_or_ctrl },
"bang": { key: "b", modifiers: cmd_or_ctrl + "+shift" },
"toggle": { key: "t", modifiers: cmd_or_ctrl + "+shift" },
"number2": { key: "n", modifiers: cmd_or_ctrl + "+shift" },
"vslider": { key: "v", modifiers: cmd_or_ctrl + "+shift" },
"hslider": { key: "h", modifiers: cmd_or_ctrl + "+shift" },
"vradio": { key: "d", modifiers: cmd_or_ctrl + "+shift" },
"hradio": { key: "i", modifiers: cmd_or_ctrl + "+shift" },
"vu": { key: "u", modifiers: cmd_or_ctrl + "+shift" },
"cnv": { key: "c", modifiers: cmd_or_ctrl + "+shift" },
"nextwin": { key: "PageDown", modifiers: cmd_or_ctrl },
"prevwin": { key: "PageUp", modifiers: cmd_or_ctrl },
"pdwin": { key: "r", modifiers: cmd_or_ctrl },
"audio_on": { key: "/", modifiers: cmd_or_ctrl },
"audio_off": { key: ".", modifiers: cmd_or_ctrl },
"browser": { key: "b", modifiers: cmd_or_ctrl },
"audio_off": { key: ".", modifiers: cmd_or_ctrl },
"audio_off": { key: ".", modifiers: cmd_or_ctrl },
"audio_off": { key: ".", modifiers: cmd_or_ctrl },
}
......@@ -1764,14 +1764,6 @@ function connect_as_client() {
client.setNoDelay(true);
// uncomment the next line to use fast_parser (then set its callback below)
//client.setEncoding("utf8");
client.on("error", function(e) {
var eString = "";
Object.keys(e).forEach(function(k) {
eString += " " + k + ": " + e[k];
});
pd_window.prompt("Error:" + eString);
});
client.connect(PORT, HOST, function() {
console.log("CONNECTED TO: " + HOST + ":" + PORT);
});
......@@ -5401,9 +5393,11 @@ function gui_midi_properties(gfxstub, sys_indevs, sys_outdevs,
}
}
function gui_gui_properties(dummy, name, save_zoom, browser_doc, browser_path, browser_init) {
function gui_gui_properties(dummy, name, save_zoom, browser_doc, browser_path,
browser_init, autopatch_yoffset) {
if (dialogwin["prefs"] !== null) {
dialogwin["prefs"].window.gui_prefs_callback(name, save_zoom, browser_doc, browser_path, browser_init);
dialogwin["prefs"].window.gui_prefs_callback(name, save_zoom,
browser_doc, browser_path, browser_init, autopatch_yoffset);
}
}
......
......@@ -864,7 +864,7 @@ static int create_soundfile(t_canvas *canvas, const char *filename,
canvas_makefilename(canvas, filenamebuf, buf2, FILENAME_MAX);
sys_bashfilename(buf2, buf2);
if ((fd = open(buf2, BINCREATE, 0666)) < 0)
if ((fd = sys_open(buf2, BINCREATE, 0666)) < 0)
return (-1);
if (write(fd, headerbuf, headersize) < headersize)
......
......@@ -755,6 +755,7 @@ void garray_arraydialog(t_garray *x, t_symbol *s, int argc, t_atom *argv)
x->x_style = style;
if (size != a->a_n)
{
glist_redraw(x->x_glist);
garray_resize_long(x, size);
}
else
......@@ -764,16 +765,15 @@ void garray_arraydialog(t_garray *x, t_symbol *s, int argc, t_atom *argv)
happened to change it. Let me emphasize-- in order to
redraw array labels, we must call a function that redraws
not only the _entire_ array and its graph, but also redraws
the parent canvas in which the graph is displayed. There is
the graph in which the array is displayed. There is
no interface I can find to just say, "redraw the label".
Worse, Pd redraws a single array at least 3 times, and maybe
even the graph and the containing glist-- it's hard to tell
Worse, Pd redraws a single array at least 3 times-- hard to tell
because so much data is sent over the wire that I run out of
buffer in my terminal window. These are a side-effect of
garray_redraw, as well as the garray_resize branch above. (And
don't forget that the canvas dialog callback probably causes
as many redraws as well.)
don't forget that the canvas dialog callback causes some
of these.)
Until the Pd codebase handles redrawing in a sane fashion,
without depending on a vast array of side-effects, there's
......
......@@ -180,7 +180,7 @@ struct _glist
struct _glist *gl_owner; /* parent glist, supercanvas, or 0 if none */
int gl_pixwidth; /* width in pixels (on parent, if a graph) */
int gl_pixheight;
t_float gl_x1; /* bounding rectangle in our own coordinates */
t_float gl_x1; /* bounding rectangle in our own coordinates */
t_float gl_y1;
t_float gl_x2;
t_float gl_y2;
......
......@@ -748,12 +748,12 @@ static void scalar_displace_withtag(t_gobj *z, t_glist *glist, int dx, int dy)
t_gobj *y;
t_canvas *templatecanvas = template_findcanvas(template);
for (y = templatecanvas->gl_list; y; y = y->g_next)
{
t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd);
if (!wb) continue;
(*wb->w_parentdisplacefn)(y, glist, x->sc_vec, template,
basex, basey, dx, dy);
}
{
t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd);
if (!wb) continue;
(*wb->w_parentdisplacefn)(y, glist, x->sc_vec, template,
basex, basey, dx, dy);
}
}
*/
......
This diff is collapsed.
......@@ -262,6 +262,28 @@ static void canvas_objtext(t_glist *gl, int xpix, int ypix,
}
}
extern int sys_autopatch_yoffset;
static int get_autopatch_yoffset(t_canvas *x)
{
if (sys_autopatch_yoffset)
return sys_autopatch_yoffset;
else
{
int fontsize = glist_getfont(x);
switch (fontsize)
{
case 8: return 8;
case 10: return 8;
case 12: return 9;
case 16: return 10;
case 24: return 13;
case 36: return 18;
}
return 10;
}
}
extern int sys_noautopatch;
extern t_gobj *glist_nth(t_glist *x, int n);
extern int glist_getindex(t_glist *x, t_gobj *y);
......@@ -288,11 +310,14 @@ void canvas_howputnew(t_canvas *x, int *connectp, int *xpixp, int *ypixp,
{
t_gobj *g, *selected = x->gl_editor->e_selection->sel_what;
t_text *t = (t_text *)selected;
// if selected object has not yet been activated we need to recreate it first
// if selected object has not yet been activated we need to
// recreate it first
if (pd_class(&t->te_pd) == text_class && t->te_type != T_TEXT)
{
glist_noselect(x); // we do this to explicitly activate object
glist_select(x, glist_nth(x, glist_getindex(x, 0)-1)); // then reselect it
// we do this to explicitly activate object...
glist_noselect(x);
// then reselect it
glist_select(x, glist_nth(x, glist_getindex(x, 0)-1));
selected = x->gl_editor->e_selection->sel_what;
}
for (g = x->gl_list, nobj = 0; g; g = g->g_next, nobj++)
......@@ -302,7 +327,7 @@ void canvas_howputnew(t_canvas *x, int *connectp, int *xpixp, int *ypixp,
gobj_getrect(g, x, &x1, &y1, &x2, &y2);
indx = nobj;
*xpixp = x1;
*ypixp = y2 + 5;
*ypixp = y2 + get_autopatch_yoffset(x);
}
}
glist_noselect(x);
......@@ -358,7 +383,7 @@ void canvas_obj(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
post("unable to create stub object in closed canvas!");
else
{
/* interactively create new obect */
/* interactively create new object */
t_binbuf *b = binbuf_new();
int connectme, xpix, ypix, indx, nobj;
canvas_howputnew(gl, &connectme, &xpix, &ypix, &indx, &nobj);
......
......@@ -10,6 +10,7 @@
#include "m_pd.h"
#include "s_stuff.h"
#include "s_version.h"
#include "g_canvas.h"
#include <stdio.h>
......
......@@ -75,21 +75,30 @@ static void glob_perf(t_pd *dummy, float f)
sys_perf = (f != 0);
}
extern int sys_zoom, sys_browser_doc, sys_browser_path, sys_browser_init;
extern int sys_zoom, sys_browser_doc, sys_browser_path, sys_browser_init,
sys_autopatch_yoffset;
extern t_symbol *sys_gui_preset;
static void glob_gui_prefs(t_pd *dummy, t_symbol *s, float f, float f2, float f3, float f4)
static void glob_gui_prefs(t_pd *dummy, t_symbol *s, int argc, t_atom *argv)
{
sys_gui_preset = s;
sys_zoom = !!(int)f;
sys_browser_doc = !!(int)f2;
sys_browser_path = !!(int)f3;
sys_browser_init = !!(int)f4;
sys_gui_preset = atom_getsymbolarg(0, argc--, argv++);
sys_zoom = !!atom_getintarg(0, argc--, argv++);
sys_browser_doc = !!atom_getintarg(0, argc--, argv++);
sys_browser_path = !!atom_getintarg(0, argc--, argv++);
sys_browser_init = !!atom_getintarg(0, argc--, argv++);
sys_autopatch_yoffset = atom_getintarg(0, argc--, argv++);
}
/* just the gui-preset, the save-zoom toggle and various help browser options for now */
static void glob_gui_properties(t_pd *dummy)
{
gui_vmess("gui_gui_properties", "xsiiii", 0, sys_gui_preset->s_name, sys_zoom, sys_browser_doc, sys_browser_path, sys_browser_init);
gui_vmess("gui_gui_properties", "xsiiiii",
dummy,
sys_gui_preset->s_name,
sys_zoom,
sys_browser_doc,
sys_browser_path,
sys_browser_init,
sys_autopatch_yoffset);
}
// ths one lives inside g_editor so that it can access the clipboard
......@@ -175,7 +184,7 @@ void glob_init(void)
class_addmethod(glob_pdobject, (t_method)glob_clipboard_text,
gensym("clipboardtext"), A_FLOAT, 0);
class_addmethod(glob_pdobject, (t_method)glob_gui_prefs,
gensym("gui-prefs"), A_SYMBOL, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0);
gensym("gui-prefs"), A_GIMME, 0);
class_addmethod(glob_pdobject, (t_method)glob_gui_properties,
gensym("gui-properties"), 0);
class_addmethod(glob_pdobject, (t_method)glob_recent_files,
......
......@@ -41,7 +41,7 @@ LDFLAGS = @LDFLAGS@
LIB = @PDLIB@
WARN_CFLAGS = -Wall -W -Wstrict-prototypes \
-Wno-unused-parameter -Wno-parentheses -Wno-switch
-Wno-unused-parameter -Wno-parentheses -Wno-switch -Wno-cast-function-type
#WARN_CFLAGS += -Werror=implicit-function-declaration
ARCH_CFLAGS = -DPD
......@@ -203,6 +203,7 @@ install: all
install -m644 m_imp.h $(DESTDIR)$(includedir)/pd-l2ork/m_imp.h
install -m644 g_canvas.h $(DESTDIR)$(includedir)/pd-l2ork/g_canvas.h
install -m644 s_stuff.h $(DESTDIR)$(includedir)/pd-l2ork/s_stuff.h
install -m644 s_version.h $(DESTDIR)$(includedir)/pd-l2ork/s_version.h
install -m644 g_all_guis.h $(DESTDIR)$(includedir)/pd-l2ork/g_all_guis.h
install -d $(DESTDIR)$(mandir)/man1
gzip < ../man/pd.1 > $(DESTDIR)$(mandir)/man1/@PDEXEC@.1.gz
......@@ -230,7 +231,7 @@ extra-clean:
clean: extra-clean local-clean
distclean: clean
-rm -f s_stuff.h config.cache config.log config.status makefile tags \
-rm -f s_version.h config.cache config.log config.status makefile tags \
autom4te.cache/output.* autom4te.cache/traces.* autom4te.cache/requests
-rm -rf autom4te*.cache
......@@ -238,10 +239,10 @@ tags: $(SRC); ctags *.[ch]
depend: makefile.dependencies
makefile.dependencies: makefile s_stuff.h
makefile.dependencies: makefile s_version.h
$(CC) $(CPPFLAGS) -M $(SRC) > makefile.dependencies
s_stuff.h: s_stuff.h.in
s_version.h: s_version.h.in
sed 's|^\(#define PD_BUILD_VERSION "\).*"|\1$(PD_BUILD_VERSION)"|' $< > $@
uninstall:
......
......@@ -106,7 +106,7 @@ PMOBJ = $(PMSRC:.c=.o)
GSRC =
HEADERS = g_all_guis.h m_imp.h g_canvas.h g_magicglass.h m_pd.h s_stuff.h \
HEADERS = g_all_guis.h m_imp.h g_canvas.h g_magicglass.h m_pd.h s_stuff.h s_version.h \
g_undo.h x_preset.h s_utf8.h \
$(wildcard ../portaudio/common/*.h) s_audio_paring.h
......@@ -165,7 +165,7 @@ all: config.h $(PDDLL) $(PDEXEC) pdsend.exe pdreceive.exe pd.com externs
config.h: config.h.in
cp config.h.in config.h
s_stuff.h: s_stuff.h.in
s_version.h: s_version.h.in
sed 's|^\(#define PD_BUILD_VERSION "\).*"|\1$(PD_BUILD_VERSION)"|' $< > $@
$(OBJ) : %.o : %.c
......@@ -280,6 +280,7 @@ install: all
install -p m_imp.h $(DESTDIR)$(includedir)/pdl2ork/m_imp.h
install -p g_canvas.h $(DESTDIR)$(includedir)/pdl2ork/g_canvas.h
install -p s_stuff.h $(DESTDIR)$(includedir)/pdl2ork/s_stuff.h
install -p s_version.h $(DESTDIR)$(includedir)/pdl2ork/s_version.h
install -p g_all_guis.h $(DESTDIR)$(includedir)/pdl2ork/g_all_guis.h
# since Pd-vanilla on Mac OS X doesn't have an 'include/pd' folder,
# Pd-extended will mimic Pd-vanilla's include/pd until Pd-vanilla gets one
......@@ -300,6 +301,7 @@ install: all
install -d $(DESTDIR)$(includedir)
install -p m_pd.h $(DESTDIR)$(includedir)/m_pd.h
install -p s_stuff.h $(DESTDIR)$(includedir)/s_stuff.h
install -p s_version.h $(DESTDIR)$(includedir)/s_version.h
@echo "Pd install succeeded."
......@@ -312,7 +314,7 @@ clean:
-rm -f makefile.dependencies
distclean: clean
rm -rf -- s_stuff.h config.cache config.log config.status makefile tags \
rm -rf -- s_version.h config.cache config.log config.status makefile tags \
autom4te-*.cache
tags: $(SRC) $(GSRC); ctags *.[ch]
......
......@@ -40,7 +40,8 @@
#define snprintf sprintf_s
#endif
int sys_defeatrt, sys_zoom, sys_browser_doc = 1, sys_browser_path, sys_browser_init;
int sys_defeatrt, sys_autopatch_yoffset, sys_zoom, sys_browser_doc = 1,
sys_browser_path, sys_browser_init;
t_symbol *sys_flags = &s_;
void sys_doflags( void);
......@@ -675,6 +676,8 @@ void sys_loadpreferences( void)
sscanf(prefbuf, "%d", &sys_browser_path);
if (sys_getpreference("browser_init", prefbuf, MAXPDSTRING))
sscanf(prefbuf, "%d", &sys_browser_init);
if (sys_getpreference("autopatch_yoffset", prefbuf, MAXPDSTRING))
sscanf(prefbuf, "%d", &sys_autopatch_yoffset);
if (sys_getpreference("guipreset", prefbuf, MAXPDSTRING))
{
char preset_buf[MAXPDSTRING];
......@@ -820,6 +823,8 @@ void glob_savepreferences(t_pd *dummy)
sys_putpreference("browser_path", buf1);
sprintf(buf1, "%d", sys_browser_init);
sys_putpreference("browser_init", buf1);
sprintf(buf1, "%d", sys_autopatch_yoffset);
sys_putpreference("autopatch_yoffset", buf1);
sys_putpreference("guipreset", sys_gui_preset->s_name);
sys_putpreference("flags",
(sys_flags ? sys_flags->s_name : ""));
......
......@@ -5,6 +5,7 @@
#include "m_pd.h"
#include "m_imp.h"
#include "s_stuff.h"
#include "s_version.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <limits.h>
......
......@@ -666,38 +666,21 @@ void midi_alsa_setndevs(int in, int out);
void glob_midi_setapi(void *dummy, t_floatarg f)
{
int newapi = f;
if (newapi)
if (newapi != sys_midiapi)
{
if (newapi == sys_midiapi)
{
//if (!midi_isopen())
// s_reopen_midi();
}
else
{
#ifdef USEAPI_ALSA
if (sys_midiapi == API_ALSA)
sys_alsa_close_midi();
else
if (sys_midiapi == API_ALSA)
sys_alsa_close_midi();
else
#endif
sys_close_midi();
sys_midiapi = newapi;
/* bash device params back to default */
// midi_nmidiindev = midi_nmidioutdev = 1;
//midi_midiindev[0] = midi_midioutdev[0] = DEFAULTMIDIDEV;
//midi_midichindev[0] = midi_midichoutdev[0] = SYS_DEFAULTCH;
sys_reopen_midi();
}
sys_close_midi();
sys_midiapi = newapi;
sys_reopen_midi();
}
#ifdef USEAPI_ALSA
midi_alsa_setndevs(midi_nmidiindev, midi_nmidioutdev);
#endif
glob_midi_properties(0, 0);
}
else //if (midi_isopen())
{
sys_close_midi();
//midi_state = 0;
}
glob_midi_properties(0, (midi_nmidiindev > 1 || midi_nmidioutdev > 1));
}
extern t_class *glob_pdobject;
......@@ -808,9 +791,9 @@ void glob_midi_properties(t_pd *dummy, t_floatarg flongform)
if (sys_midiapi == API_ALSA)
{
// sprintf(buf,
//"pdtk_alsa_midi_dialog %%s "
//"%d %d %d %d %d %d %d %d "
//"%d 1\n",
// "pdtk_alsa_midi_dialog %%s "
// "%d %d %d %d %d %d %d %d "
// "%d 1\n",
// midiindev1, midiindev2, midiindev3, midiindev4,
// midioutdev1, midioutdev2, midioutdev3, midioutdev4,
// (flongform != 0));
......
......@@ -10,12 +10,6 @@ in future releases. The public (stable) API is in m_pd.h. */
#ifndef __s_stuff_h_
#define __s_stuff_h_
// AG: Generated build version number. Pd-l2ork uses this in lieu of vanilla's
// PD_TEST_VERSION. We wouldn't want to touch m_pd.h for this, so it's part of
// the internal API. Also note that this value gets substituted automatically
// at build time, so any manual edits will be lost.
#define PD_BUILD_VERSION "<build version>"
/* in s_path.c */
typedef struct _namelist /* element in a linked list of stored strings */
......
#ifndef __s_version_h_
#define __s_version_h_
// AG: Generated build version number. Pd-l2ork uses this in lieu of vanilla's
// PD_TEST_VERSION. We wouldn't want to touch m_pd.h for this, so it's part of
// the internal API. Also note that this value gets substituted automatically
// at build time, so any manual edits will be lost.
#define PD_BUILD_VERSION "<build version>"
#endif
\ No newline at end of file
......@@ -8,6 +8,7 @@
#include "m_imp.h"
#include "g_canvas.h"
#include "s_stuff.h"
#include "s_version.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
......
#N struct drawtext-default-arg-test float x float y text a;
#N canvas 6 89 620 461 12;
#N canvas 363 260 450 323 \$0-test 0;
#X scalar drawtext-default-arg-test 89 55 \; \;;
#X restore 251 339 pd \$0-test;
#X obj 157 214 send pd-\$0-test;
#X msg 157 179 vis 1;
#X obj 41 48 bng 39 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X obj 41 143 trigger bang bang;
#X obj 183 18 struct drawtext-default-arg-test float x float y text
a;
#X obj 282 214 drawnumber;
#X text 212 246 drawnumber with no args shouldn't report a type-checking
error;
#X text 155 52 drawtext/drawsymbol/drawtext with no args should just
silently fail to display anything. When clicking the bng to display
the subject should not generate any errors.;
#X connect 2 0 1 0;
#X connect 3 0 4 0;
#X connect 4 1 2 0;
#N struct drawtext-selector-test float x float y text a;
#N canvas 3 60 620 461 12;
#X obj 183 18 struct drawtext-selector-test float x float y text a
;
#X obj 392 182 drawnumber a;
#N canvas 143 190 450 300 \$0-test 0;
#X scalar drawtext-selector-test 80 59 \; \;;
#X restore 251 339 pd \$0-test;
#X obj 157 214 send pd-\$0-test;
#X text 322 214 drawnumber can't display a text field;
#X msg 157 179 vis 1;
#X obj 41 48 bng 39 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X obj 41 143 trigger bang bang;
#X text 155 52 drawtext/drawsymbol/drawtext should report an error
when the field type doesn't match the required type. After pressing
the button to open the subpatch you should see the error reported to
the console.;
#X connect 5 0 3 0;
#X connect 6 0 7 0;
#X connect 7 1 5 0;
......@@ -50,6 +50,7 @@ is handy for some binbuf tests.;
#X obj 145 773 rtest makefilename_float;
#X obj 145 824 rtest makefilename_symbol;
#X obj 145 875 rtest makefilename_bang;
#X obj 145 926 rtest drawtext-typecheck;
#X connect 0 0 1 0;
#X connect 1 0 7 0;
#X connect 1 1 29 0;
......@@ -86,3 +87,4 @@ is handy for some binbuf tests.;
#X connect 40 0 41 0;
#X connect 41 0 42 0;
#X connect 42 0 43 0;
#X connect 43 0 44 0;
#N canvas 6 89 620 375 12;
#X obj 41 8 inlet;
#X obj 41 304 outlet;
#X obj 196 117 ./utils/creation-test;
#X obj 157 60 unpost;
#X msg 196 88 drawnumber 12;
#X obj 41 33 trigger bang bang;
#X msg 213 13 bang;
#X obj 41 171 f;
#X obj 41 196 list append drawtext/drawsymbol/drawnumber should refuse
to create with a float given for the field name;
#X obj 196 142 == 0;
#X connect 0 0 5 0;
#X connect 2 0 9 0;
#X connect 3 1 4 0;
#X connect 4 0 2 0;
#X connect 5 0 7 0;
#X connect 5 1 3 0;
#X connect 6 0 5 0;
#X connect 7 0 8 0;
#X connect 8 0 1 0;
#X connect 9 0 7 1;
#N canvas 314 60 683 597 12;
#X text 97 22 Simple abstraction to test object creation;
#N canvas 82 171 450 346 \$0-test 1;
#X obj 200 20 receive 1004-in;
#X obj 200 60 canvasinfo;
#X obj 200 100 send 1004-out;
#X text 41 40 hello;
#X connect 0 0 1 0;
#X connect 1 0 2 0;
#X restore 28 318 pd \$0-test;
#X obj 28 22 inlet;
#X obj 71 151 list prepend obj 0 0;
#X obj 71 176 list trim;
#X obj 71 206 send pd-\$0-test;
#X obj 28 97 trigger anything anything bang;
#X obj 28 236 list prepend find;
#X obj 235 124 f \$0;
#X msg 262 93 bang;
#X obj 28 291 send \$0-in;
#X obj 28 345 r \$0-out;
#X msg 235 151 clear \, obj 200 20 receive \$1-in \, obj 200 60 canvasinfo
\, obj 200 100 send \$1-out \, connect 0 0 1 0 \, connect 1 0 2 0;
#X msg 28 370 list \$1;
#X obj 28 395 t b a;
#X obj 28 447 objectinfo;
#X msg 28 420 class;
#X obj 28 261 list trim;
#X text 63 53 for everything except receive \, send \, and canvasinfo
\, or comments;
#X obj 28 472 select text;
#X msg 28 497 0;
#X obj 102 497 b;
#X msg 102 522 1;
#X obj 28 559 outlet;
#X connect 2 0 6 0;
#X connect 3 0 4 0;
#X connect 4 0 5 0;
#X connect 6 0 7 0;
#X connect 6 1 3 0;
#X connect 6 2 8 0;
#X connect 7 0 17 0;
#X connect 8 0 12 0;
#X connect 9 0 8 0;
#X connect 11 0 13 0;
#X connect 12 0 5 0;
#X connect 13 0 14 0;
#X connect 14 0 16 0;
#X connect 14 1 15 1;
#X connect 15 0 19 0;
#X connect 16 0 15 0;
#X connect 17 0 10 0;
#X connect 19 0 20 0;
#X connect 19 1 21 0;
#X connect 20 0 23 0;
#X connect 21 0 22 0;
#X connect 22 0 23 0;