From 48166a3836ea82ebbab1d622d5ff770eefbd59a1 Mon Sep 17 00:00:00 2001 From: mescalinum Date: Sat, 26 Sep 2009 18:28:46 +0000 Subject: - fix update issues with resize/rename/creation - allow to resize patterns by any dimension - add license docs - makefile fixes svn path=/trunk/externals/ffext/; revision=12466 --- composer/PdClasses.cpp | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'composer/PdClasses.cpp') diff --git a/composer/PdClasses.cpp b/composer/PdClasses.cpp index 0ca07c1..75f05a0 100644 --- a/composer/PdClasses.cpp +++ b/composer/PdClasses.cpp @@ -9,13 +9,12 @@ #include +#include "Common.hpp" + using std::cout; using std::cerr; using std::endl; -#define IS_A_FLOAT(atom,index) ((atom+index)->a_type == A_FLOAT) -#define IS_A_SYMBOL(atom,index) ((atom+index)->a_type == A_SYMBOL) - t_atom result_argv[MAX_RESULT_SIZE]; int result_argc; @@ -196,6 +195,7 @@ int track_proxy_editor(t_track_proxy *x, t_floatarg arg) else Editor::closeWindow(x); } result_argc = 0; + return 0; } int track_proxy_getpatterns(t_track_proxy *x) @@ -249,14 +249,15 @@ int track_proxy_setrow(t_track_proxy *x, t_symbol *sel, int argc, t_atom *argv) pd_error(x, "setrow: no such pattern: %s", pat->s_name); return -2; } - if((argc - 2) != pattern->getColumns()) + unsigned int argc2 = argc - 2; + if(argc2 != pattern->getColumns()) { pd_error(x, "setrow: input error: must provide exactly %d elements for a row", pattern->getColumns()); return -3; } - for(unsigned int i = 2; i < argc; i++) + for(unsigned int i = 0; i < argc2; i++) { - pattern->setCell(r, i - 2, argv[i]); + pattern->setCell(r, i, argv[i + 2]); } return 0; } @@ -365,6 +366,19 @@ int track_proxy_resizepattern(t_track_proxy *x, t_symbol *pat, t_floatarg rows, return 0; } +int track_proxy_renamepattern(t_track_proxy *x, t_symbol *oldName, t_symbol *newName) +{ + result_argc = 0; + Pattern *pattern = x->track->getPattern(oldName->s_name); + if(!pattern) + { + pd_error(x, "resizepattern: no such pattern: %s", oldName->s_name); + return -2; + } + x->track->renamePattern(oldName->s_name, newName->s_name); + return 0; +} + int track_proxy_copypattern(t_track_proxy *x, t_symbol *src, t_symbol *dst) { result_argc = 0; -- cgit v1.2.1