diff --git a/externals/Makefile b/externals/Makefile index 3fc3c0945ecfe6597bd2fa56c5e29f47318065c2..363cd61ef3f4365e932a2d05a53e3739d3ffe6d5 100644 --- a/externals/Makefile +++ b/externals/Makefile @@ -128,7 +128,7 @@ CXXFLAGS = $(CFLAGS) # # WARNING! this MUST be all on one line because the automatic package # building scripts rely on it being that way. -LIB_TARGETS = adaptive arraysize bassemu boids bsaylor comport creb cxc cyclone earplug ekext ext13 freeverb ggee hcs iem_ambi iem_bin_ambi iemlib iemgui iemguts iem_adaptfilt iemmatrix iemxmlrpc iem_delay iem_roomsim iem_spec2 iem_tab jasch_lib loaders-hexloader loaders-libdir mapping markex maxlib mjlib moocow moonlib motex mrpeach oscx pan pdcontainer pddp pdogg plugin pmpd sigpack smlib tof unauthorized vanilla vbap windowing zexy flext +LIB_TARGETS = adaptive arraysize bassemu boids bsaylor comport creb cxc cyclone earplug ekext ext13 freeverb ggee hcs iem_ambi iem_bin_ambi iemlib iemgui iemguts iem_adaptfilt iemmatrix iemxmlrpc iem_delay iem_roomsim iem_spec2 iem_tab jasch_lib loaders-hexloader loaders-libdir mapping markex maxlib mjlib moocow moonlib motex mrpeach oscx pan pdcontainer pddp pdogg plugin pmpd sigpack smlib tof unauthorized vbap windowing zexy flext # DISABLED: flatgui diff --git a/externals/vanilla/LICENSE.txt b/externals/vanilla/LICENSE.txt deleted file mode 100644 index a56a51eb52d9cccdb7ab74e8f7ce6c037cdad42c..0000000000000000000000000000000000000000 --- a/externals/vanilla/LICENSE.txt +++ /dev/null @@ -1,30 +0,0 @@ -This software is copyrighted by Miller Puckette and others. The following -terms (the "Standard Improved BSD License") apply to all files associated with -the software unless explicitly disclaimed in individual files: - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. -3. The name of the author may not be used to endorse or promote - products derived from this software without specific prior - written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY -EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGE. diff --git a/externals/vanilla/Makefile b/externals/vanilla/Makefile deleted file mode 100644 index 9d9ddf7ef173268c8752ea51f1a9d55de1edf1d7..0000000000000000000000000000000000000000 --- a/externals/vanilla/Makefile +++ /dev/null @@ -1,284 +0,0 @@ -## Pd library template version 1.0 -# For instructions on how to use this template, see: -# http://puredata.info/docs/developer/MakefileTemplate -LIBRARY_NAME = vanilla - -# add your .c source files to the SOURCES variable, help files will be -# included automatically -SOURCES = abs~.c bng.c clip~.c cnv.c dbtopow~.c dbtorms~.c exp~.c ftom~.c hradio.c hsl.c key.c keyname.c keyup.c list.c log~.c mtof~.c nbx.c openpanel.c powtodb~.c pow~.c print.c qlist.c rmstodb~.c rsqrt~.c savepanel.c sqrt~.c textfile.c tgl.c vradio.c vslider.c vu.c wrap~.c - -# For objects that only build on certain platforms, add those to the SOURCES -# line for the right platforms. -SOURCES_android = -SOURCES_cygwin = -SOURCES_macosx = -SOURCES_iphoneos = -SOURCES_linux = -SOURCES_windows = - -# list all pd objects (i.e. myobject.pd) files here, and their helpfiles will -# be included automatically -PDOBJECTS = - -# example patches and related files, in the 'examples' subfolder -EXAMPLES = - -# manuals and related files, in the 'manual' subfolder -MANUAL = - -# if you want to include any other files in the source and binary tarballs, -# list them here. This can be anything from header files, example patches, -# documentation, etc. README.txt and LICENSE.txt are required and therefore -# automatically included -EXTRA_DIST = - - - -#------------------------------------------------------------------------------# -# -# you shouldn't need to edit anything below here, if we did it right :) -# -#------------------------------------------------------------------------------# - -# get library version from meta file -LIBRARY_VERSION = $(shell sed -n 's|^\#X text [0-9][0-9]* [0-9][0-9]* VERSION \(.*\);|\1|p' $(LIBRARY_NAME)-meta.pd) - -# where Pd lives -PD_PATH = ../../pd -# where to install the library -prefix = /usr/local -libdir = $(prefix)/lib -pkglibdir = $(libdir)/pd-externals -objectsdir = $(pkglibdir) - - -INSTALL = install -INSTALL_FILE = $(INSTALL) -p -m 644 -INSTALL_DIR = $(INSTALL) -p -m 755 -d - -CFLAGS = -DPD -I$(PD_PATH)/src -Wall -W -g -LDFLAGS = -LIBS = -ALLSOURCES := $(SOURCES) $(SOURCES_android) $(SOURCES_cygwin) $(SOURCES_macosx) \ - $(SOURCES_iphoneos) $(SOURCES_linux) $(SOURCES_windows) - -UNAME := $(shell uname -s) -ifeq ($(UNAME),Darwin) - CPU := $(shell uname -p) - ifeq ($(CPU),arm) # iPhone/iPod Touch - SOURCES += $(SOURCES_iphoneos) - EXTENSION = pd_darwin - OS = iphoneos - IPHONE_BASE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin - CC=$(IPHONE_BASE)/gcc - CPP=$(IPHONE_BASE)/cpp - CXX=$(IPHONE_BASE)/g++ - ISYSROOT = -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk - IPHONE_CFLAGS = -miphoneos-version-min=3.0 $(ISYSROOT) -arch armv6 - OPT_CFLAGS = -fast -funroll-loops -fomit-frame-pointer - CFLAGS := $(IPHONE_CFLAGS) $(OPT_CFLAGS) $(CFLAGS) \ - -I/Applications/Pd-extended.app/Contents/Resources/include - LDFLAGS += -arch armv6 -bundle -undefined dynamic_lookup $(ISYSROOT) - LIBS += -lc - STRIP = strip -x - DISTDIR=$(LIBRARY_NAME)-$(LIBRARY_VERSION) - DISTBINDIR=$(DISTDIR)-$(OS) - else # Mac OS X - SOURCES += $(SOURCES_macosx) - EXTENSION = pd_darwin - OS = macosx - OPT_CFLAGS = -ftree-vectorize -ftree-vectorizer-verbose=2 -fast -# build universal 32-bit on 10.4 and 32/64 on newer - ifeq ($(shell uname -r | sed 's|\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*|\1|'), 8) - FAT_FLAGS = -arch ppc -arch i386 -mmacosx-version-min=10.4 - else - FAT_FLAGS = -arch ppc -arch i386 -arch x86_64 -mmacosx-version-min=10.4 - SOURCES += $(SOURCES_iphoneos) - endif - CFLAGS += $(FAT_FLAGS) -fPIC -I/sw/include \ - -I/Applications/Pd-extended.app/Contents/Resources/include - LDFLAGS += $(FAT_FLAGS) -bundle -undefined dynamic_lookup -L/sw/lib - # if the 'pd' binary exists, check the linking against it to aid with stripping - LDFLAGS += $(shell test -e $(PD_PATH)/bin/pd && echo -bundle_loader $(PD_PATH)/bin/pd) - LIBS += -lc - STRIP = strip -x - DISTDIR=$(LIBRARY_NAME)-$(LIBRARY_VERSION) - DISTBINDIR=$(DISTDIR)-$(OS) -# install into ~/Library/Pd on Mac OS X since /usr/local isn't used much - pkglibdir=$(HOME)/Library/Pd - endif -endif -ifeq ($(UNAME),Linux) - SOURCES += $(SOURCES_linux) - EXTENSION = pd_linux - OS = linux - OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer - CFLAGS += -fPIC - LDFLAGS += -Wl,--export-dynamic -shared -fPIC - LIBS += -lc - STRIP = strip --strip-unneeded -R .note -R .comment - DISTDIR=$(LIBRARY_NAME)-$(LIBRARY_VERSION) - DISTBINDIR=$(DISTDIR)-$(OS)-$(shell uname -m) -endif -ifeq (CYGWIN,$(findstring CYGWIN,$(UNAME))) - SOURCES += $(SOURCES_cygwin) - EXTENSION = dll - OS = cygwin - OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer - CFLAGS += - LDFLAGS += -Wl,--export-dynamic -shared -L$(PD_PATH)/src - LIBS += -lc -lpd - STRIP = strip --strip-unneeded -R .note -R .comment - DISTDIR=$(LIBRARY_NAME)-$(LIBRARY_VERSION) - DISTBINDIR=$(DISTDIR)-$(OS) -endif -ifeq (MINGW,$(findstring MINGW,$(UNAME))) - SOURCES += $(SOURCES_windows) - EXTENSION = dll - OS = windows - OPT_CFLAGS = -O3 -funroll-loops -fomit-frame-pointer - WINDOWS_HACKS = -D'O_NONBLOCK=1' - CFLAGS += -mms-bitfields $(WINDOWS_HACKS) - LDFLAGS += -s -shared -Wl,--enable-auto-import - LIBS += -L$(PD_PATH)/src -L$(PD_PATH)/bin -L$(PD_PATH)/obj -lpd -lwsock32 -lkernel32 -luser32 -lgdi32 - STRIP = strip --strip-unneeded -R .note -R .comment - DISTDIR=$(LIBRARY_NAME)-$(LIBRARY_VERSION) - DISTBINDIR=$(DISTDIR)-$(OS) -endif - -CFLAGS += $(OPT_CFLAGS) - - -.PHONY = install libdir_install single_install install-doc install-exec install-examples install-manual clean dist etags - -all: $(SOURCES:.c=.$(EXTENSION)) - -%.o: %.c - $(CC) $(CFLAGS) -o "$*.o" -c "$*.c" - -%.$(EXTENSION): %.o - $(CC) $(LDFLAGS) -o "$*.$(EXTENSION)" "$*.o" $(LIBS) - chmod a-x "$*.$(EXTENSION)" - -# this links everything into a single binary file -$(LIBRARY_NAME): $(SOURCES:.c=.o) $(LIBRARY_NAME).o - $(CC) $(LDFLAGS) -o $(LIBRARY_NAME).$(EXTENSION) $(SOURCES:.c=.o) $(LIBRARY_NAME).o $(LIBS) - chmod a-x $(LIBRARY_NAME).$(EXTENSION) - - -install: libdir_install - -# The meta and help files are explicitly installed to make sure they are -# actually there. Those files are not optional, then need to be there. -libdir_install: $(SOURCES:.c=.$(EXTENSION)) install-doc install-examples install-manual - $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) - $(INSTALL_FILE) $(LIBRARY_NAME)-meta.pd \ - $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) - test -z "$(strip $(SOURCES))" || (\ - $(INSTALL_FILE) $(SOURCES:.c=.$(EXTENSION)) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) && \ - $(STRIP) $(addprefix $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/,$(SOURCES:.c=.$(EXTENSION)))) - test -z "$(strip $(PDOBJECTS))" || \ - $(INSTALL_FILE) $(PDOBJECTS) \ - $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) - -# install library linked as single binary -single_install: $(LIBRARY_NAME) install-doc install-exec - $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) - $(INSTALL_FILE) $(LIBRARY_NAME).$(EXTENSION) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) - $(STRIP) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/$(LIBRARY_NAME).$(EXTENSION) - -install-doc: - $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) -# test -z "$(strip $(SOURCES))" || \ -# $(INSTALL_FILE) $(SOURCES:.c=-help.pd) \ -# $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) -# test -z "$(strip $(PDOBJECTS))" || \ -# $(INSTALL_FILE) $(PDOBJECTS:.pd=-help.pd) \ -# $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) - $(INSTALL_FILE) README.txt $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/README.txt - $(INSTALL_FILE) LICENSE.txt $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/LICENSE.txt - -install-examples: - test -z "$(strip $(EXAMPLES))" || \ - $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/examples && \ - for file in $(EXAMPLES); do \ - $(INSTALL_FILE) examples/$$file $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/examples; \ - done - -install-manual: - test -z "$(strip $(MANUAL))" || \ - $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/manual && \ - for file in $(MANUAL); do \ - $(INSTALL_FILE) manual/$$file $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/manual; \ - done - - -clean: - -rm -f -- $(SOURCES:.c=.o) - -rm -f -- $(SOURCES:.c=.$(EXTENSION)) - -rm -f -- $(LIBRARY_NAME).o - -rm -f -- $(LIBRARY_NAME).$(EXTENSION) - -distclean: clean - -rm -f -- $(DISTBINDIR).tar.gz - -rm -rf -- $(DISTBINDIR) - -rm -f -- $(DISTDIR).tar.gz - -rm -rf -- $(DISTDIR) - - -$(DISTBINDIR): - $(INSTALL_DIR) $(DISTBINDIR) - -libdir: all $(DISTBINDIR) - $(INSTALL_FILE) $(LIBRARY_NAME)-meta.pd $(DISTBINDIR) - $(INSTALL_FILE) $(SOURCES) $(DISTBINDIR) - $(INSTALL_FILE) $(SOURCES:.c=-help.pd) $(DISTBINDIR) - test -z "$(strip $(EXTRA_DIST))" || \ - $(INSTALL_FILE) $(EXTRA_DIST) $(DISTBINDIR) -# tar --exclude-vcs -czpf $(DISTBINDIR).tar.gz $(DISTBINDIR) - -$(DISTDIR): - $(INSTALL_DIR) $(DISTDIR) - -dist: $(DISTDIR) - $(INSTALL_FILE) Makefile $(DISTDIR) - $(INSTALL_FILE) README.txt $(DISTDIR) - $(INSTALL_FILE) LICENSE.txt $(DISTDIR) - $(INSTALL_FILE) $(LIBRARY_NAME)-meta.pd $(DISTDIR) - test -z "$(strip $(ALLSOURCES))" || \ - $(INSTALL_FILE) $(ALLSOURCES) $(DISTDIR) -# test -z "$(strip $(ALLSOURCES))" || \ -# $(INSTALL_FILE) $(ALLSOURCES:.c=-help.pd) $(DISTDIR) - test -z "$(strip $(PDOBJECTS))" || \ - $(INSTALL_FILE) $(PDOBJECTS) $(DISTDIR) -# test -z "$(strip $(PDOBJECTS))" || \ -# $(INSTALL_FILE) $(PDOBJECTS:.pd=-help.pd) $(DISTDIR) - test -z "$(strip $(EXTRA_DIST))" || \ - $(INSTALL_FILE) $(EXTRA_DIST) $(DISTDIR) - test -z "$(strip $(EXAMPLES))" || \ - $(INSTALL_DIR) $(DISTDIR)/examples && \ - for file in $(EXAMPLES); do \ - $(INSTALL_FILE) examples/$$file $(DISTDIR)/examples; \ - done - test -z "$(strip $(MANUAL))" || \ - $(INSTALL_DIR) $(DISTDIR)/manual && \ - for file in $(MANUAL); do \ - $(INSTALL_FILE) manual/$$file $(DISTDIR)/manual; \ - done - tar --exclude-vcs -czpf $(DISTDIR).tar.gz $(DISTDIR) - - -etags: - etags *.h $(SOURCES) ../../pd/src/*.[ch] /usr/include/*.h /usr/include/*/*.h - -showsetup: - @echo "PD_PATH: $(PD_PATH)" - @echo "objectsdir: $(objectsdir)" - @echo "LIBRARY_NAME: $(LIBRARY_NAME)" - @echo "LIBRARY_VERSION: $(LIBRARY_VERSION)" - @echo "SOURCES: $(SOURCES)" - @echo "PDOBJECTS: $(PDOBJECTS)" - @echo "ALLSOURCES: $(ALLSOURCES)" - @echo "UNAME: $(UNAME)" - @echo "CPU: $(CPU)" - @echo "pkglibdir: $(pkglibdir)" diff --git a/externals/vanilla/README.txt b/externals/vanilla/README.txt deleted file mode 100644 index 1f5fe0e0287132b0236dad9c145ab3b3dfa9e73d..0000000000000000000000000000000000000000 --- a/externals/vanilla/README.txt +++ /dev/null @@ -1,24 +0,0 @@ - -These are just the objects included in Miller's Pd compiled as stand-alone -libraries based on their source files. Its a quick and dirty hack to strip Pd -down to the bare essentials so that the namespace will be fully functional. - -The lib_x_* files are generated using the included script, generate.sh. They -should not be modified directly. Ideally, these would be compiled as -individual objects. - -The files named after the classes are GUI objects that originally had g_ -prefixes on the file names. - -This stuff is currently here as a proof of concept for turning Pd core into a -micro-language. If you want to start modifying these, then we should discuss -how these should be maintained along with Miller's changes. - -DO NOT CHANGE THIS CODE! ------------------------- - -This is not a place to fix bugs or add improvements. This library is an exact -mirror of the code in Pd-vanilla, warts and all. The aim is 100% -compatibility in a libdir form. This way we can have libdirs for each version -number, and then choose to use old versions of this library for compatibilty -(i.e. vanilla-0.42.5, vanilla-0.41.4, vanilla-0.40.3). diff --git a/externals/vanilla/TODO b/externals/vanilla/TODO deleted file mode 100644 index 724c6f1b7fcf012363ee7cacbca40bfcae8cd50a..0000000000000000000000000000000000000000 --- a/externals/vanilla/TODO +++ /dev/null @@ -1,15 +0,0 @@ - -- figure out how Pd-extended is going to load this stuff in order to maintain - maximum capatibility - -- replace pd-extended's x_gui.c with this e_gfxstub.c - -- replace pd-extended's d_math.c with this e_sqrt.c - -- move this d_math.h to pd-extended's pd/src - -- move relevant help patches from pd-extended's pd/doc/5.reference to here - -- move relevent help patches from doc/pddp to here - -- fix objects so if instantiated with vanilla/bng they retain the namespace prefix diff --git a/externals/vanilla/VERSION b/externals/vanilla/VERSION deleted file mode 100644 index 8e6d05b7921e0a02828e9b7dde6193a232726032..0000000000000000000000000000000000000000 --- a/externals/vanilla/VERSION +++ /dev/null @@ -1 +0,0 @@ -these are currently derived from the Pd 0.42-5 code diff --git a/externals/vanilla/abs~.c b/externals/vanilla/abs~.c deleted file mode 100644 index f4d7252e2c614945d56b68f377e71d0f304b8751..0000000000000000000000000000000000000000 --- a/externals/vanilla/abs~.c +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (c) 1997-2001 Miller Puckette and others. -* For information on usage and redistribution, and for a DISCLAIMER OF ALL -* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -#include "m_pd.h" -#include <math.h> - -static t_class *abs_tilde_class; - -typedef struct _abs_tilde -{ - t_object x_obj; - t_float x_f; -} t_abs_tilde; - -static void *abs_tilde_new(t_symbol *s, int argc, t_atom *argv) -{ - t_abs_tilde *x = (t_abs_tilde *)pd_new(abs_tilde_class); - outlet_new(&x->x_obj, &s_signal); - return (x); -} - -t_int *abs_tilde_perform(t_int *w) -{ - t_sample *in1 = (t_sample *)(w[1]); - t_sample *out = (t_sample *)(w[2]); - int n = (int)(w[3]); - while (n--) - { - float f = *in1++; - *out++ = (f >= 0 ? f : -f); - } - return (w+4); -} - -static void abs_tilde_dsp(t_abs_tilde *x, t_signal **sp) -{ - dsp_add(abs_tilde_perform, 3, - sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); -} - -void abs_tilde_setup(void) -{ - abs_tilde_class = class_new(gensym("abs~"), (t_newmethod)abs_tilde_new, 0, - sizeof(t_abs_tilde), 0, 0); - CLASS_MAINSIGNALIN(abs_tilde_class, t_abs_tilde, x_f); - class_addmethod(abs_tilde_class, (t_method)abs_tilde_dsp, gensym("dsp"), 0); -} diff --git a/externals/vanilla/bng.c b/externals/vanilla/bng.c deleted file mode 100644 index cc55438ea9f9ec73e0e8215977204e3902b2a92b..0000000000000000000000000000000000000000 --- a/externals/vanilla/bng.c +++ /dev/null @@ -1,555 +0,0 @@ -/* Copyright (c) 1997-1999 Miller Puckette. - * For information on usage and redistribution, and for a DISCLAIMER OF ALL - * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -/* g_7_guis.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ -/* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */ - - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <ctype.h> -#include "m_pd.h" -#include "g_canvas.h" - -#include "g_all_guis.h" -#include <math.h> - -#ifdef MSW -#include <io.h> -#else -#include <unistd.h> -#endif - - -/* --------------- bng gui-bang ------------------------- */ - -t_widgetbehavior bng_widgetbehavior; -static t_class *bng_class; - -/* widget helper functions */ - - -void bng_draw_update(t_bng *x, t_glist *glist) -{ - if(glist_isvisible(glist)) - { - sys_vgui(".x%lx.c itemconfigure %lxBUT -fill #%6.6x\n", glist_getcanvas(glist), x, - x->x_flashed?x->x_gui.x_fcol:x->x_gui.x_bcol); - } -} - -void bng_draw_new(t_bng *x, t_glist *glist) -{ - int xpos=text_xpix(&x->x_gui.x_obj, glist); - int ypos=text_ypix(&x->x_gui.x_obj, glist); - t_canvas *canvas=glist_getcanvas(glist); - - sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill #%6.6x -tags %lxBASE\n", - canvas, xpos, ypos, - xpos + x->x_gui.x_w, ypos + x->x_gui.x_h, - x->x_gui.x_bcol, x); - sys_vgui(".x%lx.c create oval %d %d %d %d -fill #%6.6x -tags %lxBUT\n", - canvas, xpos+1, ypos+1, - xpos + x->x_gui.x_w-1, ypos + x->x_gui.x_h-1, - x->x_flashed?x->x_gui.x_fcol:x->x_gui.x_bcol, x); - sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \ - -font {{%s} -%d %s} -fill #%6.6x -tags %lxLABEL\n", - canvas, xpos+x->x_gui.x_ldx, - ypos+x->x_gui.x_ldy, - strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"", - x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, - x->x_gui.x_lcol, x); - if(!x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxOUT%d\n", - canvas, xpos, - ypos + x->x_gui.x_h-1, xpos + IOWIDTH, - ypos + x->x_gui.x_h, x, 0); - if(!x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxIN%d\n", - canvas, xpos, ypos, - xpos + IOWIDTH, ypos+1, x, 0); -} - -void bng_draw_move(t_bng *x, t_glist *glist) -{ - int xpos=text_xpix(&x->x_gui.x_obj, glist); - int ypos=text_ypix(&x->x_gui.x_obj, glist); - t_canvas *canvas=glist_getcanvas(glist); - - sys_vgui(".x%lx.c coords %lxBASE %d %d %d %d\n", - canvas, x, xpos, ypos, - xpos + x->x_gui.x_w, ypos + x->x_gui.x_h); - sys_vgui(".x%lx.c coords %lxBUT %d %d %d %d\n", - canvas, x, xpos+1,ypos+1, - xpos + x->x_gui.x_w-1, ypos + x->x_gui.x_h-1); - sys_vgui(".x%lx.c itemconfigure %lxBUT -fill #%6.6x\n", canvas, x, - x->x_flashed?x->x_gui.x_fcol:x->x_gui.x_bcol); - sys_vgui(".x%lx.c coords %lxLABEL %d %d\n", - canvas, x, xpos+x->x_gui.x_ldx, ypos+x->x_gui.x_ldy); - if(!x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c coords %lxOUT%d %d %d %d %d\n", - canvas, x, 0, xpos, - ypos + x->x_gui.x_h-1, xpos + IOWIDTH, - ypos + x->x_gui.x_h); - if(!x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c coords %lxIN%d %d %d %d %d\n", - canvas, x, 0, xpos, ypos, - xpos + IOWIDTH, ypos+1); -} - -void bng_draw_erase(t_bng* x, t_glist* glist) -{ - t_canvas *canvas=glist_getcanvas(glist); - - sys_vgui(".x%lx.c delete %lxBASE\n", canvas, x); - sys_vgui(".x%lx.c delete %lxBUT\n", canvas, x); - sys_vgui(".x%lx.c delete %lxLABEL\n", canvas, x); - if(!x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c delete %lxOUT%d\n", canvas, x, 0); - if(!x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c delete %lxIN%d\n", canvas, x, 0); -} - -void bng_draw_config(t_bng* x, t_glist* glist) -{ - t_canvas *canvas=glist_getcanvas(glist); - - sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {{%s} -%d %s} -fill #%6.6x -text {%s} \n", - canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, - x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_lcol, - strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:""); - sys_vgui(".x%lx.c itemconfigure %lxBASE -fill #%6.6x\n", canvas, x, x->x_gui.x_bcol); - sys_vgui(".x%lx.c itemconfigure %lxBUT -fill #%6.6x\n", canvas, x, - x->x_flashed?x->x_gui.x_fcol:x->x_gui.x_bcol); -} - -void bng_draw_io(t_bng* x, t_glist* glist, int old_snd_rcv_flags) -{ - int xpos=text_xpix(&x->x_gui.x_obj, glist); - int ypos=text_ypix(&x->x_gui.x_obj, glist); - t_canvas *canvas=glist_getcanvas(glist); - - if((old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && !x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxOUT%d\n", - canvas, xpos, - ypos + x->x_gui.x_h-1, xpos + IOWIDTH, - ypos + x->x_gui.x_h, x, 0); - if(!(old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c delete %lxOUT%d\n", canvas, x, 0); - if((old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && !x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxIN%d\n", - canvas, xpos, ypos, - xpos + IOWIDTH, ypos+1, x, 0); - if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c delete %lxIN%d\n", canvas, x, 0); -} - -void bng_draw_select(t_bng* x, t_glist* glist) -{ - t_canvas *canvas=glist_getcanvas(glist); - - if(x->x_gui.x_fsf.x_selected) - { - sys_vgui(".x%lx.c itemconfigure %lxBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED); - sys_vgui(".x%lx.c itemconfigure %lxBUT -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED); - sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED); - } - else - { - sys_vgui(".x%lx.c itemconfigure %lxBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); - sys_vgui(".x%lx.c itemconfigure %lxBUT -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); - sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol); - } -} - -void bng_draw(t_bng *x, t_glist *glist, int mode) -{ - if(mode == IEM_GUI_DRAW_MODE_UPDATE) - bng_draw_update(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_MOVE) - bng_draw_move(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_NEW) - bng_draw_new(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_SELECT) - bng_draw_select(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_ERASE) - bng_draw_erase(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_CONFIG) - bng_draw_config(x, glist); - else if(mode >= IEM_GUI_DRAW_MODE_IO) - bng_draw_io(x, glist, mode - IEM_GUI_DRAW_MODE_IO); -} - -/* ------------------------ bng widgetbehaviour----------------------------- */ - -static void bng_getrect(t_gobj *z, t_glist *glist, int *xp1, int *yp1, int *xp2, int *yp2) -{ - t_bng *x = (t_bng *)z; - - *xp1 = text_xpix(&x->x_gui.x_obj, glist); - *yp1 = text_ypix(&x->x_gui.x_obj, glist); - *xp2 = *xp1 + x->x_gui.x_w; - *yp2 = *yp1 + x->x_gui.x_h; -} - -static void bng_save(t_gobj *z, t_binbuf *b) -{ - t_bng *x = (t_bng *)z; - int bflcol[3]; - t_symbol *srl[3]; - - iemgui_save(&x->x_gui, srl, bflcol); - binbuf_addv(b, "ssiisiiiisssiiiiiii", gensym("#X"),gensym("obj"), - (int)x->x_gui.x_obj.te_xpix, (int)x->x_gui.x_obj.te_ypix, - gensym("bng"), x->x_gui.x_w, - x->x_flashtime_hold, x->x_flashtime_break, - iem_symargstoint(&x->x_gui.x_isa), - srl[0], srl[1], srl[2], - x->x_gui.x_ldx, x->x_gui.x_ldy, - iem_fstyletoint(&x->x_gui.x_fsf), x->x_gui.x_fontsize, - bflcol[0], bflcol[1], bflcol[2]); - binbuf_addv(b, ";"); -} - -void bng_check_minmax(t_bng *x, int ftbreak, int fthold) -{ - if(ftbreak > fthold) - { - int h; - - h = ftbreak; - ftbreak = fthold; - fthold = h; - } - if(ftbreak < IEM_BNG_MINBREAKFLASHTIME) - ftbreak = IEM_BNG_MINBREAKFLASHTIME; - if(fthold < IEM_BNG_MINHOLDFLASHTIME) - fthold = IEM_BNG_MINHOLDFLASHTIME; - x->x_flashtime_break = ftbreak; - x->x_flashtime_hold = fthold; -} - -static void bng_properties(t_gobj *z, t_glist *owner) -{ - t_bng *x = (t_bng *)z; - char buf[800]; - t_symbol *srl[3]; - - iemgui_properties(&x->x_gui, srl); - sprintf(buf, "pdtk_iemgui_dialog %%s |bang| \ - ----------dimensions(pix):----------- %d %d size: 0 0 empty \ - --------flash-time(ms)(ms):--------- %d intrrpt: %d hold: %d \ - %d empty empty %d %d empty %d \ - %s %s \ - %s %d %d \ - %d %d \ - %d %d %d\n", - x->x_gui.x_w, IEM_GUI_MINSIZE, - x->x_flashtime_break, x->x_flashtime_hold, 2,/*min_max_schedule+clip*/ - -1, x->x_gui.x_isa.x_loadinit, -1, -1,/*no linlog, no multi*/ - srl[0]->s_name, srl[1]->s_name, - srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy, - x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize, - 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol); - gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); -} - -static void bng_set(t_bng *x) -{ - if(x->x_flashed) - { - x->x_flashed = 0; - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); - clock_delay(x->x_clock_brk, x->x_flashtime_break); - x->x_flashed = 1; - } - else - { - x->x_flashed = 1; - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); - } - clock_delay(x->x_clock_hld, x->x_flashtime_hold); -} - -static void bng_bout1(t_bng *x)/*wird nur mehr gesendet, wenn snd != rcv*/ -{ - if(!x->x_gui.x_fsf.x_put_in2out) - { - x->x_gui.x_isa.x_locked = 1; - clock_delay(x->x_clock_lck, 2); - } - outlet_bang(x->x_gui.x_obj.ob_outlet); - if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing && x->x_gui.x_fsf.x_put_in2out) - pd_bang(x->x_gui.x_snd->s_thing); -} - -static void bng_bout2(t_bng *x)/*wird immer gesendet, wenn moeglich*/ -{ - if(!x->x_gui.x_fsf.x_put_in2out) - { - x->x_gui.x_isa.x_locked = 1; - clock_delay(x->x_clock_lck, 2); - } - outlet_bang(x->x_gui.x_obj.ob_outlet); - if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) - pd_bang(x->x_gui.x_snd->s_thing); -} - -static void bng_bang(t_bng *x)/*wird nur mehr gesendet, wenn snd != rcv*/ -{ - if(!x->x_gui.x_isa.x_locked) - { - bng_set(x); - bng_bout1(x); - } -} - -static void bng_bang2(t_bng *x)/*wird immer gesendet, wenn moeglich*/ -{ - if(!x->x_gui.x_isa.x_locked) - { - bng_set(x); - bng_bout2(x); - } -} - -static void bng_dialog(t_bng *x, t_symbol *s, int argc, t_atom *argv) -{ - t_symbol *srl[3]; - int a = (int)atom_getintarg(0, argc, argv); - int fthold = (int)atom_getintarg(2, argc, argv); - int ftbreak = (int)atom_getintarg(3, argc, argv); - int sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv); - - x->x_gui.x_w = iemgui_clip_size(a); - x->x_gui.x_h = x->x_gui.x_w; - bng_check_minmax(x, ftbreak, fthold); - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG); - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_IO + sr_flags); - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE); - canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x); -} - -static void bng_click(t_bng *x, t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl, t_floatarg alt) -{ - bng_set(x); - bng_bout2(x); -} - -static int bng_newclick(t_gobj *z, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit) -{ - if(doit) - bng_click((t_bng *)z, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, 0, (t_floatarg)alt); - return (1); -} - -static void bng_float(t_bng *x, t_floatarg f) -{bng_bang2(x);} - -static void bng_symbol(t_bng *x, t_symbol *s) -{bng_bang2(x);} - -static void bng_pointer(t_bng *x, t_gpointer *gp) -{bng_bang2(x);} - -static void bng_list(t_bng *x, t_symbol *s, int ac, t_atom *av) -{ - bng_bang2(x); -} - -static void bng_anything(t_bng *x, t_symbol *s, int argc, t_atom *argv) -{bng_bang2(x);} - -static void bng_loadbang(t_bng *x) -{ - if(!sys_noloadbang && x->x_gui.x_isa.x_loadinit) - { - bng_set(x); - bng_bout2(x); - } -} - -static void bng_size(t_bng *x, t_symbol *s, int ac, t_atom *av) -{ - x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av)); - x->x_gui.x_h = x->x_gui.x_w; - iemgui_size((void *)x, &x->x_gui); -} - -static void bng_delta(t_bng *x, t_symbol *s, int ac, t_atom *av) -{iemgui_delta((void *)x, &x->x_gui, s, ac, av);} - -static void bng_pos(t_bng *x, t_symbol *s, int ac, t_atom *av) -{iemgui_pos((void *)x, &x->x_gui, s, ac, av);} - -static void bng_flashtime(t_bng *x, t_symbol *s, int ac, t_atom *av) -{ - bng_check_minmax(x, (int)atom_getintarg(0, ac, av), - (int)atom_getintarg(1, ac, av)); -} - -static void bng_color(t_bng *x, t_symbol *s, int ac, t_atom *av) -{iemgui_color((void *)x, &x->x_gui, s, ac, av);} - -static void bng_send(t_bng *x, t_symbol *s) -{iemgui_send(x, &x->x_gui, s);} - -static void bng_receive(t_bng *x, t_symbol *s) -{iemgui_receive(x, &x->x_gui, s);} - -static void bng_label(t_bng *x, t_symbol *s) -{iemgui_label((void *)x, &x->x_gui, s);} - -static void bng_label_pos(t_bng *x, t_symbol *s, int ac, t_atom *av) -{iemgui_label_pos((void *)x, &x->x_gui, s, ac, av);} - -static void bng_label_font(t_bng *x, t_symbol *s, int ac, t_atom *av) -{iemgui_label_font((void *)x, &x->x_gui, s, ac, av);} - -static void bng_init(t_bng *x, t_floatarg f) -{ - x->x_gui.x_isa.x_loadinit = (f==0.0)?0:1; -} - -static void bng_tick_hld(t_bng *x) -{ - x->x_flashed = 0; - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); -} - -static void bng_tick_brk(t_bng *x) -{ - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); -} - -static void bng_tick_lck(t_bng *x) -{ - x->x_gui.x_isa.x_locked = 0; -} - -static void *bng_new(t_symbol *s, int argc, t_atom *argv) -{ - t_bng *x = (t_bng *)pd_new(bng_class); - int bflcol[]={-262144, -1, -1}; - int a=IEM_GUI_DEFAULTSIZE; - int ldx=17, ldy=7; - int fs=10; - int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME, - fthold=IEM_BNG_DEFAULTHOLDFLASHTIME; - char str[144]; - - iem_inttosymargs(&x->x_gui.x_isa, 0); - iem_inttofstyle(&x->x_gui.x_fsf, 0); - - if((argc == 14)&&IS_A_FLOAT(argv,0) - &&IS_A_FLOAT(argv,1)&&IS_A_FLOAT(argv,2) - &&IS_A_FLOAT(argv,3) - &&(IS_A_SYMBOL(argv,4)||IS_A_FLOAT(argv,4)) - &&(IS_A_SYMBOL(argv,5)||IS_A_FLOAT(argv,5)) - &&(IS_A_SYMBOL(argv,6)||IS_A_FLOAT(argv,6)) - &&IS_A_FLOAT(argv,7)&&IS_A_FLOAT(argv,8) - &&IS_A_FLOAT(argv,9)&&IS_A_FLOAT(argv,10)&&IS_A_FLOAT(argv,11) - &&IS_A_FLOAT(argv,12)&&IS_A_FLOAT(argv,13)) - { - - a = (int)atom_getintarg(0, argc, argv); - fthold = (int)atom_getintarg(1, argc, argv); - ftbreak = (int)atom_getintarg(2, argc, argv); - iem_inttosymargs(&x->x_gui.x_isa, atom_getintarg(3, argc, argv)); - iemgui_new_getnames(&x->x_gui, 4, argv); - ldx = (int)atom_getintarg(7, argc, argv); - ldy = (int)atom_getintarg(8, argc, argv); - iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(9, argc, argv)); - fs = (int)atom_getintarg(10, argc, argv); - bflcol[0] = (int)atom_getintarg(11, argc, argv); - bflcol[1] = (int)atom_getintarg(12, argc, argv); - bflcol[2] = (int)atom_getintarg(13, argc, argv); - } - else iemgui_new_getnames(&x->x_gui, 4, 0); - - x->x_gui.x_draw = (t_iemfunptr)bng_draw; - - x->x_gui.x_fsf.x_snd_able = 1; - x->x_gui.x_fsf.x_rcv_able = 1; - x->x_flashed = 0; - x->x_gui.x_glist = (t_glist *)canvas_getcurrent(); - if (!strcmp(x->x_gui.x_snd->s_name, "empty")) - x->x_gui.x_fsf.x_snd_able = 0; - if (!strcmp(x->x_gui.x_rcv->s_name, "empty")) - x->x_gui.x_fsf.x_rcv_able = 0; - if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica"); - else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times"); - else { x->x_gui.x_fsf.x_font_style = 0; - strcpy(x->x_gui.x_font, sys_font); } - - if (x->x_gui.x_fsf.x_rcv_able) - pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); - x->x_gui.x_ldx = ldx; - x->x_gui.x_ldy = ldy; - - if(fs < 4) - fs = 4; - x->x_gui.x_fontsize = fs; - x->x_gui.x_w = iemgui_clip_size(a); - x->x_gui.x_h = x->x_gui.x_w; - bng_check_minmax(x, ftbreak, fthold); - iemgui_all_colfromload(&x->x_gui, bflcol); - x->x_gui.x_isa.x_locked = 0; - iemgui_verify_snd_ne_rcv(&x->x_gui); - x->x_clock_hld = clock_new(x, (t_method)bng_tick_hld); - x->x_clock_brk = clock_new(x, (t_method)bng_tick_brk); - x->x_clock_lck = clock_new(x, (t_method)bng_tick_lck); - outlet_new(&x->x_gui.x_obj, &s_bang); - return (x); -} - -static void bng_ff(t_bng *x) -{ - if(x->x_gui.x_fsf.x_rcv_able) - pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); - clock_free(x->x_clock_lck); - clock_free(x->x_clock_brk); - clock_free(x->x_clock_hld); - gfxstub_deleteforkey(x); -} - -void bng_setup(void) -{ - bng_class = class_new(gensym("bng"), (t_newmethod)bng_new, - (t_method)bng_ff, sizeof(t_bng), 0, A_GIMME, 0); - class_addbang(bng_class, bng_bang); - class_addfloat(bng_class, bng_float); - class_addsymbol(bng_class, bng_symbol); - class_addpointer(bng_class, bng_pointer); - class_addlist(bng_class, bng_list); - class_addanything(bng_class, bng_anything); - class_addmethod(bng_class, (t_method)bng_click, gensym("click"), - A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); - class_addmethod(bng_class, (t_method)bng_dialog, gensym("dialog"), - A_GIMME, 0); - class_addmethod(bng_class, (t_method)bng_loadbang, gensym("loadbang"), 0); - class_addmethod(bng_class, (t_method)bng_size, gensym("size"), A_GIMME, 0); - class_addmethod(bng_class, (t_method)bng_delta, gensym("delta"), A_GIMME, 0); - class_addmethod(bng_class, (t_method)bng_pos, gensym("pos"), A_GIMME, 0); - class_addmethod(bng_class, (t_method)bng_flashtime, gensym("flashtime"), A_GIMME, 0); - class_addmethod(bng_class, (t_method)bng_color, gensym("color"), A_GIMME, 0); - class_addmethod(bng_class, (t_method)bng_send, gensym("send"), A_DEFSYM, 0); - class_addmethod(bng_class, (t_method)bng_receive, gensym("receive"), A_DEFSYM, 0); - class_addmethod(bng_class, (t_method)bng_label, gensym("label"), A_DEFSYM, 0); - class_addmethod(bng_class, (t_method)bng_label_pos, gensym("label_pos"), A_GIMME, 0); - class_addmethod(bng_class, (t_method)bng_label_font, gensym("label_font"), A_GIMME, 0); - class_addmethod(bng_class, (t_method)bng_init, gensym("init"), A_FLOAT, 0); - bng_widgetbehavior.w_getrectfn = bng_getrect; - bng_widgetbehavior.w_displacefn = iemgui_displace; - bng_widgetbehavior.w_selectfn = iemgui_select; - bng_widgetbehavior.w_activatefn = NULL; - bng_widgetbehavior.w_deletefn = iemgui_delete; - bng_widgetbehavior.w_visfn = iemgui_vis; - bng_widgetbehavior.w_clickfn = bng_newclick; - class_setwidget(bng_class, &bng_widgetbehavior); - class_sethelpsymbol(bng_class, gensym("bng")); - class_setsavefn(bng_class, bng_save); - class_setpropertiesfn(bng_class, bng_properties); -} diff --git a/externals/vanilla/clip~.c b/externals/vanilla/clip~.c deleted file mode 100644 index 7d82737d413980ef6be71a8d27dda3342ef3f1e9..0000000000000000000000000000000000000000 --- a/externals/vanilla/clip~.c +++ /dev/null @@ -1,57 +0,0 @@ -/* Copyright (c) 1997-2001 Miller Puckette and others. -* For information on usage and redistribution, and for a DISCLAIMER OF ALL -* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -#include "m_pd.h" -#include <math.h> - -static t_class *clip_class; - -typedef struct _clip -{ - t_object x_obj; - t_float x_f; - t_float x_lo; - t_float x_hi; -} t_clip; - -static void *clip_new(t_floatarg lo, t_floatarg hi) -{ - t_clip *x = (t_clip *)pd_new(clip_class); - x->x_lo = lo; - x->x_hi = hi; - outlet_new(&x->x_obj, gensym("signal")); - floatinlet_new(&x->x_obj, &x->x_lo); - floatinlet_new(&x->x_obj, &x->x_hi); - x->x_f = 0; - return (x); -} - -static t_int *clip_perform(t_int *w) -{ - t_clip *x = (t_clip *)(w[1]); - t_sample *in = (t_sample *)(w[2]); - t_sample *out = (t_sample *)(w[3]); - int n = (int)(w[4]); - while (n--) - { - t_sample f = *in++; - if (f < x->x_lo) f = x->x_lo; - if (f > x->x_hi) f = x->x_hi; - *out++ = f; - } - return (w+5); -} - -static void clip_dsp(t_clip *x, t_signal **sp) -{ - dsp_add(clip_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); -} - -void clip_tilde_setup(void) -{ - clip_class = class_new(gensym("clip~"), (t_newmethod)clip_new, 0, - sizeof(t_clip), 0, A_DEFFLOAT, A_DEFFLOAT, 0); - CLASS_MAINSIGNALIN(clip_class, t_clip, x_f); - class_addmethod(clip_class, (t_method)clip_dsp, gensym("dsp"), 0); -} diff --git a/externals/vanilla/cnv.c b/externals/vanilla/cnv.c deleted file mode 100644 index 8b9f0e70fc3e6bbeaf0550e853f7fe09ef4ba0c6..0000000000000000000000000000000000000000 --- a/externals/vanilla/cnv.c +++ /dev/null @@ -1,387 +0,0 @@ -/* Copyright (c) 1997-1999 Miller Puckette. - * For information on usage and redistribution, and for a DISCLAIMER OF ALL - * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -/* g_7_guis.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ -/* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */ - - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <ctype.h> -#include "m_pd.h" -#include "g_canvas.h" - -#include "g_all_guis.h" -#include <math.h> - -#ifdef MSW -#include <io.h> -#else -#include <unistd.h> -#endif - -/* ---------- cnv my gui-canvas for a window ---------------- */ - -t_widgetbehavior my_canvas_widgetbehavior; -static t_class *my_canvas_class; - -/* widget helper functions */ - -void my_canvas_draw_new(t_my_canvas *x, t_glist *glist) -{ - int xpos=text_xpix(&x->x_gui.x_obj, glist); - int ypos=text_ypix(&x->x_gui.x_obj, glist); - t_canvas *canvas=glist_getcanvas(glist); - - sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill #%6.6x -outline #%6.6x -tags %lxRECT\n", - canvas, xpos, ypos, - xpos + x->x_vis_w, ypos + x->x_vis_h, - x->x_gui.x_bcol, x->x_gui.x_bcol, x); - sys_vgui(".x%lx.c create rectangle %d %d %d %d -outline #%6.6x -tags %lxBASE\n", - canvas, xpos, ypos, - xpos + x->x_gui.x_w, ypos + x->x_gui.x_h, - x->x_gui.x_bcol, x); - sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \ - -font {{%s} -%d %s} -fill #%6.6x -tags %lxLABEL\n", - canvas, xpos+x->x_gui.x_ldx, ypos+x->x_gui.x_ldy, - strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"", - x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, - x->x_gui.x_lcol, x); -} - -void my_canvas_draw_move(t_my_canvas *x, t_glist *glist) -{ - int xpos=text_xpix(&x->x_gui.x_obj, glist); - int ypos=text_ypix(&x->x_gui.x_obj, glist); - t_canvas *canvas=glist_getcanvas(glist); - - sys_vgui(".x%lx.c coords %lxRECT %d %d %d %d\n", - canvas, x, xpos, ypos, xpos + x->x_vis_w, - ypos + x->x_vis_h); - sys_vgui(".x%lx.c coords %lxBASE %d %d %d %d\n", - canvas, x, xpos, ypos, - xpos + x->x_gui.x_w, ypos + x->x_gui.x_h); - sys_vgui(".x%lx.c coords %lxLABEL %d %d\n", - canvas, x, xpos+x->x_gui.x_ldx, - ypos+x->x_gui.x_ldy); -} - -void my_canvas_draw_erase(t_my_canvas* x, t_glist* glist) -{ - t_canvas *canvas=glist_getcanvas(glist); - - sys_vgui(".x%lx.c delete %lxBASE\n", canvas, x); - sys_vgui(".x%lx.c delete %lxRECT\n", canvas, x); - sys_vgui(".x%lx.c delete %lxLABEL\n", canvas, x); -} - -void my_canvas_draw_config(t_my_canvas* x, t_glist* glist) -{ - t_canvas *canvas=glist_getcanvas(glist); - - sys_vgui(".x%lx.c itemconfigure %lxRECT -fill #%6.6x -outline #%6.6x\n", canvas, x, - x->x_gui.x_bcol, x->x_gui.x_bcol); - sys_vgui(".x%lx.c itemconfigure %lxBASE -outline #%6.6x\n", canvas, x, - x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_bcol); - sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {{%s} -%d %s} -fill #%6.6x -text {%s} \n", - canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, - x->x_gui.x_lcol, - strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:""); -} - -void my_canvas_draw_select(t_my_canvas* x, t_glist* glist) -{ - t_canvas *canvas=glist_getcanvas(glist); - - if(x->x_gui.x_fsf.x_selected) - { - sys_vgui(".x%lx.c itemconfigure %lxBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED); - } - else - { - sys_vgui(".x%lx.c itemconfigure %lxBASE -outline #%6.6x\n", canvas, x, x->x_gui.x_bcol); - } -} - -void my_canvas_draw(t_my_canvas *x, t_glist *glist, int mode) -{ - if(mode == IEM_GUI_DRAW_MODE_MOVE) - my_canvas_draw_move(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_NEW) - my_canvas_draw_new(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_SELECT) - my_canvas_draw_select(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_ERASE) - my_canvas_draw_erase(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_CONFIG) - my_canvas_draw_config(x, glist); -} - -/* ------------------------ cnv widgetbehaviour----------------------------- */ - -static void my_canvas_getrect(t_gobj *z, t_glist *glist, int *xp1, int *yp1, int *xp2, int *yp2) -{ - t_my_canvas *x = (t_my_canvas *)z; - - *xp1 = text_xpix(&x->x_gui.x_obj, glist); - *yp1 = text_ypix(&x->x_gui.x_obj, glist); - *xp2 = *xp1 + x->x_gui.x_w; - *yp2 = *yp1 + x->x_gui.x_h; -} - -static void my_canvas_save(t_gobj *z, t_binbuf *b) -{ - t_my_canvas *x = (t_my_canvas *)z; - int bflcol[3]; - t_symbol *srl[3]; - - iemgui_save(&x->x_gui, srl, bflcol); - binbuf_addv(b, "ssiisiiisssiiiiiii", gensym("#X"),gensym("obj"), - (int)x->x_gui.x_obj.te_xpix, (int)x->x_gui.x_obj.te_ypix, - gensym("cnv"), x->x_gui.x_w, x->x_vis_w, x->x_vis_h, - srl[0], srl[1], srl[2], x->x_gui.x_ldx, x->x_gui.x_ldy, - iem_fstyletoint(&x->x_gui.x_fsf), x->x_gui.x_fontsize, - bflcol[0], bflcol[2], iem_symargstoint(&x->x_gui.x_isa)); - binbuf_addv(b, ";"); -} - -static void my_canvas_properties(t_gobj *z, t_glist *owner) -{ - t_my_canvas *x = (t_my_canvas *)z; - char buf[800]; - t_symbol *srl[3]; - - iemgui_properties(&x->x_gui, srl); - sprintf(buf, "pdtk_iemgui_dialog %%s |cnv| \ - ------selectable_dimensions(pix):------ %d %d size: 0.0 0.0 empty \ - ------visible_rectangle(pix)(pix):------ %d width: %d height: %d \ - %d empty empty %d %d empty %d \ - %s %s \ - %s %d %d \ - %d %d \ - %d %d %d\n", - x->x_gui.x_w, 1, - x->x_vis_w, x->x_vis_h, 0,/*no_schedule*/ - -1, -1, -1, -1,/*no linlog, no init, no multi*/ - srl[0]->s_name, srl[1]->s_name, - srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy, - x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize, - 0xffffff & x->x_gui.x_bcol, -1/*no frontcolor*/, 0xffffff & x->x_gui.x_lcol); - gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); -} - -static void my_canvas_get_pos(t_my_canvas *x) -{ - if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) - { - x->x_at[0].a_w.w_float = text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist); - x->x_at[1].a_w.w_float = text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist); - pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); - } -} - -static void my_canvas_dialog(t_my_canvas *x, t_symbol *s, int argc, t_atom *argv) -{ - t_symbol *srl[3]; - int a = (int)atom_getintarg(0, argc, argv); - int w = (int)atom_getintarg(2, argc, argv); - int h = (int)atom_getintarg(3, argc, argv); - int sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv); - - x->x_gui.x_isa.x_loadinit = 0; - if(a < 1) - a = 1; - x->x_gui.x_w = a; - x->x_gui.x_h = x->x_gui.x_w; - if(w < 1) - w = 1; - x->x_vis_w = w; - if(h < 1) - h = 1; - x->x_vis_h = h; - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG); - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE); -} - -static void my_canvas_size(t_my_canvas *x, t_symbol *s, int ac, t_atom *av) -{ - int i = (int)atom_getintarg(0, ac, av); - - if(i < 1) - i = 1; - x->x_gui.x_w = i; - x->x_gui.x_h = i; - iemgui_size((void *)x, &x->x_gui); -} - -static void my_canvas_delta(t_my_canvas *x, t_symbol *s, int ac, t_atom *av) -{iemgui_delta((void *)x, &x->x_gui, s, ac, av);} - -static void my_canvas_pos(t_my_canvas *x, t_symbol *s, int ac, t_atom *av) -{iemgui_pos((void *)x, &x->x_gui, s, ac, av);} - -static void my_canvas_vis_size(t_my_canvas *x, t_symbol *s, int ac, t_atom *av) -{ - int i; - - i = (int)atom_getintarg(0, ac, av); - if(i < 1) - i = 1; - x->x_vis_w = i; - if(ac > 1) - { - i = (int)atom_getintarg(1, ac, av); - if(i < 1) - i = 1; - } - x->x_vis_h = i; - if(glist_isvisible(x->x_gui.x_glist)) - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE); -} - -static void my_canvas_color(t_my_canvas *x, t_symbol *s, int ac, t_atom *av) -{iemgui_color((void *)x, &x->x_gui, s, ac, av);} - -static void my_canvas_send(t_my_canvas *x, t_symbol *s) -{iemgui_send(x, &x->x_gui, s);} - -static void my_canvas_receive(t_my_canvas *x, t_symbol *s) -{iemgui_receive(x, &x->x_gui, s);} - -static void my_canvas_label(t_my_canvas *x, t_symbol *s) -{iemgui_label((void *)x, &x->x_gui, s);} - -static void my_canvas_label_pos(t_my_canvas *x, t_symbol *s, int ac, t_atom *av) -{iemgui_label_pos((void *)x, &x->x_gui, s, ac, av);} - -static void my_canvas_label_font(t_my_canvas *x, t_symbol *s, int ac, t_atom *av) -{iemgui_label_font((void *)x, &x->x_gui, s, ac, av);} - -static void *my_canvas_new(t_symbol *s, int argc, t_atom *argv) -{ - t_my_canvas *x = (t_my_canvas *)pd_new(my_canvas_class); - int bflcol[]={-233017, -1, -66577}; - int a=IEM_GUI_DEFAULTSIZE, w=100, h=60; - int ldx=20, ldy=12, f=2, i=0; - int fs=14; - char str[144]; - - iem_inttosymargs(&x->x_gui.x_isa, 0); - iem_inttofstyle(&x->x_gui.x_fsf, 0); - - if(((argc >= 10)&&(argc <= 13)) - &&IS_A_FLOAT(argv,0)&&IS_A_FLOAT(argv,1)&&IS_A_FLOAT(argv,2)) - { - a = (int)atom_getintarg(0, argc, argv); - w = (int)atom_getintarg(1, argc, argv); - h = (int)atom_getintarg(2, argc, argv); - } - if((argc >= 12)&&(IS_A_SYMBOL(argv,3)||IS_A_FLOAT(argv,3))&&(IS_A_SYMBOL(argv,4)||IS_A_FLOAT(argv,4))) - { - i = 2; - iemgui_new_getnames(&x->x_gui, 3, argv); - } - else if((argc == 11)&&(IS_A_SYMBOL(argv,3)||IS_A_FLOAT(argv,3))) - { - i = 1; - iemgui_new_getnames(&x->x_gui, 3, argv); - } - else iemgui_new_getnames(&x->x_gui, 3, 0); - - if(((argc >= 10)&&(argc <= 13)) - &&(IS_A_SYMBOL(argv,i+3)||IS_A_FLOAT(argv,i+3))&&IS_A_FLOAT(argv,i+4) - &&IS_A_FLOAT(argv,i+5)&&IS_A_FLOAT(argv,i+6) - &&IS_A_FLOAT(argv,i+7)&&IS_A_FLOAT(argv,i+8) - &&IS_A_FLOAT(argv,i+9)) - { - /* disastrously, the "label" sits in a different part of the - message. So we have to track its location separately (in - the slot x_labelbindex) and initialize it specially here. */ - iemgui_new_dogetname(&x->x_gui, i+3, argv); - x->x_gui.x_labelbindex = i+4; - ldx = (int)atom_getintarg(i+4, argc, argv); - ldy = (int)atom_getintarg(i+5, argc, argv); - iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(i+6, argc, argv)); - fs = (int)atom_getintarg(i+7, argc, argv); - bflcol[0] = (int)atom_getintarg(i+8, argc, argv); - bflcol[2] = (int)atom_getintarg(i+9, argc, argv); - } - if((argc == 13)&&IS_A_FLOAT(argv,i+10)) - { - iem_inttosymargs(&x->x_gui.x_isa, atom_getintarg(i+10, argc, argv)); - } - x->x_gui.x_draw = (t_iemfunptr)my_canvas_draw; - x->x_gui.x_fsf.x_snd_able = 1; - x->x_gui.x_fsf.x_rcv_able = 1; - x->x_gui.x_glist = (t_glist *)canvas_getcurrent(); - if (!strcmp(x->x_gui.x_snd->s_name, "empty")) - x->x_gui.x_fsf.x_snd_able = 0; - if (!strcmp(x->x_gui.x_rcv->s_name, "empty")) - x->x_gui.x_fsf.x_rcv_able = 0; - if(a < 1) - a = 1; - x->x_gui.x_w = a; - x->x_gui.x_h = x->x_gui.x_w; - if(w < 1) - w = 1; - x->x_vis_w = w; - if(h < 1) - h = 1; - x->x_vis_h = h; - if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica"); - else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times"); - else { x->x_gui.x_fsf.x_font_style = 0; - strcpy(x->x_gui.x_font, sys_font); } - if (x->x_gui.x_fsf.x_rcv_able) - pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); - x->x_gui.x_ldx = ldx; - x->x_gui.x_ldy = ldy; - if(fs < 4) - fs = 4; - x->x_gui.x_fontsize = fs; - iemgui_all_colfromload(&x->x_gui, bflcol); - x->x_at[0].a_type = A_FLOAT; - x->x_at[1].a_type = A_FLOAT; - iemgui_verify_snd_ne_rcv(&x->x_gui); - return (x); -} - -static void my_canvas_ff(t_my_canvas *x) -{ - if(x->x_gui.x_fsf.x_rcv_able) - pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); - gfxstub_deleteforkey(x); -} - -void cnv_setup(void) -{ - my_canvas_class = class_new(gensym("cnv"), (t_newmethod)my_canvas_new, - (t_method)my_canvas_ff, sizeof(t_my_canvas), CLASS_NOINLET, A_GIMME, 0); - class_addcreator((t_newmethod)my_canvas_new, gensym("my_canvas"), A_GIMME, 0); - class_addmethod(my_canvas_class, (t_method)my_canvas_dialog, gensym("dialog"), A_GIMME, 0); - class_addmethod(my_canvas_class, (t_method)my_canvas_size, gensym("size"), A_GIMME, 0); - class_addmethod(my_canvas_class, (t_method)my_canvas_delta, gensym("delta"), A_GIMME, 0); - class_addmethod(my_canvas_class, (t_method)my_canvas_pos, gensym("pos"), A_GIMME, 0); - class_addmethod(my_canvas_class, (t_method)my_canvas_vis_size, gensym("vis_size"), A_GIMME, 0); - class_addmethod(my_canvas_class, (t_method)my_canvas_color, gensym("color"), A_GIMME, 0); - class_addmethod(my_canvas_class, (t_method)my_canvas_send, gensym("send"), A_DEFSYM, 0); - class_addmethod(my_canvas_class, (t_method)my_canvas_receive, gensym("receive"), A_DEFSYM, 0); - class_addmethod(my_canvas_class, (t_method)my_canvas_label, gensym("label"), A_DEFSYM, 0); - class_addmethod(my_canvas_class, (t_method)my_canvas_label_pos, gensym("label_pos"), A_GIMME, 0); - class_addmethod(my_canvas_class, (t_method)my_canvas_label_font, gensym("label_font"), A_GIMME, 0); - class_addmethod(my_canvas_class, (t_method)my_canvas_get_pos, gensym("get_pos"), 0); - - my_canvas_widgetbehavior.w_getrectfn = my_canvas_getrect; - my_canvas_widgetbehavior.w_displacefn = iemgui_displace; - my_canvas_widgetbehavior.w_selectfn = iemgui_select; - my_canvas_widgetbehavior.w_activatefn = NULL; - my_canvas_widgetbehavior.w_deletefn = iemgui_delete; - my_canvas_widgetbehavior.w_visfn = iemgui_vis; - my_canvas_widgetbehavior.w_clickfn = NULL; - class_setwidget(my_canvas_class, &my_canvas_widgetbehavior); - class_sethelpsymbol(my_canvas_class, gensym("my_canvas")); - class_setsavefn(my_canvas_class, my_canvas_save); - class_setpropertiesfn(my_canvas_class, my_canvas_properties); -} diff --git a/externals/vanilla/dbtopow~.c b/externals/vanilla/dbtopow~.c deleted file mode 100644 index a50dfeb4e5438098780a2912fa5f7f524b3498da..0000000000000000000000000000000000000000 --- a/externals/vanilla/dbtopow~.c +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright (c) 1997-2001 Miller Puckette and others. -* For information on usage and redistribution, and for a DISCLAIMER OF ALL -* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -#include "e_sqrt.h" - -typedef struct dbtopow_tilde -{ - t_object x_obj; - t_float x_f; -} t_dbtopow_tilde; - -t_class *dbtopow_tilde_class; - -static void *dbtopow_tilde_new(void) -{ - t_dbtopow_tilde *x = (t_dbtopow_tilde *)pd_new(dbtopow_tilde_class); - outlet_new(&x->x_obj, gensym("signal")); - x->x_f = 0; - return (x); -} - -static t_int *dbtopow_tilde_perform(t_int *w) -{ - t_sample *in = *(t_sample **)(w+1), *out = *(t_sample **)(w+2); - t_int n = *(t_int *)(w+3); - for (; n--; in++, out++) - { - t_sample f = *in; - if (f <= 0) *out = 0; - else - { - if (f > 870) - f = 870; - *out = exp((LOGTEN * 0.1) * (f-100.)); - } - } - return (w + 4); -} - -static void dbtopow_tilde_dsp(t_dbtopow_tilde *x, t_signal **sp) -{ - dsp_add(dbtopow_tilde_perform, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); -} - -void dbtopow_tilde_setup(void) -{ - dbtopow_tilde_class = class_new(gensym("dbtopow~"), (t_newmethod)dbtopow_tilde_new, 0, - sizeof(t_dbtopow_tilde), 0, 0); - CLASS_MAINSIGNALIN(dbtopow_tilde_class, t_dbtopow_tilde, x_f); - class_addmethod(dbtopow_tilde_class, (t_method)dbtopow_tilde_dsp, gensym("dsp"), 0); -} diff --git a/externals/vanilla/dbtorms~.c b/externals/vanilla/dbtorms~.c deleted file mode 100644 index 13c5716d2312f67bc922227606d680d4a3ae60f3..0000000000000000000000000000000000000000 --- a/externals/vanilla/dbtorms~.c +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright (c) 1997-2001 Miller Puckette and others. -* For information on usage and redistribution, and for a DISCLAIMER OF ALL -* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -#include "e_sqrt.h" - -typedef struct dbtorms_tilde -{ - t_object x_obj; - t_float x_f; -} t_dbtorms_tilde; - -t_class *dbtorms_tilde_class; - -static void *dbtorms_tilde_new(void) -{ - t_dbtorms_tilde *x = (t_dbtorms_tilde *)pd_new(dbtorms_tilde_class); - outlet_new(&x->x_obj, gensym("signal")); - x->x_f = 0; - return (x); -} - -static t_int *dbtorms_tilde_perform(t_int *w) -{ - t_sample *in = *(t_sample **)(w+1), *out = *(t_sample **)(w+2); - t_int n = *(t_int *)(w+3); - for (; n--; in++, out++) - { - t_sample f = *in; - if (f <= 0) *out = 0; - else - { - if (f > 485) - f = 485; - *out = exp((LOGTEN * 0.05) * (f-100.)); - } - } - return (w + 4); -} - -static void dbtorms_tilde_dsp(t_dbtorms_tilde *x, t_signal **sp) -{ - dsp_add(dbtorms_tilde_perform, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); -} - -void dbtorms_tilde_setup(void) -{ - dbtorms_tilde_class = class_new(gensym("dbtorms~"), (t_newmethod)dbtorms_tilde_new, 0, - sizeof(t_dbtorms_tilde), 0, 0); - CLASS_MAINSIGNALIN(dbtorms_tilde_class, t_dbtorms_tilde, x_f); - class_addmethod(dbtorms_tilde_class, (t_method)dbtorms_tilde_dsp, gensym("dsp"), 0); -} diff --git a/externals/vanilla/e_gfxstub.c b/externals/vanilla/e_gfxstub.c deleted file mode 100644 index e3321ec9a6f69687fa79acdbad44e8edcd66a11d..0000000000000000000000000000000000000000 --- a/externals/vanilla/e_gfxstub.c +++ /dev/null @@ -1,174 +0,0 @@ -/* Copyright (c) 1997-2000 Miller Puckette. -* For information on usage and redistribution, and for a DISCLAIMER OF ALL -* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -/* gfxstub stuff from pd-vanilla's x_gui.c */ - -/* dialogs. LATER, deal with the situation where the object goes -away before the panel does... */ - -#include "m_pd.h" -#include <stdio.h> -#include <string.h> -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif - -/* --------------------- graphics responder ---------------- */ - -/* make one of these if you want to put up a dialog window but want to be -protected from getting deleted and then having the dialog call you back. In -this design the calling object doesn't have to keep the address of the dialog -window around; instead we keep a list of all open dialogs. Any object that -might have dialogs, when it is deleted, simply checks down the dialog window -list and breaks off any dialogs that might later have sent messages to it. -Only when the dialog window itself closes do we delete the gfxstub object. */ - -static t_class *gfxstub_class; - -typedef struct _gfxstub -{ - t_pd x_pd; - t_pd *x_owner; - void *x_key; - t_symbol *x_sym; - struct _gfxstub *x_next; -} t_gfxstub; - -static t_gfxstub *gfxstub_list; - - /* create a new one. the "key" is an address by which the owner - will identify it later; if the owner only wants one dialog, this - could just be a pointer to the owner itself. The string "cmd" - is a TK command to create the dialog, with "%s" embedded in - it so we can provide a name by which the GUI can send us back - messages; e.g., "pdtk_canvas_dofont %s 10". */ - -void gfxstub_new(t_pd *owner, void *key, const char *cmd) -{ - char buf[4*MAXPDSTRING]; - char namebuf[80]; - t_gfxstub *x; - t_symbol *s; - /* if any exists with matching key, burn it. */ - for (x = gfxstub_list; x; x = x->x_next) - if (x->x_key == key) - gfxstub_deleteforkey(key); - if (strlen(cmd) + 50 > 4*MAXPDSTRING) - { - bug("audio dialog too long"); - bug("%x", cmd); - return; - } - x = (t_gfxstub *)pd_new(gfxstub_class); - sprintf(namebuf, ".gfxstub%lx", (t_int)x); - - s = gensym(namebuf); - pd_bind(&x->x_pd, s); - x->x_owner = owner; - x->x_sym = s; - x->x_key = key; - x->x_next = gfxstub_list; - gfxstub_list = x; - sprintf(buf, cmd, s->s_name); - sys_gui(buf); -} - -static void gfxstub_offlist(t_gfxstub *x) -{ - t_gfxstub *y1, *y2; - if (gfxstub_list == x) - gfxstub_list = x->x_next; - else for (y1 = gfxstub_list; y2 = y1->x_next; y1 = y2) - if (y2 == x) - { - y1->x_next = y2->x_next; - break; - } -} - - /* if the owner disappears, we still may have to stay around until our - dialog window signs off. Anyway we can now tell the GUI to destroy the - window. */ -void gfxstub_deleteforkey(void *key) -{ - t_gfxstub *y; - int didit = 1; - while (didit) - { - didit = 0; - for (y = gfxstub_list; y; y = y->x_next) - { - if (y->x_key == key) - { - sys_vgui("destroy .gfxstub%lx\n", y); - y->x_owner = 0; - gfxstub_offlist(y); - didit = 1; - break; - } - } - } -} - -/* --------- pd messages for gfxstub (these come from the GUI) ---------- */ - - /* "cancel" to request that we close the dialog window. */ -static void gfxstub_cancel(t_gfxstub *x) -{ - gfxstub_deleteforkey(x->x_key); -} - - /* "signoff" comes from the GUI to say the dialog window closed. */ -static void gfxstub_signoff(t_gfxstub *x) -{ - gfxstub_offlist(x); - pd_free(&x->x_pd); -} - -static t_binbuf *gfxstub_binbuf; - - /* a series of "data" messages rebuilds a scalar */ -static void gfxstub_data(t_gfxstub *x, t_symbol *s, int argc, t_atom *argv) -{ - if (!gfxstub_binbuf) - gfxstub_binbuf = binbuf_new(); - binbuf_add(gfxstub_binbuf, argc, argv); - binbuf_addsemi(gfxstub_binbuf); -} - /* the "end" message terminates rebuilding the scalar */ -static void gfxstub_end(t_gfxstub *x) -{ - canvas_dataproperties((t_canvas *)x->x_owner, - (t_scalar *)x->x_key, gfxstub_binbuf); - binbuf_free(gfxstub_binbuf); - gfxstub_binbuf = 0; -} - - /* anything else is a message from the dialog window to the owner; - just forward it. */ -static void gfxstub_anything(t_gfxstub *x, t_symbol *s, int argc, t_atom *argv) -{ - if (x->x_owner) - pd_typedmess(x->x_owner, s, argc, argv); -} - -static void gfxstub_free(t_gfxstub *x) -{ - pd_unbind(&x->x_pd, x->x_sym); -} - -static void gfxstub_setup(void) -{ - gfxstub_class = class_new(gensym("gfxstub"), 0, (t_method)gfxstub_free, - sizeof(t_gfxstub), CLASS_PD, 0); - class_addanything(gfxstub_class, gfxstub_anything); - class_addmethod(gfxstub_class, (t_method)gfxstub_signoff, - gensym("signoff"), 0); - class_addmethod(gfxstub_class, (t_method)gfxstub_data, - gensym("data"), A_GIMME, 0); - class_addmethod(gfxstub_class, (t_method)gfxstub_end, - gensym("end"), 0); - class_addmethod(gfxstub_class, (t_method)gfxstub_cancel, - gensym("cancel"), 0); -} diff --git a/externals/vanilla/e_sqrt.c b/externals/vanilla/e_sqrt.c deleted file mode 100644 index eb011a4a150a6dc27105e52706eda35233c7dd6e..0000000000000000000000000000000000000000 --- a/externals/vanilla/e_sqrt.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (c) 1997-2001 Miller Puckette and others. -* For information on usage and redistribution, and for a DISCLAIMER OF ALL -* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -/* sqrt-related functions from pd-vanilla's d_math.c */ - -#include "e_sqrt.h" - - /* these are used in externs like "bonk" */ - -t_float q8_rsqrt(t_float f) -{ - long l = *(long *)(&f); - if (f < 0) return (0); - else return (rsqrt_exptab[(l >> 23) & 0xff] * - rsqrt_mantissatab[(l >> 13) & 0x3ff]); -} - -t_float q8_sqrt(t_float f) -{ - long l = *(long *)(&f); - if (f < 0) return (0); - else return (f * rsqrt_exptab[(l >> 23) & 0xff] * - rsqrt_mantissatab[(l >> 13) & 0x3ff]); -} - - /* the old names are OK unless we're in IRIX N32 */ - -#ifndef N32 -t_float qsqrt(t_float f) {return (q8_sqrt(f)); } -t_float qrsqrt(t_float f) {return (q8_rsqrt(f)); } -#endif diff --git a/externals/vanilla/e_sqrt.h b/externals/vanilla/e_sqrt.h deleted file mode 100644 index 209ef02fcc46620ecedb5f84806b254f41b2e0e6..0000000000000000000000000000000000000000 --- a/externals/vanilla/e_sqrt.h +++ /dev/null @@ -1,22 +0,0 @@ -/* Copyright (c) 1997-2001 Miller Puckette and others. -* For information on usage and redistribution, and for a DISCLAIMER OF ALL -* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -/* these are things used in a number of objectclasses from e_sqrt.c */ - -#include "m_pd.h" -#include <math.h> - -#define LOGTEN 2.302585092994 -#define DUMTAB1SIZE 256 -#define DUMTAB2SIZE 1024 - -#ifdef _WIN32 -#define int32 long -#else -#include <stdint.h> -#define int32 int32_t -#endif - -t_float q8_sqrt(t_float f); -t_float q8_rsqrt(t_float f); diff --git a/externals/vanilla/exp~.c b/externals/vanilla/exp~.c deleted file mode 100644 index a2d472a07155c12205ba2acd93ac09369fb0f3e2..0000000000000000000000000000000000000000 --- a/externals/vanilla/exp~.c +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright (c) 1997-2001 Miller Puckette and others. -* For information on usage and redistribution, and for a DISCLAIMER OF ALL -* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -#include "m_pd.h" -#include <math.h> - -static t_class *exp_tilde_class; - -typedef struct _exp_tilde -{ - t_object x_obj; - t_float x_f; -} t_exp_tilde; - -static void *exp_tilde_new(t_symbol *s, int argc, t_atom *argv) -{ - t_exp_tilde *x = (t_exp_tilde *)pd_new(exp_tilde_class); - outlet_new(&x->x_obj, &s_signal); - return (x); -} - -t_int *exp_tilde_perform(t_int *w) -{ - t_sample *in1 = (t_sample *)(w[1]); - t_sample *out = (t_sample *)(w[2]); - int n = (int)(w[3]); - while (n--) - *out++ = exp(*in1++); - return (w+4); -} - -static void exp_tilde_dsp(t_exp_tilde *x, t_signal **sp) -{ - dsp_add(exp_tilde_perform, 3, - sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); -} - -void exp_tilde_setup(void) -{ - exp_tilde_class = class_new(gensym("exp~"), (t_newmethod)exp_tilde_new, 0, - sizeof(t_exp_tilde), 0, 0); - CLASS_MAINSIGNALIN(exp_tilde_class, t_exp_tilde, x_f); - class_addmethod(exp_tilde_class, (t_method)exp_tilde_dsp, gensym("dsp"), 0); -} diff --git a/externals/vanilla/ftom~.c b/externals/vanilla/ftom~.c deleted file mode 100644 index cfc6359556573200a7a521c1f7518cb121677921..0000000000000000000000000000000000000000 --- a/externals/vanilla/ftom~.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright (c) 1997-2001 Miller Puckette and others. -* For information on usage and redistribution, and for a DISCLAIMER OF ALL -* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -#include "m_pd.h" -#include <math.h> - -typedef struct ftom_tilde -{ - t_object x_obj; - t_float x_f; -} t_ftom_tilde; - -t_class *ftom_tilde_class; - -static void *ftom_tilde_new(void) -{ - t_ftom_tilde *x = (t_ftom_tilde *)pd_new(ftom_tilde_class); - outlet_new(&x->x_obj, gensym("signal")); - x->x_f = 0; - return (x); -} - -static t_int *ftom_tilde_perform(t_int *w) -{ - t_sample *in = *(t_sample **)(w+1), *out = *(t_sample **)(w+2); - t_int n = *(t_int *)(w+3); - for (; n--; *in++, out++) - { - t_sample f = *in; - *out = (f > 0 ? 17.3123405046 * log(.12231220585 * f) : -1500); - } - return (w + 4); -} - -static void ftom_tilde_dsp(t_ftom_tilde *x, t_signal **sp) -{ - dsp_add(ftom_tilde_perform, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); -} - -void ftom_tilde_setup(void) -{ - ftom_tilde_class = class_new(gensym("ftom~"), (t_newmethod)ftom_tilde_new, 0, - sizeof(t_ftom_tilde), 0, 0); - CLASS_MAINSIGNALIN(ftom_tilde_class, t_ftom_tilde, x_f); - class_addmethod(ftom_tilde_class, (t_method)ftom_tilde_dsp, gensym("dsp"), 0); -} diff --git a/externals/vanilla/generate.sh b/externals/vanilla/generate.sh deleted file mode 100755 index e7bc5a4ec691bf32800d26c9473462c8e0e17163..0000000000000000000000000000000000000000 --- a/externals/vanilla/generate.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -echo this script appends, so first delete all files you want to update! - -# put these at the top of the file -touch lib_d_fft.c -echo '#include "../../pd/src/d_fftroutine.c"' >> lib_d_fft.c -echo '#include "../../pd/src/d_fft_mayer.c"' >> lib_d_fft.c - -for file in ../../pd/src/[dx]_*.c; do - newfile=`echo $file | sed 's|.*/src/\([dx]_\)|lib_\1|'` - touch $newfile - /bin/echo -n '#include "' >> $newfile - /bin/echo -n $file >> $newfile - /bin/echo '"' >> $newfile - /bin/echo "void "`echo $newfile|sed 's|\(.*\)\.c|\1|'`"_setup(void)" >> $newfile - /bin/echo "{" >> $newfile - /bin/echo $file | sed 's|.*src/\(.*\)\.c| \1_setup();|' >> $newfile - /bin/echo "}" >> $newfile -done - -# these files hold code for other classes, but no classes -rm lib_d_fftroutine.c lib_d_fft_mayer.c lib_d_resample.c -rm lib_d_fft_fftw.c lib_d_fft_fftsg.c lib_d_fftsg_h.c - -# these files have been split out into separate files per object -rm lib_x_interface.c lib_x_qlist.c lib_x_gui.c diff --git a/externals/vanilla/hradio.c b/externals/vanilla/hradio.c deleted file mode 100644 index 8016c6b870473c34fce24052d5a864553ebf6003..0000000000000000000000000000000000000000 --- a/externals/vanilla/hradio.c +++ /dev/null @@ -1,737 +0,0 @@ -/* Copyright (c) 1997-1999 Miller Puckette. - * For information on usage and redistribution, and for a DISCLAIMER OF ALL - * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -/* g_7_guis.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ -/* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */ - -/* name change to hradio by MSP and changed to -put out a "float" as in sliders, toggles, etc. */ - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <ctype.h> -#include "m_pd.h" -#include "g_canvas.h" - -#include "g_all_guis.h" -#include <math.h> - -#ifdef MSW -#include <io.h> -#else -#include <unistd.h> -#endif - -/* ------------- hdl gui-horicontal dial ---------------------- */ - -t_widgetbehavior hradio_widgetbehavior; -static t_class *hradio_class, *hradio_old_class; - -/* widget helper functions */ - -void hradio_draw_update(t_gobj *client, t_glist *glist) -{ - t_hradio *x = (t_hradio *)client; - if(glist_isvisible(glist)) - { - t_canvas *canvas=glist_getcanvas(glist); - - sys_vgui(".x%lx.c itemconfigure %lxBUT%d -fill #%6.6x -outline #%6.6x\n", - canvas, x, x->x_drawn, - x->x_gui.x_bcol, x->x_gui.x_bcol); - sys_vgui(".x%lx.c itemconfigure %lxBUT%d -fill #%6.6x -outline #%6.6x\n", - canvas, x, x->x_on, - x->x_gui.x_fcol, x->x_gui.x_fcol); - x->x_drawn = x->x_on; - } -} - -void hradio_draw_new(t_hradio *x, t_glist *glist) -{ - t_canvas *canvas=glist_getcanvas(glist); - int n=x->x_number, i, dx=x->x_gui.x_w, s4=dx/4; - int yy11=text_ypix(&x->x_gui.x_obj, glist), yy12=yy11+dx; - int yy21=yy11+s4, yy22=yy12-s4; - int xx11b=text_xpix(&x->x_gui.x_obj, glist), xx11=xx11b, xx21=xx11b+s4; - int xx22=xx11b+dx-s4; - - - for(i=0; i<n; i++) - { - sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill #%6.6x -tags %lxBASE%d\n", - canvas, xx11, yy11, xx11+dx, yy12, - x->x_gui.x_bcol, x, i); - sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill #%6.6x -outline #%6.6x -tags %lxBUT%d\n", - canvas, xx21, yy21, xx22, yy22, - (x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol, - (x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol, x, i); - xx11 += dx; - xx21 += dx; - xx22 += dx; - x->x_drawn = x->x_on; - } - sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \ - -font {{%s} -%d %s} -fill #%6.6x -tags %lxLABEL\n", - canvas, xx11b+x->x_gui.x_ldx, yy11+x->x_gui.x_ldy, - strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"", - x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, - x->x_gui.x_lcol, x); - if(!x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxOUT%d\n", - canvas, xx11b, yy12-1, xx11b + IOWIDTH, yy12, x, 0); - if(!x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxIN%d\n", - canvas, xx11b, yy11, xx11b + IOWIDTH, yy11+1, x, 0); - -} - -void hradio_draw_move(t_hradio *x, t_glist *glist) -{ - t_canvas *canvas=glist_getcanvas(glist); - int n=x->x_number, i, dx=x->x_gui.x_w, s4=dx/4; - int yy11=text_ypix(&x->x_gui.x_obj, glist), yy12=yy11+dx; - int yy21=yy11+s4, yy22=yy12-s4; - int xx11b=text_xpix(&x->x_gui.x_obj, glist), xx11=xx11b, xx21=xx11b+s4; - int xx22=xx11b+dx-s4; - - xx11 = xx11b; - xx21=xx11b+s4; - xx22=xx11b+dx-s4; - for(i=0; i<n; i++) - { - sys_vgui(".x%lx.c coords %lxBASE%d %d %d %d %d\n", - canvas, x, i, xx11, yy11, xx11+dx, yy12); - sys_vgui(".x%lx.c coords %lxBUT%d %d %d %d %d\n", - canvas, x, i, xx21, yy21, xx22, yy22); - xx11 += dx; - xx21 += dx; - xx22 += dx; - } - sys_vgui(".x%lx.c coords %lxLABEL %d %d\n", - canvas, x, xx11b+x->x_gui.x_ldx, yy11+x->x_gui.x_ldy); - if(!x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c coords %lxOUT%d %d %d %d %d\n", - canvas, x, 0, xx11b, yy12-1, xx11b + IOWIDTH, yy12); - if(!x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c coords %lxIN%d %d %d %d %d\n", - canvas, x, 0, xx11b, yy11, xx11b + IOWIDTH, yy11+1); -} - -void hradio_draw_erase(t_hradio* x, t_glist* glist) -{ - t_canvas *canvas=glist_getcanvas(glist); - int n=x->x_number, i; - - for(i=0; i<n; i++) - { - sys_vgui(".x%lx.c delete %lxBASE%d\n", canvas, x, i); - sys_vgui(".x%lx.c delete %lxBUT%d\n", canvas, x, i); - } - sys_vgui(".x%lx.c delete %lxLABEL\n", canvas, x); - if(!x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c delete %lxOUT%d\n", canvas, x, 0); - if(!x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c delete %lxIN%d\n", canvas, x, 0); -} - -void hradio_draw_config(t_hradio* x, t_glist* glist) -{ - t_canvas *canvas=glist_getcanvas(glist); - int n=x->x_number, i; - - sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {{%s} -%d %s} -fill #%6.6x -text {%s} \n", - canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, - x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_lcol, - strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:""); - for(i=0; i<n; i++) - { - sys_vgui(".x%lx.c itemconfigure %lxBASE%d -fill #%6.6x\n", canvas, x, i, - x->x_gui.x_bcol); - sys_vgui(".x%lx.c itemconfigure %lxBUT%d -fill #%6.6x -outline #%6.6x\n", canvas, x, i, - (x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol, - (x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol); - } -} - -void hradio_draw_io(t_hradio* x, t_glist* glist, int old_snd_rcv_flags) -{ - t_canvas *canvas=glist_getcanvas(glist); - int xpos=text_xpix(&x->x_gui.x_obj, glist); - int ypos=text_ypix(&x->x_gui.x_obj, glist); - - if((old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && !x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxOUT%d\n", - canvas, - xpos, ypos + x->x_gui.x_w-1, - xpos + IOWIDTH, ypos + x->x_gui.x_w, - x, 0); - if(!(old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c delete %lxOUT%d\n", canvas, x, 0); - if((old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && !x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxIN%d\n", - canvas, - xpos, ypos, - xpos + IOWIDTH, ypos+1, x, 0); - if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c delete %lxIN%d\n", canvas, x, 0); -} - -void hradio_draw_select(t_hradio* x, t_glist* glist) -{ - t_canvas *canvas=glist_getcanvas(glist); - int n=x->x_number, i; - - if(x->x_gui.x_fsf.x_selected) - { - for(i=0; i<n; i++) - { - sys_vgui(".x%lx.c itemconfigure %lxBASE%d -outline #%6.6x\n", canvas, x, i, - IEM_GUI_COLOR_SELECTED); - } - sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED); - } - else - { - for(i=0; i<n; i++) - { - sys_vgui(".x%lx.c itemconfigure %lxBASE%d -outline #%6.6x\n", canvas, x, i, - IEM_GUI_COLOR_NORMAL); - } - sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill #%6.6x\n", canvas, x, - x->x_gui.x_lcol); - } -} - -void hradio_draw(t_hradio *x, t_glist *glist, int mode) -{ - if(mode == IEM_GUI_DRAW_MODE_UPDATE) - sys_queuegui(x, glist, hradio_draw_update); - else if(mode == IEM_GUI_DRAW_MODE_MOVE) - hradio_draw_move(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_NEW) - hradio_draw_new(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_SELECT) - hradio_draw_select(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_ERASE) - hradio_draw_erase(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_CONFIG) - hradio_draw_config(x, glist); - else if(mode >= IEM_GUI_DRAW_MODE_IO) - hradio_draw_io(x, glist, mode - IEM_GUI_DRAW_MODE_IO); -} - -/* ------------------------ hdl widgetbehaviour----------------------------- */ - -static void hradio_getrect(t_gobj *z, t_glist *glist, int *xp1, int *yp1, int *xp2, int *yp2) -{ - t_hradio *x = (t_hradio *)z; - - *xp1 = text_xpix(&x->x_gui.x_obj, glist); - *yp1 = text_ypix(&x->x_gui.x_obj, glist); - *xp2 = *xp1 + x->x_gui.x_w*x->x_number; - *yp2 = *yp1 + x->x_gui.x_h; -} - -static void hradio_save(t_gobj *z, t_binbuf *b) -{ - t_hradio *x = (t_hradio *)z; - int bflcol[3]; - t_symbol *srl[3]; - - iemgui_save(&x->x_gui, srl, bflcol); - binbuf_addv(b, "ssiisiiiisssiiiiiiii", gensym("#X"),gensym("obj"), - (int)x->x_gui.x_obj.te_xpix, (int)x->x_gui.x_obj.te_ypix, - (pd_class(&x->x_gui.x_obj.ob_pd) == hradio_old_class ? - gensym("hdl") : gensym("hradio")), - x->x_gui.x_w, - x->x_change, iem_symargstoint(&x->x_gui.x_isa), x->x_number, - srl[0], srl[1], srl[2], - x->x_gui.x_ldx, x->x_gui.x_ldy, - iem_fstyletoint(&x->x_gui.x_fsf), x->x_gui.x_fontsize, - bflcol[0], bflcol[1], bflcol[2], x->x_on); - binbuf_addv(b, ";"); -} - -static void hradio_properties(t_gobj *z, t_glist *owner) -{ - t_hradio *x = (t_hradio *)z; - char buf[800]; - t_symbol *srl[3]; - int hchange=-1; - - iemgui_properties(&x->x_gui, srl); - if (pd_class(&x->x_gui.x_obj.ob_pd) == hradio_old_class) - hchange = x->x_change; - sprintf(buf, "pdtk_iemgui_dialog %%s |hradio| \ - ----------dimensions(pix):----------- %d %d size: 0 0 empty \ - empty 0.0 empty 0.0 empty %d \ - %d new-only new&old %d %d number: %d \ - %s %s \ - %s %d %d \ - %d %d \ - %d %d %d\n", - x->x_gui.x_w, IEM_GUI_MINSIZE, - 0,/*no_schedule*/ - hchange, x->x_gui.x_isa.x_loadinit, -1, x->x_number, - srl[0]->s_name, srl[1]->s_name, - srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy, - x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize, - 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol); - gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); -} - -static void hradio_dialog(t_hradio *x, t_symbol *s, int argc, t_atom *argv) -{ - t_symbol *srl[3]; - int a = (int)atom_getintarg(0, argc, argv); - int chg = (int)atom_getintarg(4, argc, argv); - int num = (int)atom_getintarg(6, argc, argv); - int sr_flags; - - if(chg != 0) chg = 1; - x->x_change = chg; - sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv); - x->x_gui.x_w = iemgui_clip_size(a); - x->x_gui.x_h = x->x_gui.x_w; - if(x->x_number != num) - { - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_ERASE); - x->x_number = num; - if(x->x_on >= x->x_number) - { - x->x_on = x->x_number - 1; - x->x_on_old = x->x_on; - } - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_NEW); - } - else - { - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG); - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_IO + sr_flags); - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE); - canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x); - } - -} - -static void hradio_set(t_hradio *x, t_floatarg f) -{ - int i=(int)f; - int old=x->x_on_old; - - if(i < 0) - i = 0; - if(i >= x->x_number) - i = x->x_number-1; - if(x->x_on != x->x_on_old) - { - old = x->x_on_old; - x->x_on_old = x->x_on; - x->x_on = i; - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); - x->x_on_old = old; - } - else - { - x->x_on = i; - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); - } -} - -static void hradio_bang(t_hradio *x) -{ - /* compatibility with earlier "hdial" behavior */ - if (pd_class(&x->x_gui.x_obj.ob_pd) == hradio_old_class) - { - if((x->x_change)&&(x->x_on != x->x_on_old)) - { - SETFLOAT(x->x_at, (t_float)x->x_on_old); - SETFLOAT(x->x_at+1, 0.0); - outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); - if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) - pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); - } - x->x_on_old = x->x_on; - SETFLOAT(x->x_at, (t_float)x->x_on); - SETFLOAT(x->x_at+1, 1.0); - outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); - if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) - pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); - } - else - { - outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on); - if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) - pd_float(x->x_gui.x_snd->s_thing, x->x_on); - } -} - -static void hradio_fout(t_hradio *x, t_floatarg f) -{ - int i=(int)f; - - if(i < 0) - i = 0; - if(i >= x->x_number) - i = x->x_number-1; - - if (pd_class(&x->x_gui.x_obj.ob_pd) == hradio_old_class) - { - if((x->x_change)&&(i != x->x_on_old)) - { - SETFLOAT(x->x_at, (t_float)x->x_on_old); - SETFLOAT(x->x_at+1, 0.0); - outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); - if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) - pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); - } - if(x->x_on != x->x_on_old) - x->x_on_old = x->x_on; - x->x_on = i; - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); - x->x_on_old = x->x_on; - SETFLOAT(x->x_at, (t_float)x->x_on); - SETFLOAT(x->x_at+1, 1.0); - outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); - if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) - pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); - } - else - { - x->x_on_old = x->x_on; - x->x_on = i; - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); - outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on); - if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) - pd_float(x->x_gui.x_snd->s_thing, x->x_on); - } -} - -static void hradio_float(t_hradio *x, t_floatarg f) -{ - int i=(int)f; - - if(i < 0) - i = 0; - if(i >= x->x_number) - i = x->x_number-1; - - if (pd_class(&x->x_gui.x_obj.ob_pd) == hradio_old_class) - { - /* compatibility with earlier "vdial" behavior */ - if((x->x_change)&&(i != x->x_on_old)) - { - if(x->x_gui.x_fsf.x_put_in2out) - { - SETFLOAT(x->x_at, (t_float)x->x_on_old); - SETFLOAT(x->x_at+1, 0.0); - outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); - if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) - pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); - } - } - if(x->x_on != x->x_on_old) - x->x_on_old = x->x_on; - x->x_on = i; - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); - x->x_on_old = x->x_on; - if(x->x_gui.x_fsf.x_put_in2out) - { - SETFLOAT(x->x_at, (t_float)x->x_on); - SETFLOAT(x->x_at+1, 1.0); - outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); - if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) - pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); - } - } - else - { - x->x_on_old = x->x_on; - x->x_on = i; - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); - if (x->x_gui.x_fsf.x_put_in2out) - { - outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on); - if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) - pd_float(x->x_gui.x_snd->s_thing, x->x_on); - } - } -} - -static void hradio_click(t_hradio *x, t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl, t_floatarg alt) -{ - int xx = (int)xpos - (int)text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist); - - hradio_fout(x, (t_float)(xx / x->x_gui.x_w)); -} - -static int hradio_newclick(t_gobj *z, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit) -{ - if(doit) - hradio_click((t_hradio *)z, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, 0, (t_floatarg)alt); - return (1); -} - -static void hradio_loadbang(t_hradio *x) -{ - if(!sys_noloadbang && x->x_gui.x_isa.x_loadinit) - hradio_bang(x); -} - -static void hradio_number(t_hradio *x, t_floatarg num) -{ - int n=(int)num; - - if(n < 1) - n = 1; - if(n > IEM_RADIO_MAX) - n = IEM_RADIO_MAX; - if(n != x->x_number) - { - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_ERASE); - x->x_number = n; - if(x->x_on >= x->x_number) - x->x_on = x->x_number - 1; - x->x_on_old = x->x_on; - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_NEW); - } -} - -static void hradio_size(t_hradio *x, t_symbol *s, int ac, t_atom *av) -{ - x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av)); - x->x_gui.x_h = x->x_gui.x_w; - iemgui_size((void *)x, &x->x_gui); -} - -static void hradio_delta(t_hradio *x, t_symbol *s, int ac, t_atom *av) -{iemgui_delta((void *)x, &x->x_gui, s, ac, av);} - -static void hradio_pos(t_hradio *x, t_symbol *s, int ac, t_atom *av) -{iemgui_pos((void *)x, &x->x_gui, s, ac, av);} - -static void hradio_color(t_hradio *x, t_symbol *s, int ac, t_atom *av) -{iemgui_color((void *)x, &x->x_gui, s, ac, av);} - -static void hradio_send(t_hradio *x, t_symbol *s) -{iemgui_send(x, &x->x_gui, s);} - -static void hradio_receive(t_hradio *x, t_symbol *s) -{iemgui_receive(x, &x->x_gui, s);} - -static void hradio_label(t_hradio *x, t_symbol *s) -{iemgui_label((void *)x, &x->x_gui, s);} - -static void hradio_label_pos(t_hradio *x, t_symbol *s, int ac, t_atom *av) -{iemgui_label_pos((void *)x, &x->x_gui, s, ac, av);} - -static void hradio_label_font(t_hradio *x, t_symbol *s, int ac, t_atom *av) -{iemgui_label_font((void *)x, &x->x_gui, s, ac, av);} - -static void hradio_init(t_hradio *x, t_floatarg f) -{ - x->x_gui.x_isa.x_loadinit = (f==0.0)?0:1; -} - -static void hradio_double_change(t_hradio *x) -{x->x_change = 1;} - -static void hradio_single_change(t_hradio *x) -{x->x_change = 0;} - -static void *hradio_donew(t_symbol *s, int argc, t_atom *argv, int old) -{ - t_hradio *x = (t_hradio *)pd_new(old? hradio_old_class : hradio_class); - int bflcol[]={-262144, -1, -1}; - int a=IEM_GUI_DEFAULTSIZE, on=0, f=0; - int ldx=0, ldy=-8, chg=1, num=8; - int fs=10; - int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME, fthold=IEM_BNG_DEFAULTHOLDFLASHTIME; - char str[144]; - - iem_inttosymargs(&x->x_gui.x_isa, 0); - iem_inttofstyle(&x->x_gui.x_fsf, 0); - - if((argc == 15)&&IS_A_FLOAT(argv,0)&&IS_A_FLOAT(argv,1)&&IS_A_FLOAT(argv,2) - &&IS_A_FLOAT(argv,3) - &&(IS_A_SYMBOL(argv,4)||IS_A_FLOAT(argv,4)) - &&(IS_A_SYMBOL(argv,5)||IS_A_FLOAT(argv,5)) - &&(IS_A_SYMBOL(argv,6)||IS_A_FLOAT(argv,6)) - &&IS_A_FLOAT(argv,7)&&IS_A_FLOAT(argv,8) - &&IS_A_FLOAT(argv,9)&&IS_A_FLOAT(argv,10)&&IS_A_FLOAT(argv,11) - &&IS_A_FLOAT(argv,12)&&IS_A_FLOAT(argv,13)&&IS_A_FLOAT(argv,14)) - { - a = (int)atom_getintarg(0, argc, argv); - chg = (int)atom_getintarg(1, argc, argv); - iem_inttosymargs(&x->x_gui.x_isa, atom_getintarg(2, argc, argv)); - num = (int)atom_getintarg(3, argc, argv); - iemgui_new_getnames(&x->x_gui, 4, argv); - ldx = (int)atom_getintarg(7, argc, argv); - ldy = (int)atom_getintarg(8, argc, argv); - iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(9, argc, argv)); - fs = (int)atom_getintarg(10, argc, argv); - bflcol[0] = (int)atom_getintarg(11, argc, argv); - bflcol[1] = (int)atom_getintarg(12, argc, argv); - bflcol[2] = (int)atom_getintarg(13, argc, argv); - on = (int)atom_getintarg(14, argc, argv); - } - else iemgui_new_getnames(&x->x_gui, 4, 0); - x->x_gui.x_draw = (t_iemfunptr)hradio_draw; - x->x_gui.x_fsf.x_snd_able = 1; - x->x_gui.x_fsf.x_rcv_able = 1; - x->x_gui.x_glist = (t_glist *)canvas_getcurrent(); - if (!strcmp(x->x_gui.x_snd->s_name, "empty")) - x->x_gui.x_fsf.x_snd_able = 0; - if (!strcmp(x->x_gui.x_rcv->s_name, "empty")) - x->x_gui.x_fsf.x_rcv_able = 0; - if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica"); - else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times"); - else { x->x_gui.x_fsf.x_font_style = 0; - strcpy(x->x_gui.x_font, sys_font); } - if(num < 1) - num = 1; - if(num > IEM_RADIO_MAX) - num = IEM_RADIO_MAX; - x->x_number = num; - if(on < 0) - on = 0; - if(on >= x->x_number) - on = x->x_number - 1; - if(x->x_gui.x_isa.x_loadinit) - x->x_on = on; - else - x->x_on = 0; - x->x_on_old = x->x_on; - x->x_change = (chg==0)?0:1; - if (x->x_gui.x_fsf.x_rcv_able) - pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); - x->x_gui.x_ldx = ldx; - x->x_gui.x_ldy = ldy; - if(fs < 4) - fs = 4; - x->x_gui.x_fontsize = fs; - x->x_gui.x_w = iemgui_clip_size(a); - x->x_gui.x_h = x->x_gui.x_w; - iemgui_verify_snd_ne_rcv(&x->x_gui); - iemgui_all_colfromload(&x->x_gui, bflcol); - outlet_new(&x->x_gui.x_obj, &s_list); - return (x); -} - -static void *hradio_new(t_symbol *s, int argc, t_atom *argv) -{ - return (hradio_donew(s, argc, argv, 0)); -} - -static void *hdial_new(t_symbol *s, int argc, t_atom *argv) -{ - return (hradio_donew(s, argc, argv, 1)); -} - -static void hradio_ff(t_hradio *x) -{ - if(x->x_gui.x_fsf.x_rcv_able) - pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); - gfxstub_deleteforkey(x); -} - -void hradio_setup(void) -{ - hradio_class = class_new(gensym("hradio"), (t_newmethod)hradio_new, - (t_method)hradio_ff, sizeof(t_hradio), 0, A_GIMME, 0); - class_addbang(hradio_class, hradio_bang); - class_addfloat(hradio_class, hradio_float); - class_addmethod(hradio_class, (t_method)hradio_click, gensym("click"), - A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); - class_addmethod(hradio_class, (t_method)hradio_dialog, gensym("dialog"), - A_GIMME, 0); - class_addmethod(hradio_class, (t_method)hradio_loadbang, - gensym("loadbang"), 0); - class_addmethod(hradio_class, (t_method)hradio_set, - gensym("set"), A_FLOAT, 0); - class_addmethod(hradio_class, (t_method)hradio_size, - gensym("size"), A_GIMME, 0); - class_addmethod(hradio_class, (t_method)hradio_delta, - gensym("delta"), A_GIMME, 0); - class_addmethod(hradio_class, (t_method)hradio_pos, - gensym("pos"), A_GIMME, 0); - class_addmethod(hradio_class, (t_method)hradio_color, - gensym("color"), A_GIMME, 0); - class_addmethod(hradio_class, (t_method)hradio_send, - gensym("send"), A_DEFSYM, 0); - class_addmethod(hradio_class, (t_method)hradio_receive, - gensym("receive"), A_DEFSYM, 0); - class_addmethod(hradio_class, (t_method)hradio_label, - gensym("label"), A_DEFSYM, 0); - class_addmethod(hradio_class, (t_method)hradio_label_pos, - gensym("label_pos"), A_GIMME, 0); - class_addmethod(hradio_class, (t_method)hradio_label_font, - gensym("label_font"), A_GIMME, 0); - class_addmethod(hradio_class, (t_method)hradio_init, - gensym("init"), A_FLOAT, 0); - class_addmethod(hradio_class, (t_method)hradio_number, - gensym("number"), A_FLOAT, 0); - class_addmethod(hradio_class, (t_method)hradio_single_change, - gensym("single_change"), 0); - class_addmethod(hradio_class, (t_method)hradio_double_change, - gensym("double_change"), 0); - hradio_widgetbehavior.w_getrectfn = hradio_getrect; - hradio_widgetbehavior.w_displacefn = iemgui_displace; - hradio_widgetbehavior.w_selectfn = iemgui_select; - hradio_widgetbehavior.w_activatefn = NULL; - hradio_widgetbehavior.w_deletefn = iemgui_delete; - hradio_widgetbehavior.w_visfn = iemgui_vis; - hradio_widgetbehavior.w_clickfn = hradio_newclick; - class_setwidget(hradio_class, &hradio_widgetbehavior); - class_sethelpsymbol(hradio_class, gensym("hradio")); - class_setsavefn(hradio_class, hradio_save); - class_setpropertiesfn(hradio_class, hradio_properties); - - /*obsolete version (0.34-0.35) */ - hradio_old_class = class_new(gensym("hdl"), (t_newmethod)hdial_new, - (t_method)hradio_ff, sizeof(t_hradio), 0, A_GIMME, 0); - class_addcreator((t_newmethod)hradio_new, gensym("rdb"), A_GIMME, 0); - class_addcreator((t_newmethod)hradio_new, gensym("radiobut"), A_GIMME, 0); - class_addcreator((t_newmethod)hradio_new, gensym("radiobutton"), - A_GIMME, 0); - class_addbang(hradio_old_class, hradio_bang); - class_addfloat(hradio_old_class, hradio_float); - class_addmethod(hradio_old_class, (t_method)hradio_click, gensym("click"), - A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); - class_addmethod(hradio_old_class, (t_method)hradio_dialog, gensym("dialog"), - A_GIMME, 0); - class_addmethod(hradio_old_class, (t_method)hradio_loadbang, - gensym("loadbang"), 0); - class_addmethod(hradio_old_class, (t_method)hradio_set, - gensym("set"), A_FLOAT, 0); - class_addmethod(hradio_old_class, (t_method)hradio_size, - gensym("size"), A_GIMME, 0); - class_addmethod(hradio_old_class, (t_method)hradio_delta, - gensym("delta"), A_GIMME, 0); - class_addmethod(hradio_old_class, (t_method)hradio_pos, - gensym("pos"), A_GIMME, 0); - class_addmethod(hradio_old_class, (t_method)hradio_color, - gensym("color"), A_GIMME, 0); - class_addmethod(hradio_old_class, (t_method)hradio_send, - gensym("send"), A_DEFSYM, 0); - class_addmethod(hradio_old_class, (t_method)hradio_receive, - gensym("receive"), A_DEFSYM, 0); - class_addmethod(hradio_old_class, (t_method)hradio_label, - gensym("label"), A_DEFSYM, 0); - class_addmethod(hradio_old_class, (t_method)hradio_label_pos, - gensym("label_pos"), A_GIMME, 0); - class_addmethod(hradio_old_class, (t_method)hradio_label_font, - gensym("label_font"), A_GIMME, 0); - class_addmethod(hradio_old_class, (t_method)hradio_init, - gensym("init"), A_FLOAT, 0); - class_addmethod(hradio_old_class, (t_method)hradio_number, - gensym("number"), A_FLOAT, 0); - class_addmethod(hradio_old_class, (t_method)hradio_single_change, - gensym("single_change"), 0); - class_addmethod(hradio_old_class, (t_method)hradio_double_change, - gensym("double_change"), 0); - class_setwidget(hradio_old_class, &hradio_widgetbehavior); - class_sethelpsymbol(hradio_old_class, gensym("hradio")); -} diff --git a/externals/vanilla/hsl.c b/externals/vanilla/hsl.c deleted file mode 100644 index 05474a23d7f27884e9eb67e7ceb100375cb2c21c..0000000000000000000000000000000000000000 --- a/externals/vanilla/hsl.c +++ /dev/null @@ -1,656 +0,0 @@ -/* Copyright (c) 1997-1999 Miller Puckette. - * For information on usage and redistribution, and for a DISCLAIMER OF ALL - * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -/* g_7_guis.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ -/* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */ - - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <ctype.h> -#include "m_pd.h" -#include "g_canvas.h" - -#include "g_all_guis.h" -#include <math.h> - -#ifdef MSW -#include <io.h> -#else -#include <unistd.h> -#endif - - -/* ------------ hsl gui-horicontal slider ----------------------- */ - -t_widgetbehavior hslider_widgetbehavior; -static t_class *hslider_class; - -/* widget helper functions */ - -static void hslider_draw_update(t_gobj *client, t_glist *glist) -{ - t_hslider *x = (t_hslider *)client; - t_canvas *canvas=glist_getcanvas(glist); - int ypos=text_ypix(&x->x_gui.x_obj, glist); - - if (glist_isvisible(glist)) - { - int r = text_xpix(&x->x_gui.x_obj, glist) + (x->x_val + 50)/100; - sys_vgui(".x%lx.c coords %lxKNOB %d %d %d %d\n", - canvas, x, r, ypos+1, - r, ypos + x->x_gui.x_h); - if(x->x_val == x->x_center) - { - if(!x->x_thick) - { - sys_vgui(".x%lx.c itemconfigure %lxKNOB -width 7\n", canvas, x); - x->x_thick = 1; - } - } - else - { - if(x->x_thick) - { - sys_vgui(".x%lx.c itemconfigure %lxKNOB -width 3\n", canvas, x); - x->x_thick = 0; - } - } - } -} - -static void hslider_draw_new(t_hslider *x, t_glist *glist) -{ - int xpos=text_xpix(&x->x_gui.x_obj, glist); - int ypos=text_ypix(&x->x_gui.x_obj, glist); - int r = xpos + (x->x_val + 50)/100; - t_canvas *canvas=glist_getcanvas(glist); - - sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill #%6.6x -tags %lxBASE\n", - canvas, xpos-3, ypos, - xpos + x->x_gui.x_w+2, ypos + x->x_gui.x_h, - x->x_gui.x_bcol, x); - sys_vgui(".x%lx.c create line %d %d %d %d -width 3 -fill #%6.6x -tags %lxKNOB\n", - canvas, r, ypos+1, r, - ypos + x->x_gui.x_h, x->x_gui.x_fcol, x); - sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \ - -font {{%s} -%d %s} -fill #%6.6x -tags %lxLABEL\n", - canvas, xpos+x->x_gui.x_ldx, - ypos+x->x_gui.x_ldy, - strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"", - x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, - x->x_gui.x_lcol, x); - if(!x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxOUT%d\n", - canvas, xpos-3, ypos + x->x_gui.x_h-1, - xpos+4, ypos + x->x_gui.x_h, x, 0); - if(!x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxIN%d\n", - canvas, xpos-3, ypos, - xpos+4, ypos+1, x, 0); -} - -static void hslider_draw_move(t_hslider *x, t_glist *glist) -{ - int xpos=text_xpix(&x->x_gui.x_obj, glist); - int ypos=text_ypix(&x->x_gui.x_obj, glist); - int r = xpos + (x->x_val + 50)/100; - t_canvas *canvas=glist_getcanvas(glist); - - sys_vgui(".x%lx.c coords %lxBASE %d %d %d %d\n", - canvas, x, - xpos-3, ypos, - xpos + x->x_gui.x_w+2, ypos + x->x_gui.x_h); - sys_vgui(".x%lx.c coords %lxKNOB %d %d %d %d\n", - canvas, x, r, ypos+1, - r, ypos + x->x_gui.x_h); - sys_vgui(".x%lx.c coords %lxLABEL %d %d\n", - canvas, x, xpos+x->x_gui.x_ldx, ypos+x->x_gui.x_ldy); - if(!x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c coords %lxOUT%d %d %d %d %d\n", - canvas, x, 0, - xpos-3, ypos + x->x_gui.x_h-1, - xpos+4, ypos + x->x_gui.x_h); - if(!x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c coords %lxIN%d %d %d %d %d\n", - canvas, x, 0, - xpos-3, ypos, - xpos+4, ypos+1); -} - -static void hslider_draw_erase(t_hslider* x,t_glist* glist) -{ - t_canvas *canvas=glist_getcanvas(glist); - - sys_vgui(".x%lx.c delete %lxBASE\n", canvas, x); - sys_vgui(".x%lx.c delete %lxKNOB\n", canvas, x); - sys_vgui(".x%lx.c delete %lxLABEL\n", canvas, x); - if(!x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c delete %lxOUT%d\n", canvas, x, 0); - if(!x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c delete %lxIN%d\n", canvas, x, 0); -} - -static void hslider_draw_config(t_hslider* x,t_glist* glist) -{ - t_canvas *canvas=glist_getcanvas(glist); - - sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {{%s} -%d %s} -fill #%6.6x -text {%s} \n", - canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, - x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_lcol, - strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:""); - sys_vgui(".x%lx.c itemconfigure %lxKNOB -fill #%6.6x\n", canvas, x, x->x_gui.x_fcol); - sys_vgui(".x%lx.c itemconfigure %lxBASE -fill #%6.6x\n", canvas, x, x->x_gui.x_bcol); -} - -static void hslider_draw_io(t_hslider* x,t_glist* glist, int old_snd_rcv_flags) -{ - int xpos=text_xpix(&x->x_gui.x_obj, glist); - int ypos=text_ypix(&x->x_gui.x_obj, glist); - t_canvas *canvas=glist_getcanvas(glist); - - if((old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && !x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxOUT%d\n", - canvas, xpos-3, ypos + x->x_gui.x_h-1, - xpos+4, ypos + x->x_gui.x_h, x, 0); - if(!(old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c delete %lxOUT%d\n", canvas, x, 0); - if((old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && !x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxIN%d\n", - canvas, xpos-3, ypos, - xpos+4, ypos+1, x, 0); - if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c delete %lxIN%d\n", canvas, x, 0); -} - -static void hslider_draw_select(t_hslider* x,t_glist* glist) -{ - t_canvas *canvas=glist_getcanvas(glist); - - if(x->x_gui.x_fsf.x_selected) - { - sys_vgui(".x%lx.c itemconfigure %lxBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED); - sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED); - } - else - { - sys_vgui(".x%lx.c itemconfigure %lxBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); - sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol); - } -} - -void hslider_draw(t_hslider *x, t_glist *glist, int mode) -{ - if(mode == IEM_GUI_DRAW_MODE_UPDATE) - sys_queuegui(x, glist, hslider_draw_update); - else if(mode == IEM_GUI_DRAW_MODE_MOVE) - hslider_draw_move(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_NEW) - hslider_draw_new(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_SELECT) - hslider_draw_select(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_ERASE) - hslider_draw_erase(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_CONFIG) - hslider_draw_config(x, glist); - else if(mode >= IEM_GUI_DRAW_MODE_IO) - hslider_draw_io(x, glist, mode - IEM_GUI_DRAW_MODE_IO); -} - -/* ------------------------ hsl widgetbehaviour----------------------------- */ - - -static void hslider_getrect(t_gobj *z, t_glist *glist, - int *xp1, int *yp1, int *xp2, int *yp2) -{ - t_hslider* x = (t_hslider*)z; - - *xp1 = text_xpix(&x->x_gui.x_obj, glist) - 3; - *yp1 = text_ypix(&x->x_gui.x_obj, glist); - *xp2 = *xp1 + x->x_gui.x_w + 5; - *yp2 = *yp1 + x->x_gui.x_h; -} - -static void hslider_save(t_gobj *z, t_binbuf *b) -{ - t_hslider *x = (t_hslider *)z; - int bflcol[3]; - t_symbol *srl[3]; - - iemgui_save(&x->x_gui, srl, bflcol); - binbuf_addv(b, "ssiisiiffiisssiiiiiiiii", gensym("#X"),gensym("obj"), - (int)x->x_gui.x_obj.te_xpix, (int)x->x_gui.x_obj.te_ypix, - gensym("hsl"), x->x_gui.x_w, x->x_gui.x_h, - (t_float)x->x_min, (t_float)x->x_max, - x->x_lin0_log1, iem_symargstoint(&x->x_gui.x_isa), - srl[0], srl[1], srl[2], - x->x_gui.x_ldx, x->x_gui.x_ldy, - iem_fstyletoint(&x->x_gui.x_fsf), x->x_gui.x_fontsize, - bflcol[0], bflcol[1], bflcol[2], - x->x_val, x->x_steady); - binbuf_addv(b, ";"); -} - -void hslider_check_width(t_hslider *x, int w) -{ - if(w < IEM_SL_MINSIZE) - w = IEM_SL_MINSIZE; - x->x_gui.x_w = w; - x->x_center = (x->x_gui.x_w-1)*50; - if(x->x_val > (x->x_gui.x_w*100 - 100)) - { - x->x_pos = x->x_gui.x_w*100 - 100; - x->x_val = x->x_pos; - } - if(x->x_lin0_log1) - x->x_k = log(x->x_max/x->x_min)/(double)(x->x_gui.x_w - 1); - else - x->x_k = (x->x_max - x->x_min)/(double)(x->x_gui.x_w - 1); -} - -void hslider_check_minmax(t_hslider *x, double min, double max) -{ - if(x->x_lin0_log1) - { - if((min == 0.0)&&(max == 0.0)) - max = 1.0; - if(max > 0.0) - { - if(min <= 0.0) - min = 0.01*max; - } - else - { - if(min > 0.0) - max = 0.01*min; - } - } - x->x_min = min; - x->x_max = max; - if(x->x_min > x->x_max) /* bugfix */ - x->x_gui.x_isa.x_reverse = 1; - else - x->x_gui.x_isa.x_reverse = 0; - if(x->x_lin0_log1) - x->x_k = log(x->x_max/x->x_min)/(double)(x->x_gui.x_w - 1); - else - x->x_k = (x->x_max - x->x_min)/(double)(x->x_gui.x_w - 1); -} - -static void hslider_properties(t_gobj *z, t_glist *owner) -{ - t_hslider *x = (t_hslider *)z; - char buf[800]; - t_symbol *srl[3]; - - iemgui_properties(&x->x_gui, srl); - sprintf(buf, "pdtk_iemgui_dialog %%s |hsl| \ - --------dimensions(pix)(pix):-------- %d %d width: %d %d height: \ - -----------output-range:----------- %g left: %g right: %g \ - %d lin log %d %d empty %d \ - %s %s \ - %s %d %d \ - %d %d \ - %d %d %d\n", - x->x_gui.x_w, IEM_SL_MINSIZE, x->x_gui.x_h, IEM_GUI_MINSIZE, - x->x_min, x->x_max, 0.0,/*no_schedule*/ - x->x_lin0_log1, x->x_gui.x_isa.x_loadinit, x->x_steady, -1,/*no multi, but iem-characteristic*/ - srl[0]->s_name, srl[1]->s_name, - srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy, - x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize, - 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol); - gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); -} - -static void hslider_set(t_hslider *x, t_floatarg f) /* bugfix */ -{ - double g; - - if(x->x_gui.x_isa.x_reverse) /* bugfix */ - { - if(f > x->x_min) - f = x->x_min; - if(f < x->x_max) - f = x->x_max; - } - else - { - if(f > x->x_max) - f = x->x_max; - if(f < x->x_min) - f = x->x_min; - } - if(x->x_lin0_log1) - g = log(f/x->x_min)/x->x_k; - else - g = (f - x->x_min) / x->x_k; - x->x_val = (int)(100.0*g + 0.49999); - x->x_pos = x->x_val; - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); -} - -static void hslider_bang(t_hslider *x) -{ - double out; - - if(x->x_lin0_log1) - out = x->x_min*exp(x->x_k*(double)(x->x_val)*0.01); - else - out = (double)(x->x_val)*0.01*x->x_k + x->x_min; - if((out < 1.0e-10)&&(out > -1.0e-10)) - out = 0.0; - outlet_float(x->x_gui.x_obj.ob_outlet, out); - if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) - pd_float(x->x_gui.x_snd->s_thing, out); -} - -static void hslider_dialog(t_hslider *x, t_symbol *s, int argc, t_atom *argv) -{ - t_symbol *srl[3]; - int w = (int)atom_getintarg(0, argc, argv); - int h = (int)atom_getintarg(1, argc, argv); - double min = (double)atom_getfloatarg(2, argc, argv); - double max = (double)atom_getfloatarg(3, argc, argv); - int lilo = (int)atom_getintarg(4, argc, argv); - int steady = (int)atom_getintarg(17, argc, argv); - int sr_flags; - - if(lilo != 0) lilo = 1; - x->x_lin0_log1 = lilo; - if(steady) - x->x_steady = 1; - else - x->x_steady = 0; - sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv); - x->x_gui.x_h = iemgui_clip_size(h); - hslider_check_width(x, w); - hslider_check_minmax(x, min, max); - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG); - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_IO + sr_flags); - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE); - canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x); -} - -static void hslider_motion(t_hslider *x, t_floatarg dx, t_floatarg dy) -{ - int old = x->x_val; - - if(x->x_gui.x_fsf.x_finemoved) - x->x_pos += (int)dx; - else - x->x_pos += 100*(int)dx; - x->x_val = x->x_pos; - if(x->x_val > (100*x->x_gui.x_w - 100)) - { - x->x_val = 100*x->x_gui.x_w - 100; - x->x_pos += 50; - x->x_pos -= x->x_pos%100; - } - if(x->x_val < 0) - { - x->x_val = 0; - x->x_pos -= 50; - x->x_pos -= x->x_pos%100; - } - if(old != x->x_val) - { - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); - hslider_bang(x); - } -} - -static void hslider_click(t_hslider *x, t_floatarg xpos, t_floatarg ypos, - t_floatarg shift, t_floatarg ctrl, t_floatarg alt) -{ - if(!x->x_steady) - x->x_val = (int)(100.0 * (xpos - text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist))); - if(x->x_val > (100*x->x_gui.x_w - 100)) - x->x_val = 100*x->x_gui.x_w - 100; - if(x->x_val < 0) - x->x_val = 0; - x->x_pos = x->x_val; - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); - hslider_bang(x); - glist_grab(x->x_gui.x_glist, &x->x_gui.x_obj.te_g, (t_glistmotionfn)hslider_motion, - 0, xpos, ypos); -} - -static int hslider_newclick(t_gobj *z, struct _glist *glist, - int xpix, int ypix, int shift, int alt, int dbl, int doit) -{ - t_hslider* x = (t_hslider *)z; - - if(doit) - { - hslider_click( x, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, - 0, (t_floatarg)alt); - if(shift) - x->x_gui.x_fsf.x_finemoved = 1; - else - x->x_gui.x_fsf.x_finemoved = 0; - } - return (1); -} - -static void hslider_size(t_hslider *x, t_symbol *s, int ac, t_atom *av) -{ - hslider_check_width(x, (int)atom_getintarg(0, ac, av)); - if(ac > 1) - x->x_gui.x_h = iemgui_clip_size((int)atom_getintarg(1, ac, av)); - iemgui_size((void *)x, &x->x_gui); -} - -static void hslider_delta(t_hslider *x, t_symbol *s, int ac, t_atom *av) -{iemgui_delta((void *)x, &x->x_gui, s, ac, av);} - -static void hslider_pos(t_hslider *x, t_symbol *s, int ac, t_atom *av) -{iemgui_pos((void *)x, &x->x_gui, s, ac, av);} - -static void hslider_range(t_hslider *x, t_symbol *s, int ac, t_atom *av) -{ - hslider_check_minmax(x, (double)atom_getfloatarg(0, ac, av), - (double)atom_getfloatarg(1, ac, av)); -} - -static void hslider_color(t_hslider *x, t_symbol *s, int ac, t_atom *av) -{iemgui_color((void *)x, &x->x_gui, s, ac, av);} - -static void hslider_send(t_hslider *x, t_symbol *s) -{iemgui_send(x, &x->x_gui, s);} - -static void hslider_receive(t_hslider *x, t_symbol *s) -{iemgui_receive(x, &x->x_gui, s);} - -static void hslider_label(t_hslider *x, t_symbol *s) -{iemgui_label((void *)x, &x->x_gui, s);} - -static void hslider_label_pos(t_hslider *x, t_symbol *s, int ac, t_atom *av) -{iemgui_label_pos((void *)x, &x->x_gui, s, ac, av);} - -static void hslider_label_font(t_hslider *x, t_symbol *s, int ac, t_atom *av) -{iemgui_label_font((void *)x, &x->x_gui, s, ac, av);} - -static void hslider_log(t_hslider *x) -{ - x->x_lin0_log1 = 1; - hslider_check_minmax(x, x->x_min, x->x_max); -} - -static void hslider_lin(t_hslider *x) -{ - x->x_lin0_log1 = 0; - x->x_k = (x->x_max - x->x_min)/(double)(x->x_gui.x_w - 1); -} - -static void hslider_init(t_hslider *x, t_floatarg f) -{ - x->x_gui.x_isa.x_loadinit = (f==0.0)?0:1; -} - -static void hslider_steady(t_hslider *x, t_floatarg f) -{ - x->x_steady = (f==0.0)?0:1; -} - -static void hslider_float(t_hslider *x, t_floatarg f) -{ - double out; - - hslider_set(x, f); - if(x->x_lin0_log1) - out = x->x_min*exp(x->x_k*(double)(x->x_val)*0.01); - else - out = (double)(x->x_val)*0.01*x->x_k + x->x_min; - if((out < 1.0e-10)&&(out > -1.0e-10)) - out = 0.0; - if(x->x_gui.x_fsf.x_put_in2out) - { - outlet_float(x->x_gui.x_obj.ob_outlet, out); - if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) - pd_float(x->x_gui.x_snd->s_thing, out); - } -} - -static void hslider_loadbang(t_hslider *x) -{ - if(!sys_noloadbang && x->x_gui.x_isa.x_loadinit) - { - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); - hslider_bang(x); - } -} - -static void *hslider_new(t_symbol *s, int argc, t_atom *argv) -{ - t_hslider *x = (t_hslider *)pd_new(hslider_class); - int bflcol[]={-262144, -1, -1}; - int w=IEM_SL_DEFAULTSIZE, h=IEM_GUI_DEFAULTSIZE; - int lilo=0, ldx=-2, ldy=-8, f=0, v=0, steady=1; - int fs=10; - double min=0.0, max=(double)(IEM_SL_DEFAULTSIZE-1); - char str[144]; - - iem_inttosymargs(&x->x_gui.x_isa, 0); - iem_inttofstyle(&x->x_gui.x_fsf, 0); - - if(((argc == 17)||(argc == 18))&&IS_A_FLOAT(argv,0)&&IS_A_FLOAT(argv,1) - &&IS_A_FLOAT(argv,2)&&IS_A_FLOAT(argv,3) - &&IS_A_FLOAT(argv,4)&&IS_A_FLOAT(argv,5) - &&(IS_A_SYMBOL(argv,6)||IS_A_FLOAT(argv,6)) - &&(IS_A_SYMBOL(argv,7)||IS_A_FLOAT(argv,7)) - &&(IS_A_SYMBOL(argv,8)||IS_A_FLOAT(argv,8)) - &&IS_A_FLOAT(argv,9)&&IS_A_FLOAT(argv,10) - &&IS_A_FLOAT(argv,11)&&IS_A_FLOAT(argv,12)&&IS_A_FLOAT(argv,13) - &&IS_A_FLOAT(argv,14)&&IS_A_FLOAT(argv,15)&&IS_A_FLOAT(argv,16)) - { - w = (int)atom_getintarg(0, argc, argv); - h = (int)atom_getintarg(1, argc, argv); - min = (double)atom_getfloatarg(2, argc, argv); - max = (double)atom_getfloatarg(3, argc, argv); - lilo = (int)atom_getintarg(4, argc, argv); - iem_inttosymargs(&x->x_gui.x_isa, atom_getintarg(5, argc, argv)); - iemgui_new_getnames(&x->x_gui, 6, argv); - ldx = (int)atom_getintarg(9, argc, argv); - ldy = (int)atom_getintarg(10, argc, argv); - iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(11, argc, argv)); - fs = (int)atom_getintarg(12, argc, argv); - bflcol[0] = (int)atom_getintarg(13, argc, argv); - bflcol[1] = (int)atom_getintarg(14, argc, argv); - bflcol[2] = (int)atom_getintarg(15, argc, argv); - v = (int)atom_getintarg(16, argc, argv); - } - else iemgui_new_getnames(&x->x_gui, 6, 0); - if((argc == 18)&&IS_A_FLOAT(argv,17)) - steady = (int)atom_getintarg(17, argc, argv); - - x->x_gui.x_draw = (t_iemfunptr)hslider_draw; - - x->x_gui.x_fsf.x_snd_able = 1; - x->x_gui.x_fsf.x_rcv_able = 1; - - x->x_gui.x_glist = (t_glist *)canvas_getcurrent(); - if(x->x_gui.x_isa.x_loadinit) - x->x_val = v; - else - x->x_val = 0; - x->x_pos = x->x_val; - if(lilo != 0) lilo = 1; - x->x_lin0_log1 = lilo; - if(steady != 0) steady = 1; - x->x_steady = steady; - if (!strcmp(x->x_gui.x_snd->s_name, "empty")) - x->x_gui.x_fsf.x_snd_able = 0; - if (!strcmp(x->x_gui.x_rcv->s_name, "empty")) - x->x_gui.x_fsf.x_rcv_able = 0; - if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica"); - else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times"); - else { x->x_gui.x_fsf.x_font_style = 0; - strcpy(x->x_gui.x_font, sys_font); } - if(x->x_gui.x_fsf.x_rcv_able) - pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); - x->x_gui.x_ldx = ldx; - x->x_gui.x_ldy = ldy; - if(fs < 4) - fs = 4; - x->x_gui.x_fontsize = fs; - x->x_gui.x_h = iemgui_clip_size(h); - hslider_check_width(x, w); - hslider_check_minmax(x, min, max); - iemgui_all_colfromload(&x->x_gui, bflcol); - x->x_thick = 0; - iemgui_verify_snd_ne_rcv(&x->x_gui); - outlet_new(&x->x_gui.x_obj, &s_float); - return (x); -} - -static void hslider_free(t_hslider *x) -{ - if(x->x_gui.x_fsf.x_rcv_able) - pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); - gfxstub_deleteforkey(x); -} - -void hsl_setup(void) -{ - hslider_class = class_new(gensym("hsl"), (t_newmethod)hslider_new, - (t_method)hslider_free, sizeof(t_hslider), 0, A_GIMME, 0); -#ifndef GGEE_HSLIDER_COMPATIBLE - class_addcreator((t_newmethod)hslider_new, gensym("hslider"), A_GIMME, 0); -#endif - class_addbang(hslider_class,hslider_bang); - class_addfloat(hslider_class,hslider_float); - class_addmethod(hslider_class, (t_method)hslider_click, gensym("click"), - A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); - class_addmethod(hslider_class, (t_method)hslider_motion, gensym("motion"), - A_FLOAT, A_FLOAT, 0); - class_addmethod(hslider_class, (t_method)hslider_dialog, gensym("dialog"), A_GIMME, 0); - class_addmethod(hslider_class, (t_method)hslider_loadbang, gensym("loadbang"), 0); - class_addmethod(hslider_class, (t_method)hslider_set, gensym("set"), A_FLOAT, 0); - class_addmethod(hslider_class, (t_method)hslider_size, gensym("size"), A_GIMME, 0); - class_addmethod(hslider_class, (t_method)hslider_delta, gensym("delta"), A_GIMME, 0); - class_addmethod(hslider_class, (t_method)hslider_pos, gensym("pos"), A_GIMME, 0); - class_addmethod(hslider_class, (t_method)hslider_range, gensym("range"), A_GIMME, 0); - class_addmethod(hslider_class, (t_method)hslider_color, gensym("color"), A_GIMME, 0); - class_addmethod(hslider_class, (t_method)hslider_send, gensym("send"), A_DEFSYM, 0); - class_addmethod(hslider_class, (t_method)hslider_receive, gensym("receive"), A_DEFSYM, 0); - class_addmethod(hslider_class, (t_method)hslider_label, gensym("label"), A_DEFSYM, 0); - class_addmethod(hslider_class, (t_method)hslider_label_pos, gensym("label_pos"), A_GIMME, 0); - class_addmethod(hslider_class, (t_method)hslider_label_font, gensym("label_font"), A_GIMME, 0); - class_addmethod(hslider_class, (t_method)hslider_log, gensym("log"), 0); - class_addmethod(hslider_class, (t_method)hslider_lin, gensym("lin"), 0); - class_addmethod(hslider_class, (t_method)hslider_init, gensym("init"), A_FLOAT, 0); - class_addmethod(hslider_class, (t_method)hslider_steady, gensym("steady"), A_FLOAT, 0); - hslider_widgetbehavior.w_getrectfn = hslider_getrect; - hslider_widgetbehavior.w_displacefn = iemgui_displace; - hslider_widgetbehavior.w_selectfn = iemgui_select; - hslider_widgetbehavior.w_activatefn = NULL; - hslider_widgetbehavior.w_deletefn = iemgui_delete; - hslider_widgetbehavior.w_visfn = iemgui_vis; - hslider_widgetbehavior.w_clickfn = hslider_newclick; - class_setwidget(hslider_class, &hslider_widgetbehavior); - class_sethelpsymbol(hslider_class, gensym("hslider")); - class_setsavefn(hslider_class, hslider_save); - class_setpropertiesfn(hslider_class, hslider_properties); -} diff --git a/externals/vanilla/key.c b/externals/vanilla/key.c deleted file mode 100644 index d389a9b390e127b10ea0ee9508f959fa7389f47d..0000000000000000000000000000000000000000 --- a/externals/vanilla/key.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (c) 1997-2000 Miller Puckette. -* For information on usage and redistribution, and for a DISCLAIMER OF ALL -* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -#include "m_pd.h" -#include <stdio.h> -#include <string.h> - -static t_symbol *key_sym; -static t_class *key_class; - -typedef struct _key -{ - t_object x_obj; -} t_key; - -static void *key_new( void) -{ - t_key *x = (t_key *)pd_new(key_class); - outlet_new(&x->x_obj, &s_float); - pd_bind(&x->x_obj.ob_pd, key_sym); - return (x); -} - -static void key_float(t_key *x, t_floatarg f) -{ - outlet_float(x->x_obj.ob_outlet, f); -} - -static void key_free(t_key *x) -{ - pd_unbind(&x->x_obj.ob_pd, key_sym); -} - -void key_setup(void) -{ - key_class = class_new(gensym("key"), - (t_newmethod)key_new, (t_method)key_free, - sizeof(t_key), CLASS_NOINLET, 0); - class_addfloat(key_class, key_float); - key_sym = gensym("#key"); -} - diff --git a/externals/vanilla/keyname.c b/externals/vanilla/keyname.c deleted file mode 100644 index 8834cc3040f8189b2bc0d8b95cbd7f55f95c270f..0000000000000000000000000000000000000000 --- a/externals/vanilla/keyname.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright (c) 1997-2000 Miller Puckette. -* For information on usage and redistribution, and for a DISCLAIMER OF ALL -* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -/* dialogs. LATER, deal with the situation where the object goes -away before the panel does... */ - -#include "m_pd.h" -#include <stdio.h> -#include <string.h> - -static t_symbol *keyname_sym; -static t_class *keyname_class; - -typedef struct _keyname -{ - t_object x_obj; - t_outlet *x_outlet1; - t_outlet *x_outlet2; -} t_keyname; - -static void *keyname_new( void) -{ - t_keyname *x = (t_keyname *)pd_new(keyname_class); - x->x_outlet1 = outlet_new(&x->x_obj, &s_float); - x->x_outlet2 = outlet_new(&x->x_obj, &s_symbol); - pd_bind(&x->x_obj.ob_pd, keyname_sym); - return (x); -} - -static void keyname_list(t_keyname *x, t_symbol *s, int ac, t_atom *av) -{ - outlet_symbol(x->x_outlet2, atom_getsymbolarg(1, ac, av)); - outlet_float(x->x_outlet1, atom_getfloatarg(0, ac, av)); -} - -static void keyname_free(t_keyname *x) -{ - pd_unbind(&x->x_obj.ob_pd, keyname_sym); -} - -void keyname_setup(void) -{ - keyname_class = class_new(gensym("keyname"), - (t_newmethod)keyname_new, (t_method)keyname_free, - sizeof(t_keyname), CLASS_NOINLET, 0); - class_addlist(keyname_class, keyname_list); - keyname_sym = gensym("#keyname"); - class_sethelpsymbol(keyname_class, gensym("key")); -} diff --git a/externals/vanilla/keyup.c b/externals/vanilla/keyup.c deleted file mode 100644 index 5034b75ae2932a1947f6b1c37d3ad93d6311c83d..0000000000000000000000000000000000000000 --- a/externals/vanilla/keyup.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (c) 1997-2000 Miller Puckette. -* For information on usage and redistribution, and for a DISCLAIMER OF ALL -* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -#include "m_pd.h" -#include <stdio.h> -#include <string.h> - -static t_symbol *keyup_sym; -static t_class *keyup_class; - -typedef struct _keyup -{ - t_object x_obj; -} t_keyup; - -static void *keyup_new( void) -{ - t_keyup *x = (t_keyup *)pd_new(keyup_class); - outlet_new(&x->x_obj, &s_float); - pd_bind(&x->x_obj.ob_pd, keyup_sym); - return (x); -} - -static void keyup_float(t_keyup *x, t_floatarg f) -{ - outlet_float(x->x_obj.ob_outlet, f); -} - -static void keyup_free(t_keyup *x) -{ - pd_unbind(&x->x_obj.ob_pd, keyup_sym); -} - -void keyup_setup(void) -{ - keyup_class = class_new(gensym("keyup"), - (t_newmethod)keyup_new, (t_method)keyup_free, - sizeof(t_keyup), CLASS_NOINLET, 0); - class_addfloat(keyup_class, keyup_float); - keyup_sym = gensym("#keyup"); - class_sethelpsymbol(keyup_class, gensym("key")); -} diff --git a/externals/vanilla/lib_d_arithmetic.c b/externals/vanilla/lib_d_arithmetic.c deleted file mode 100644 index 3f0a1cf97f1d850fed64da5545be4358a3fd402c..0000000000000000000000000000000000000000 --- a/externals/vanilla/lib_d_arithmetic.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../pd/src/d_arithmetic.c" -void lib_d_arithmetic_setup(void) -{ - d_arithmetic_setup(); -} diff --git a/externals/vanilla/lib_d_array.c b/externals/vanilla/lib_d_array.c deleted file mode 100644 index e548120fb09f9dd2f67c8e759dc89f98c7f986e3..0000000000000000000000000000000000000000 --- a/externals/vanilla/lib_d_array.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../pd/src/d_array.c" -void lib_d_array_setup(void) -{ - d_array_setup(); -} diff --git a/externals/vanilla/lib_d_ctl.c b/externals/vanilla/lib_d_ctl.c deleted file mode 100644 index 356315a836bd873643babc70b4525451a17021f2..0000000000000000000000000000000000000000 --- a/externals/vanilla/lib_d_ctl.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../pd/src/d_ctl.c" -void lib_d_ctl_setup(void) -{ - d_ctl_setup(); -} diff --git a/externals/vanilla/lib_d_dac.c b/externals/vanilla/lib_d_dac.c deleted file mode 100644 index a77ddf0cd18ce72665804130f65d4bd8d15fd372..0000000000000000000000000000000000000000 --- a/externals/vanilla/lib_d_dac.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../pd/src/d_dac.c" -void lib_d_dac_setup(void) -{ - d_dac_setup(); -} diff --git a/externals/vanilla/lib_d_delay.c b/externals/vanilla/lib_d_delay.c deleted file mode 100644 index 67fab6098605672eee6a7c8ac1093dc5c5bce2ea..0000000000000000000000000000000000000000 --- a/externals/vanilla/lib_d_delay.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../pd/src/d_delay.c" -void lib_d_delay_setup(void) -{ - d_delay_setup(); -} diff --git a/externals/vanilla/lib_d_fft.c b/externals/vanilla/lib_d_fft.c deleted file mode 100644 index 6cc6085b48ca3c2cd8bdd740f67775371646f897..0000000000000000000000000000000000000000 --- a/externals/vanilla/lib_d_fft.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "../../pd/src/d_fftroutine.c" -#include "../../pd/src/d_fft_mayer.c" -#include "../../pd/src/d_fft.c" -void lib_d_fft_setup(void) -{ - d_fft_setup(); -} diff --git a/externals/vanilla/lib_d_filter.c b/externals/vanilla/lib_d_filter.c deleted file mode 100644 index 80134665cc7d107d568964732330126ba3f7da89..0000000000000000000000000000000000000000 --- a/externals/vanilla/lib_d_filter.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../pd/src/d_filter.c" -void lib_d_filter_setup(void) -{ - d_filter_setup(); -} diff --git a/externals/vanilla/lib_d_global.c b/externals/vanilla/lib_d_global.c deleted file mode 100644 index 3c7c4487cdfa685e552dfc5a4acdb9800eadbf0c..0000000000000000000000000000000000000000 --- a/externals/vanilla/lib_d_global.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../pd/src/d_global.c" -void lib_d_global_setup(void) -{ - d_global_setup(); -} diff --git a/externals/vanilla/lib_d_math.c b/externals/vanilla/lib_d_math.c deleted file mode 100644 index d960543154414789c992aba3ec2e6ddeedc666fd..0000000000000000000000000000000000000000 --- a/externals/vanilla/lib_d_math.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../pd/src/d_math.c" -void lib_d_math_setup(void) -{ - d_math_setup(); -} diff --git a/externals/vanilla/lib_d_misc.c b/externals/vanilla/lib_d_misc.c deleted file mode 100644 index fb70d525c2ef0ad2cb5190aa4f965a0c1ace3ee7..0000000000000000000000000000000000000000 --- a/externals/vanilla/lib_d_misc.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../pd/src/d_misc.c" -void lib_d_misc_setup(void) -{ - d_misc_setup(); -} diff --git a/externals/vanilla/lib_d_osc.c b/externals/vanilla/lib_d_osc.c deleted file mode 100644 index acd8fdd58cdaa0aeb74e5cfa090e316d722474bd..0000000000000000000000000000000000000000 --- a/externals/vanilla/lib_d_osc.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../pd/src/d_osc.c" -void lib_d_osc_setup(void) -{ - d_osc_setup(); -} diff --git a/externals/vanilla/lib_d_soundfile.c b/externals/vanilla/lib_d_soundfile.c deleted file mode 100644 index 8305559e6d53de58aca6900d22f63b8fcce25004..0000000000000000000000000000000000000000 --- a/externals/vanilla/lib_d_soundfile.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../pd/src/d_soundfile.c" -void lib_d_soundfile_setup(void) -{ - d_soundfile_setup(); -} diff --git a/externals/vanilla/lib_d_ugen.c b/externals/vanilla/lib_d_ugen.c deleted file mode 100644 index 30a9ec050efa7194354f9d7ba4dc7c6ce9cfd903..0000000000000000000000000000000000000000 --- a/externals/vanilla/lib_d_ugen.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../pd/src/d_ugen.c" -void lib_d_ugen_setup(void) -{ - d_ugen_setup(); -} diff --git a/externals/vanilla/lib_x_acoustics.c b/externals/vanilla/lib_x_acoustics.c deleted file mode 100644 index 67a17cacf59da02a8c2ea57fd0786ea4206951a6..0000000000000000000000000000000000000000 --- a/externals/vanilla/lib_x_acoustics.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../pd/src/x_acoustics.c" -void lib_x_acoustics_setup(void) -{ - x_acoustics_setup(); -} diff --git a/externals/vanilla/lib_x_arithmetic.c b/externals/vanilla/lib_x_arithmetic.c deleted file mode 100644 index f09dd36eebf440e50a38e06b4c893ed9cafdc192..0000000000000000000000000000000000000000 --- a/externals/vanilla/lib_x_arithmetic.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../pd/src/x_arithmetic.c" -void lib_x_arithmetic_setup(void) -{ - x_arithmetic_setup(); -} diff --git a/externals/vanilla/lib_x_connective.c b/externals/vanilla/lib_x_connective.c deleted file mode 100644 index 1f56ebaee1df68d71844a14b208613fbb08d57e0..0000000000000000000000000000000000000000 --- a/externals/vanilla/lib_x_connective.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../pd/src/x_connective.c" -void lib_x_connective_setup(void) -{ - x_connective_setup(); -} diff --git a/externals/vanilla/lib_x_midi.c b/externals/vanilla/lib_x_midi.c deleted file mode 100644 index 24148b59f2129faaca78b07705d1d15ce44e010d..0000000000000000000000000000000000000000 --- a/externals/vanilla/lib_x_midi.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../pd/src/x_midi.c" -void lib_x_midi_setup(void) -{ - x_midi_setup(); -} diff --git a/externals/vanilla/lib_x_misc.c b/externals/vanilla/lib_x_misc.c deleted file mode 100644 index 6db34248e9c4d320399801828f429892a81cf2b2..0000000000000000000000000000000000000000 --- a/externals/vanilla/lib_x_misc.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../pd/src/x_misc.c" -void lib_x_misc_setup(void) -{ - x_misc_setup(); -} diff --git a/externals/vanilla/lib_x_net.c b/externals/vanilla/lib_x_net.c deleted file mode 100644 index c2a109aa2511136339cebc69c7519afe74bb5f2f..0000000000000000000000000000000000000000 --- a/externals/vanilla/lib_x_net.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../pd/src/x_net.c" -void lib_x_net_setup(void) -{ - x_net_setup(); -} diff --git a/externals/vanilla/lib_x_time.c b/externals/vanilla/lib_x_time.c deleted file mode 100644 index 8714eb1a3afd639fb2ea5ab3d765c6d06e20836c..0000000000000000000000000000000000000000 --- a/externals/vanilla/lib_x_time.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../pd/src/x_time.c" -void lib_x_time_setup(void) -{ - x_time_setup(); -} diff --git a/externals/vanilla/list.c b/externals/vanilla/list.c deleted file mode 100644 index 36660721139b59376ca6a955197d48ce77825ce8..0000000000000000000000000000000000000000 --- a/externals/vanilla/list.c +++ /dev/null @@ -1,543 +0,0 @@ -/* Copyright (c) 1997- Miller Puckette and others. -* For information on usage and redistribution, and for a DISCLAIMER OF ALL -* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -#include "m_pd.h" -/* #include <string.h> */ -#ifdef _WIN32 -#include <malloc.h> -#else -#include <alloca.h> -#endif - -extern t_pd *newest; - -#define HAVE_ALLOCA 1 /* LATER this should be set by configure script! */ -#define LIST_NGETBYTE 100 /* bigger that this we use alloc, not alloca */ - -/* the "list" object family. - - list append - append a list to another - list prepend - prepend a list to another - list split - first n elements to first outlet, rest to second outlet - list trim - trim off "list" selector - list length - output number of items in list - -Need to think more about: - list foreach - spit out elements of a list one by one (also in reverse?) - list array - get items from a named array as a list - list reverse - permute elements of a list back to front - list pack - synonym for 'pack' - list unpack - synonym for 'unpack' - list cat - build a list by accumulating elements - -Probably don't need: - list first - output first n elements. - list last - output last n elements - list nth - nth item in list, counting from zero -*/ - -/* -------------- utility functions: storage, copying -------------- */ - /* List element for storage. Keep an atom and, in case it's a pointer, - an associated 'gpointer' to protect against stale pointers. */ -typedef struct _listelem -{ - t_atom l_a; - t_gpointer l_p; -} t_listelem; - -typedef struct _alist -{ - t_pd l_pd; /* object to point inlets to */ - int l_n; /* number of items */ - int l_npointer; /* number of pointers */ - t_listelem *l_vec; /* pointer to items */ -} t_alist; - -#if 0 /* probably won't use this version... */ -#ifdef HAVE_ALLOCA -#define LIST_ALLOCA(x, n) ( \ - (x).l_n = (n), \ - (x).l_vec = (t_listelem *)((n) < LIST_NGETBYTE ? \ - alloca((n) * sizeof(t_listelem)) : getbytes((n) * sizeof(t_listelem)))) \ -#define LIST_FREEA(x) ( \ - ((x).l_n < LIST_NGETBYTE || - (freebytes((x).l_vec, (x).l_n * sizeof(t_listelem)), 0))) - -#else -#define LIST_ALLOCA(x, n) ( \ - (x).l_n = (n), \ - (x).l_vec = (t_listelem *)getbytes((n) * sizeof(t_listelem))) -#define LIST_FREEA(x) (freebytes((x).l_vec, (x).l_n * sizeof(t_listelem))) -#endif -#endif - -#if HAVE_ALLOCA -#define ATOMS_ALLOCA(x, n) ((x) = (t_atom *)((n) < LIST_NGETBYTE ? \ - alloca((n) * sizeof(t_atom)) : getbytes((n) * sizeof(t_atom)))) -#define ATOMS_FREEA(x, n) ( \ - ((n) < LIST_NGETBYTE || (freebytes((x), (n) * sizeof(t_atom)), 0))) -#else -#define ATOMS_ALLOCA(x, n) ((x) = (t_atom *)getbytes((n) * sizeof(t_atom))) -#define ATOMS_FREEA(x, n) (freebytes((x), (n) * sizeof(t_atom))) -#endif - -static void atoms_copy(int argc, t_atom *from, t_atom *to) -{ - int i; - for (i = 0; i < argc; i++) - to[i] = from[i]; -} - -/* ------------- fake class to divert inlets to ----------------- */ - -t_class *alist_class; - -static void alist_init(t_alist *x) -{ - x->l_pd = alist_class; - x->l_n = x->l_npointer = 0; - x->l_vec = 0; -} - -static void alist_clear(t_alist *x) -{ - int i; - for (i = 0; i < x->l_n; i++) - { - if (x->l_vec[i].l_a.a_type == A_POINTER) - gpointer_unset(x->l_vec[i].l_a.a_w.w_gpointer); - } - if (x->l_vec) - freebytes(x->l_vec, x->l_n * sizeof(*x->l_vec)); -} - -static void alist_list(t_alist *x, t_symbol *s, int argc, t_atom *argv) -{ - int i; - alist_clear(x); - if (!(x->l_vec = (t_listelem *)getbytes(argc * sizeof(*x->l_vec)))) - { - x->l_n = 0; - error("list_alloc: out of memory"); - return; - } - x->l_n = argc; - x->l_npointer = 0; - for (i = 0; i < argc; i++) - { - x->l_vec[i].l_a = argv[i]; - if (x->l_vec[i].l_a.a_type == A_POINTER) - { - x->l_npointer++; - gpointer_copy(x->l_vec[i].l_a.a_w.w_gpointer, &x->l_vec[i].l_p); - x->l_vec[i].l_a.a_w.w_gpointer = &x->l_vec[i].l_p; - } - } -} - -static void alist_anything(t_alist *x, t_symbol *s, int argc, t_atom *argv) -{ - int i; - alist_clear(x); - if (!(x->l_vec = (t_listelem *)getbytes((argc+1) * sizeof(*x->l_vec)))) - { - x->l_n = 0; - error("list_alloc: out of memory"); - return; - } - x->l_n = argc+1; - x->l_npointer = 0; - SETSYMBOL(&x->l_vec[0].l_a, s); - for (i = 0; i < argc; i++) - { - x->l_vec[i+1].l_a = argv[i]; - if (x->l_vec[i+1].l_a.a_type == A_POINTER) - { - x->l_npointer++; - gpointer_copy(x->l_vec[i+1].l_a.a_w.w_gpointer, &x->l_vec[i+1].l_p); - x->l_vec[i].l_a.a_w.w_gpointer = &x->l_vec[i].l_p; - } - } -} - -static void alist_toatoms(t_alist *x, t_atom *to) -{ - int i; - for (i = 0; i < x->l_n; i++) - to[i] = x->l_vec[i].l_a; -} - - -static void alist_clone(t_alist *x, t_alist *y) -{ - int i; - y->l_pd = alist_class; - y->l_n = x->l_n; - y->l_npointer = x->l_npointer; - if (!(y->l_vec = (t_listelem *)getbytes(y->l_n * sizeof(*y->l_vec)))) - { - y->l_n = 0; - error("list_alloc: out of memory"); - } - else for (i = 0; i < x->l_n; i++) - { - y->l_vec[i].l_a = x->l_vec[i].l_a; - if (y->l_vec[i].l_a.a_type == A_POINTER) - { - gpointer_copy(y->l_vec[i].l_a.a_w.w_gpointer, &y->l_vec[i].l_p); - y->l_vec[i].l_a.a_w.w_gpointer = &y->l_vec[i].l_p; - } - } -} - -static void alist_setup(void) -{ - alist_class = class_new(gensym("list inlet"), - 0, 0, sizeof(t_alist), 0, 0); - class_addlist(alist_class, alist_list); - class_addanything(alist_class, alist_anything); -} - -/* ------------- list append --------------------- */ - -t_class *list_append_class; - -typedef struct _list_append -{ - t_object x_obj; - t_alist x_alist; -} t_list_append; - -static void *list_append_new(t_symbol *s, int argc, t_atom *argv) -{ - t_list_append *x = (t_list_append *)pd_new(list_append_class); - alist_init(&x->x_alist); - alist_list(&x->x_alist, 0, argc, argv); - outlet_new(&x->x_obj, &s_list); - inlet_new(&x->x_obj, &x->x_alist.l_pd, 0, 0); - return (x); -} - -static void list_append_list(t_list_append *x, t_symbol *s, - int argc, t_atom *argv) -{ - t_atom *outv; - int n, outc = x->x_alist.l_n + argc; - ATOMS_ALLOCA(outv, outc); - atoms_copy(argc, argv, outv); - if (x->x_alist.l_npointer) - { - t_alist y; - alist_clone(&x->x_alist, &y); - alist_toatoms(&y, outv+argc); - outlet_list(x->x_obj.ob_outlet, &s_list, outc, outv); - alist_clear(&y); - } - else - { - alist_toatoms(&x->x_alist, outv+argc); - outlet_list(x->x_obj.ob_outlet, &s_list, outc, outv); - } - ATOMS_FREEA(outv, outc); -} - -static void list_append_anything(t_list_append *x, t_symbol *s, - int argc, t_atom *argv) -{ - t_atom *outv; - int n, outc = x->x_alist.l_n + argc + 1; - ATOMS_ALLOCA(outv, outc); - SETSYMBOL(outv, s); - atoms_copy(argc, argv, outv + 1); - if (x->x_alist.l_npointer) - { - t_alist y; - alist_clone(&x->x_alist, &y); - alist_toatoms(&y, outv + 1 + argc); - outlet_list(x->x_obj.ob_outlet, &s_list, outc, outv); - alist_clear(&y); - } - else - { - alist_toatoms(&x->x_alist, outv + 1 + argc); - outlet_list(x->x_obj.ob_outlet, &s_list, outc, outv); - } - ATOMS_FREEA(outv, outc); -} - -static void list_append_free(t_list_append *x) -{ - alist_clear(&x->x_alist); -} - -static void list_append_setup(void) -{ - list_append_class = class_new(gensym("list append"), - (t_newmethod)list_append_new, (t_method)list_append_free, - sizeof(t_list_append), 0, A_GIMME, 0); - class_addlist(list_append_class, list_append_list); - class_addanything(list_append_class, list_append_anything); - class_sethelpsymbol(list_append_class, &s_list); -} - -/* ------------- list prepend --------------------- */ - -t_class *list_prepend_class; - -typedef struct _list_prepend -{ - t_object x_obj; - t_alist x_alist; -} t_list_prepend; - -static void *list_prepend_new(t_symbol *s, int argc, t_atom *argv) -{ - t_list_prepend *x = (t_list_prepend *)pd_new(list_prepend_class); - alist_init(&x->x_alist); - alist_list(&x->x_alist, 0, argc, argv); - outlet_new(&x->x_obj, &s_list); - inlet_new(&x->x_obj, &x->x_alist.l_pd, 0, 0); - return (x); -} - -static void list_prepend_list(t_list_prepend *x, t_symbol *s, - int argc, t_atom *argv) -{ - t_atom *outv; - int n, outc = x->x_alist.l_n + argc; - ATOMS_ALLOCA(outv, outc); - atoms_copy(argc, argv, outv + x->x_alist.l_n); - if (x->x_alist.l_npointer) - { - t_alist y; - alist_clone(&x->x_alist, &y); - alist_toatoms(&y, outv); - outlet_list(x->x_obj.ob_outlet, &s_list, outc, outv); - alist_clear(&y); - } - else - { - alist_toatoms(&x->x_alist, outv); - outlet_list(x->x_obj.ob_outlet, &s_list, outc, outv); - } - ATOMS_FREEA(outv, outc); -} - - - -static void list_prepend_anything(t_list_prepend *x, t_symbol *s, - int argc, t_atom *argv) -{ - t_atom *outv; - int n, outc = x->x_alist.l_n + argc + 1; - ATOMS_ALLOCA(outv, outc); - SETSYMBOL(outv + x->x_alist.l_n, s); - atoms_copy(argc, argv, outv + x->x_alist.l_n + 1); - if (x->x_alist.l_npointer) - { - t_alist y; - alist_clone(&x->x_alist, &y); - alist_toatoms(&y, outv); - outlet_list(x->x_obj.ob_outlet, &s_list, outc, outv); - alist_clear(&y); - } - else - { - alist_toatoms(&x->x_alist, outv); - outlet_list(x->x_obj.ob_outlet, &s_list, outc, outv); - } - ATOMS_FREEA(outv, outc); -} - -static void list_prepend_free(t_list_prepend *x) -{ - alist_clear(&x->x_alist); -} - -static void list_prepend_setup(void) -{ - list_prepend_class = class_new(gensym("list prepend"), - (t_newmethod)list_prepend_new, (t_method)list_prepend_free, - sizeof(t_list_prepend), 0, A_GIMME, 0); - class_addlist(list_prepend_class, list_prepend_list); - class_addanything(list_prepend_class, list_prepend_anything); - class_sethelpsymbol(list_prepend_class, &s_list); -} - -/* ------------- list split --------------------- */ - -t_class *list_split_class; - -typedef struct _list_split -{ - t_object x_obj; - t_float x_f; - t_outlet *x_out1; - t_outlet *x_out2; - t_outlet *x_out3; -} t_list_split; - -static void *list_split_new(t_floatarg f) -{ - t_list_split *x = (t_list_split *)pd_new(list_split_class); - x->x_out1 = outlet_new(&x->x_obj, &s_list); - x->x_out2 = outlet_new(&x->x_obj, &s_list); - x->x_out3 = outlet_new(&x->x_obj, &s_list); - floatinlet_new(&x->x_obj, &x->x_f); - x->x_f = f; - return (x); -} - -static void list_split_list(t_list_split *x, t_symbol *s, - int argc, t_atom *argv) -{ - int n = x->x_f; - if (n < 0) - n = 0; - if (argc >= n) - { - outlet_list(x->x_out2, &s_list, argc-n, argv+n); - outlet_list(x->x_out1, &s_list, n, argv); - } - else outlet_list(x->x_out3, &s_list, argc, argv); -} - -static void list_split_anything(t_list_split *x, t_symbol *s, - int argc, t_atom *argv) -{ - t_atom *outv; - ATOMS_ALLOCA(outv, argc+1); - SETSYMBOL(outv, s); - atoms_copy(argc, argv, outv + 1); - list_split_list(x, &s_list, argc+1, outv); - ATOMS_FREEA(outv, argc+1); -} - -static void list_split_setup(void) -{ - list_split_class = class_new(gensym("list split"), - (t_newmethod)list_split_new, 0, - sizeof(t_list_split), 0, A_DEFFLOAT, 0); - class_addlist(list_split_class, list_split_list); - class_addanything(list_split_class, list_split_anything); - class_sethelpsymbol(list_split_class, &s_list); -} - -/* ------------- list trim --------------------- */ - -t_class *list_trim_class; - -typedef struct _list_trim -{ - t_object x_obj; -} t_list_trim; - -static void *list_trim_new( void) -{ - t_list_trim *x = (t_list_trim *)pd_new(list_trim_class); - outlet_new(&x->x_obj, &s_list); - return (x); -} - -static void list_trim_list(t_list_trim *x, t_symbol *s, - int argc, t_atom *argv) -{ - if (argc < 1 || argv[0].a_type != A_SYMBOL) - outlet_list(x->x_obj.ob_outlet, &s_list, argc, argv); - else outlet_anything(x->x_obj.ob_outlet, argv[0].a_w.w_symbol, - argc-1, argv+1); -} - -static void list_trim_anything(t_list_trim *x, t_symbol *s, - int argc, t_atom *argv) -{ - outlet_anything(x->x_obj.ob_outlet, s, argc, argv); -} - -static void list_trim_setup(void) -{ - list_trim_class = class_new(gensym("list trim"), - (t_newmethod)list_trim_new, 0, - sizeof(t_list_trim), 0, 0); - class_addlist(list_trim_class, list_trim_list); - class_addanything(list_trim_class, list_trim_anything); - class_sethelpsymbol(list_trim_class, &s_list); -} - -/* ------------- list length --------------------- */ - -t_class *list_length_class; - -typedef struct _list_length -{ - t_object x_obj; -} t_list_length; - -static void *list_length_new( void) -{ - t_list_length *x = (t_list_length *)pd_new(list_length_class); - outlet_new(&x->x_obj, &s_float); - return (x); -} - -static void list_length_list(t_list_length *x, t_symbol *s, - int argc, t_atom *argv) -{ - outlet_float(x->x_obj.ob_outlet, (t_float)argc); -} - -static void list_length_anything(t_list_length *x, t_symbol *s, - int argc, t_atom *argv) -{ - outlet_float(x->x_obj.ob_outlet, (t_float)argc+1); -} - -static void list_length_setup(void) -{ - list_length_class = class_new(gensym("list length"), - (t_newmethod)list_length_new, 0, - sizeof(t_list_length), 0, 0); - class_addlist(list_length_class, list_length_list); - class_addanything(list_length_class, list_length_anything); - class_sethelpsymbol(list_length_class, &s_list); -} - -/* ------------- list ------------------- */ - -static void *list_new(t_pd *dummy, t_symbol *s, int argc, t_atom *argv) -{ - if (!argc || argv[0].a_type != A_SYMBOL) - newest = list_append_new(s, argc, argv); - else - { - t_symbol *s2 = argv[0].a_w.w_symbol; - if (s2 == gensym("append")) - newest = list_append_new(s, argc-1, argv+1); - else if (s2 == gensym("prepend")) - newest = list_prepend_new(s, argc-1, argv+1); - else if (s2 == gensym("split")) - newest = list_split_new(atom_getfloatarg(1, argc, argv)); - else if (s2 == gensym("trim")) - newest = list_trim_new(); - else if (s2 == gensym("length")) - newest = list_length_new(); - else - { - error("list %s: unknown function", s2->s_name); - newest = 0; - } - } - return (newest); -} - -void x_list_setup(void) -{ - alist_setup(); - list_append_setup(); - list_prepend_setup(); - list_split_setup(); - list_trim_setup(); - list_length_setup(); - class_addcreator((t_newmethod)list_new, &s_list, A_GIMME, 0); -} diff --git a/externals/vanilla/log~.c b/externals/vanilla/log~.c deleted file mode 100644 index 2dc43ffd832f7b4b2bf060cc1c643c36544dbab0..0000000000000000000000000000000000000000 --- a/externals/vanilla/log~.c +++ /dev/null @@ -1,56 +0,0 @@ -/* Copyright (c) 1997-2001 Miller Puckette and others. -* For information on usage and redistribution, and for a DISCLAIMER OF ALL -* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -#include "m_pd.h" -#include <math.h> - -static t_class *log_tilde_class; - -typedef struct _log_tilde -{ - t_object x_obj; - t_float x_f; -} t_log_tilde; - -static void *log_tilde_new(t_symbol *s, int argc, t_atom *argv) -{ - t_log_tilde *x = (t_log_tilde *)pd_new(log_tilde_class); - inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); - outlet_new(&x->x_obj, &s_signal); - x->x_f = 0; - return (x); -} - -t_int *log_tilde_perform(t_int *w) -{ - t_sample *in1 = (t_sample *)(w[1]); - t_sample *in2 = (t_sample *)(w[2]); - t_sample *out = (t_sample *)(w[3]); - int n = (int)(w[4]); - while (n--) - { - float f = *in1++, g = *in2++; - if (f <= 0) - *out = -1000; /* rather than blow up, output a number << 0 */ - else if (g <= 0) - *out = log(f); - else *out = log(f)/log(g); - out++; - } - return (w+5); -} - -static void log_tilde_dsp(t_log_tilde *x, t_signal **sp) -{ - dsp_add(log_tilde_perform, 4, - sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[0]->s_n); -} - -void log_tilde_setup(void) -{ - log_tilde_class = class_new(gensym("log~"), (t_newmethod)log_tilde_new, 0, - sizeof(t_log_tilde), 0, A_DEFFLOAT, 0); - CLASS_MAINSIGNALIN(log_tilde_class, t_log_tilde, x_f); - class_addmethod(log_tilde_class, (t_method)log_tilde_dsp, gensym("dsp"), 0); -} diff --git a/externals/vanilla/mtof~.c b/externals/vanilla/mtof~.c deleted file mode 100644 index f8fc7de609a03b8bf074e8af483d68bd5de2f4d7..0000000000000000000000000000000000000000 --- a/externals/vanilla/mtof~.c +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright (c) 1997-2001 Miller Puckette and others. -* For information on usage and redistribution, and for a DISCLAIMER OF ALL -* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -#include "m_pd.h" -#include <math.h> - -typedef struct mtof_tilde -{ - t_object x_obj; - t_float x_f; -} t_mtof_tilde; - -t_class *mtof_tilde_class; - -static void *mtof_tilde_new(void) -{ - t_mtof_tilde *x = (t_mtof_tilde *)pd_new(mtof_tilde_class); - outlet_new(&x->x_obj, gensym("signal")); - x->x_f = 0; - return (x); -} - -static t_int *mtof_tilde_perform(t_int *w) -{ - t_sample *in = *(t_sample **)(w+1), *out = *(t_sample **)(w+2); - t_int n = *(t_int *)(w+3); - for (; n--; in++, out++) - { - t_sample f = *in; - if (f <= -1500) *out = 0; - else - { - if (f > 1499) f = 1499; - *out = 8.17579891564 * exp(.0577622650 * f); - } - } - return (w + 4); -} - -static void mtof_tilde_dsp(t_mtof_tilde *x, t_signal **sp) -{ - dsp_add(mtof_tilde_perform, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); -} - -void mtof_tilde_setup(void) -{ - mtof_tilde_class = class_new(gensym("mtof~"), (t_newmethod)mtof_tilde_new, 0, - sizeof(t_mtof_tilde), 0, 0); - CLASS_MAINSIGNALIN(mtof_tilde_class, t_mtof_tilde, x_f); - class_addmethod(mtof_tilde_class, (t_method)mtof_tilde_dsp, gensym("dsp"), 0); -} diff --git a/externals/vanilla/nbx.c b/externals/vanilla/nbx.c deleted file mode 100644 index badf189bbd0eeb6092386c89a8ba880d0bf0127c..0000000000000000000000000000000000000000 --- a/externals/vanilla/nbx.c +++ /dev/null @@ -1,904 +0,0 @@ -/* Copyright (c) 1997-1999 Miller Puckette. - * For information on usage and redistribution, and for a DISCLAIMER OF ALL - * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -/* my_numbox.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <ctype.h> -#include "m_pd.h" -#include "g_canvas.h" - -#include "g_all_guis.h" -#include <math.h> - -#ifdef MSW -#include <io.h> -#else -#include <unistd.h> -#endif - -/*------------------ global varaibles -------------------------*/ - - -/*------------------ global functions -------------------------*/ - -static void my_numbox_key(void *z, t_floatarg fkey); -static void my_numbox_draw_update(t_gobj *client, t_glist *glist); - -/* ------------ nmx gui-my number box ----------------------- */ - -t_widgetbehavior my_numbox_widgetbehavior; -static t_class *my_numbox_class; - -/* widget helper functions */ - -static void my_numbox_tick_reset(t_my_numbox *x) -{ - if(x->x_gui.x_fsf.x_change && x->x_gui.x_glist) - { - x->x_gui.x_fsf.x_change = 0; - sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update); - } -} - -static void my_numbox_tick_wait(t_my_numbox *x) -{ - sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update); -} - -void my_numbox_clip(t_my_numbox *x) -{ - if(x->x_val < x->x_min) - x->x_val = x->x_min; - if(x->x_val > x->x_max) - x->x_val = x->x_max; -} - -void my_numbox_calc_fontwidth(t_my_numbox *x) -{ - int w, f=31; - - if(x->x_gui.x_fsf.x_font_style == 1) - f = 27; - else if(x->x_gui.x_fsf.x_font_style == 2) - f = 25; - - w = x->x_gui.x_fontsize * f * x->x_gui.x_w; - w /= 36; - x->x_numwidth = w + (x->x_gui.x_h / 2) + 4; -} - -void my_numbox_ftoa(t_my_numbox *x) -{ - double f=x->x_val; - int bufsize, is_exp=0, i, idecimal; - - sprintf(x->x_buf, "%g", f); - bufsize = strlen(x->x_buf); - if(bufsize >= 5)/* if it is in exponential mode */ - { - i = bufsize - 4; - if((x->x_buf[i] == 'e') || (x->x_buf[i] == 'E')) - is_exp = 1; - } - if(bufsize > x->x_gui.x_w)/* if to reduce */ - { - if(is_exp) - { - if(x->x_gui.x_w <= 5) - { - x->x_buf[0] = (f < 0.0 ? '-' : '+'); - x->x_buf[1] = 0; - } - i = bufsize - 4; - for(idecimal=0; idecimal < i; idecimal++) - if(x->x_buf[idecimal] == '.') - break; - if(idecimal > (x->x_gui.x_w - 4)) - { - x->x_buf[0] = (f < 0.0 ? '-' : '+'); - x->x_buf[1] = 0; - } - else - { - int new_exp_index=x->x_gui.x_w-4, old_exp_index=bufsize-4; - - for(i=0; i < 4; i++, new_exp_index++, old_exp_index++) - x->x_buf[new_exp_index] = x->x_buf[old_exp_index]; - x->x_buf[x->x_gui.x_w] = 0; - } - - } - else - { - for(idecimal=0; idecimal < bufsize; idecimal++) - if(x->x_buf[idecimal] == '.') - break; - if(idecimal > x->x_gui.x_w) - { - x->x_buf[0] = (f < 0.0 ? '-' : '+'); - x->x_buf[1] = 0; - } - else - x->x_buf[x->x_gui.x_w] = 0; - } - } -} - -static void my_numbox_draw_update(t_gobj *client, t_glist *glist) -{ - t_my_numbox *x = (t_my_numbox *)client; - if (glist_isvisible(glist)) - { - if(x->x_gui.x_fsf.x_change) - { - if(x->x_buf[0]) - { - char *cp=x->x_buf; - int sl = strlen(x->x_buf); - - x->x_buf[sl] = '>'; - x->x_buf[sl+1] = 0; - if(sl >= x->x_gui.x_w) - cp += sl - x->x_gui.x_w + 1; - sys_vgui( - ".x%lx.c itemconfigure %lxNUMBER -fill #%6.6x -text {%s} \n", - glist_getcanvas(glist), x, IEM_GUI_COLOR_EDITED, cp); - x->x_buf[sl] = 0; - } - else - { - my_numbox_ftoa(x); - sys_vgui( - ".x%lx.c itemconfigure %lxNUMBER -fill #%6.6x -text {%s} \n", - glist_getcanvas(glist), x, IEM_GUI_COLOR_EDITED, x->x_buf); - x->x_buf[0] = 0; - } - } - else - { - my_numbox_ftoa(x); - sys_vgui( - ".x%lx.c itemconfigure %lxNUMBER -fill #%6.6x -text {%s} \n", - glist_getcanvas(glist), x, - x->x_gui.x_fsf.x_selected? - IEM_GUI_COLOR_SELECTED:x->x_gui.x_fcol, - x->x_buf); - x->x_buf[0] = 0; - } - } -} - -static void my_numbox_draw_new(t_my_numbox *x, t_glist *glist) -{ - int half=x->x_gui.x_h/2, d=1+x->x_gui.x_h/34; - int xpos=text_xpix(&x->x_gui.x_obj, glist); - int ypos=text_ypix(&x->x_gui.x_obj, glist); - t_canvas *canvas=glist_getcanvas(glist); - - sys_vgui( -".x%lx.c create polygon %d %d %d %d %d %d %d %d %d %d -outline #%6.6x \ --fill #%6.6x -tags %lxBASE1\n", - canvas, xpos, ypos, - xpos + x->x_numwidth-4, ypos, - xpos + x->x_numwidth, ypos+4, - xpos + x->x_numwidth, ypos + x->x_gui.x_h, - xpos, ypos + x->x_gui.x_h, - IEM_GUI_COLOR_NORMAL, x->x_gui.x_bcol, x); - sys_vgui( - ".x%lx.c create line %d %d %d %d %d %d -fill #%6.6x -tags %lxBASE2\n", - canvas, xpos, ypos, - xpos + half, ypos + half, - xpos, ypos + x->x_gui.x_h, - x->x_gui.x_fcol, x); - sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \ - -font {{%s} -%d %s} -fill #%6.6x -tags %lxLABEL\n", - canvas, xpos+x->x_gui.x_ldx, ypos+x->x_gui.x_ldy, - strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"", - x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, - x->x_gui.x_lcol, x); - my_numbox_ftoa(x); - sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \ - -font {{%s} -%d %s} -fill #%6.6x -tags %lxNUMBER\n", - canvas, xpos+half+2, ypos+half+d, - x->x_buf, x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, - x->x_gui.x_fcol, x); - if(!x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxOUT%d\n", - canvas, - xpos, ypos + x->x_gui.x_h-1, - xpos+IOWIDTH, ypos + x->x_gui.x_h, - x, 0); - if(!x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxIN%d\n", - canvas, - xpos, ypos, - xpos+IOWIDTH, ypos+1, - x, 0); -} - -static void my_numbox_draw_move(t_my_numbox *x, t_glist *glist) -{ - int half = x->x_gui.x_h/2, d=1+x->x_gui.x_h/34; - int xpos=text_xpix(&x->x_gui.x_obj, glist); - int ypos=text_ypix(&x->x_gui.x_obj, glist); - t_canvas *canvas=glist_getcanvas(glist); - - sys_vgui(".x%lx.c coords %lxBASE1 %d %d %d %d %d %d %d %d %d %d\n", - canvas, x, xpos, ypos, - xpos + x->x_numwidth-4, ypos, - xpos + x->x_numwidth, ypos+4, - xpos + x->x_numwidth, ypos + x->x_gui.x_h, - xpos, ypos + x->x_gui.x_h); - sys_vgui(".x%lx.c coords %lxBASE2 %d %d %d %d %d %d\n", - canvas, x, xpos, ypos, - xpos + half, ypos + half, - xpos, ypos + x->x_gui.x_h); - sys_vgui(".x%lx.c coords %lxLABEL %d %d\n", - canvas, x, xpos+x->x_gui.x_ldx, ypos+x->x_gui.x_ldy); - sys_vgui(".x%lx.c coords %lxNUMBER %d %d\n", - canvas, x, xpos+half+2, ypos+half+d); - if(!x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c coords %lxOUT%d %d %d %d %d\n", - canvas, x, 0, - xpos, ypos + x->x_gui.x_h-1, - xpos+IOWIDTH, ypos + x->x_gui.x_h); - if(!x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c coords %lxIN%d %d %d %d %d\n", - canvas, x, 0, - xpos, ypos, - xpos+IOWIDTH, ypos+1); -} - -static void my_numbox_draw_erase(t_my_numbox* x,t_glist* glist) -{ - t_canvas *canvas=glist_getcanvas(glist); - - sys_vgui(".x%lx.c delete %lxBASE1\n", canvas, x); - sys_vgui(".x%lx.c delete %lxBASE2\n", canvas, x); - sys_vgui(".x%lx.c delete %lxLABEL\n", canvas, x); - sys_vgui(".x%lx.c delete %lxNUMBER\n", canvas, x); - if(!x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c delete %lxOUT%d\n", canvas, x, 0); - if(!x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c delete %lxIN%d\n", canvas, x, 0); -} - -static void my_numbox_draw_config(t_my_numbox* x,t_glist* glist) -{ - t_canvas *canvas=glist_getcanvas(glist); - - sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {{%s} -%d %s} -fill #%6.6x -text {%s} \n", - canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, - x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_lcol, - strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:""); - sys_vgui(".x%lx.c itemconfigure %lxNUMBER -font {{%s} -%d %s} -fill #%6.6x \n", - canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, - x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_fcol); - sys_vgui(".x%lx.c itemconfigure %lxBASE1 -fill #%6.6x\n", canvas, - x, x->x_gui.x_bcol); - sys_vgui(".x%lx.c itemconfigure %lxBASE2 -fill #%6.6x\n", canvas, - x, x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_fcol); -} - -static void my_numbox_draw_io(t_my_numbox* x,t_glist* glist, int old_snd_rcv_flags) -{ - int xpos=text_xpix(&x->x_gui.x_obj, glist); - int ypos=text_ypix(&x->x_gui.x_obj, glist); - t_canvas *canvas=glist_getcanvas(glist); - - if((old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && !x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxOUT%d\n", - canvas, - xpos, ypos + x->x_gui.x_h-1, - xpos+IOWIDTH, ypos + x->x_gui.x_h, - x, 0); - if(!(old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c delete %lxOUT%d\n", canvas, x, 0); - if((old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && !x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxIN%d\n", - canvas, - xpos, ypos, - xpos+IOWIDTH, ypos+1, - x, 0); - if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c delete %lxIN%d\n", canvas, x, 0); -} - -static void my_numbox_draw_select(t_my_numbox *x, t_glist *glist) -{ - t_canvas *canvas=glist_getcanvas(glist); - - if(x->x_gui.x_fsf.x_selected) - { - if(x->x_gui.x_fsf.x_change) - { - x->x_gui.x_fsf.x_change = 0; - clock_unset(x->x_clock_reset); - x->x_buf[0] = 0; - sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update); - } - sys_vgui(".x%lx.c itemconfigure %lxBASE1 -outline #%6.6x\n", - canvas, x, IEM_GUI_COLOR_SELECTED); - sys_vgui(".x%lx.c itemconfigure %lxBASE2 -fill #%6.6x\n", - canvas, x, IEM_GUI_COLOR_SELECTED); - sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill #%6.6x\n", - canvas, x, IEM_GUI_COLOR_SELECTED); - sys_vgui(".x%lx.c itemconfigure %lxNUMBER -fill #%6.6x\n", - canvas, x, IEM_GUI_COLOR_SELECTED); - } - else - { - sys_vgui(".x%lx.c itemconfigure %lxBASE1 -outline #%6.6x\n", - canvas, x, IEM_GUI_COLOR_NORMAL); - sys_vgui(".x%lx.c itemconfigure %lxBASE2 -fill #%6.6x\n", - canvas, x, x->x_gui.x_fcol); - sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill #%6.6x\n", - canvas, x, x->x_gui.x_lcol); - sys_vgui(".x%lx.c itemconfigure %lxNUMBER -fill #%6.6x\n", - canvas, x, x->x_gui.x_fcol); - } -} - -void my_numbox_draw(t_my_numbox *x, t_glist *glist, int mode) -{ - if(mode == IEM_GUI_DRAW_MODE_UPDATE) - sys_queuegui(x, glist, my_numbox_draw_update); - else if(mode == IEM_GUI_DRAW_MODE_MOVE) - my_numbox_draw_move(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_NEW) - my_numbox_draw_new(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_SELECT) - my_numbox_draw_select(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_ERASE) - my_numbox_draw_erase(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_CONFIG) - my_numbox_draw_config(x, glist); - else if(mode >= IEM_GUI_DRAW_MODE_IO) - my_numbox_draw_io(x, glist, mode - IEM_GUI_DRAW_MODE_IO); -} - -/* ------------------------ nbx widgetbehaviour----------------------------- */ - - -static void my_numbox_getrect(t_gobj *z, t_glist *glist, - int *xp1, int *yp1, int *xp2, int *yp2) -{ - t_my_numbox* x = (t_my_numbox*)z; - - *xp1 = text_xpix(&x->x_gui.x_obj, glist); - *yp1 = text_ypix(&x->x_gui.x_obj, glist); - *xp2 = *xp1 + x->x_numwidth; - *yp2 = *yp1 + x->x_gui.x_h; -} - -static void my_numbox_save(t_gobj *z, t_binbuf *b) -{ - t_my_numbox *x = (t_my_numbox *)z; - int bflcol[3]; - t_symbol *srl[3]; - - iemgui_save(&x->x_gui, srl, bflcol); - if(x->x_gui.x_fsf.x_change) - { - x->x_gui.x_fsf.x_change = 0; - clock_unset(x->x_clock_reset); - sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update); - } - binbuf_addv(b, "ssiisiiffiisssiiiiiiifi", gensym("#X"),gensym("obj"), - (int)x->x_gui.x_obj.te_xpix, (int)x->x_gui.x_obj.te_ypix, - gensym("nbx"), x->x_gui.x_w, x->x_gui.x_h, - (t_float)x->x_min, (t_float)x->x_max, - x->x_lin0_log1, iem_symargstoint(&x->x_gui.x_isa), - srl[0], srl[1], srl[2], - x->x_gui.x_ldx, x->x_gui.x_ldy, - iem_fstyletoint(&x->x_gui.x_fsf), x->x_gui.x_fontsize, - bflcol[0], bflcol[1], bflcol[2], - x->x_val, x->x_log_height); - binbuf_addv(b, ";"); -} - -int my_numbox_check_minmax(t_my_numbox *x, double min, double max) -{ - int ret=0; - - if(x->x_lin0_log1) - { - if((min == 0.0)&&(max == 0.0)) - max = 1.0; - if(max > 0.0) - { - if(min <= 0.0) - min = 0.01*max; - } - else - { - if(min > 0.0) - max = 0.01*min; - } - } - x->x_min = min; - x->x_max = max; - if(x->x_val < x->x_min) - { - x->x_val = x->x_min; - ret = 1; - } - if(x->x_val > x->x_max) - { - x->x_val = x->x_max; - ret = 1; - } - if(x->x_lin0_log1) - x->x_k = exp(log(x->x_max/x->x_min)/(double)(x->x_log_height)); - else - x->x_k = 1.0; - return(ret); -} - -static void my_numbox_properties(t_gobj *z, t_glist *owner) -{ - t_my_numbox *x = (t_my_numbox *)z; - char buf[800]; - t_symbol *srl[3]; - - iemgui_properties(&x->x_gui, srl); - if(x->x_gui.x_fsf.x_change) - { - x->x_gui.x_fsf.x_change = 0; - clock_unset(x->x_clock_reset); - sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update); - - } - sprintf(buf, "pdtk_iemgui_dialog %%s |nbx| \ - -------dimensions(digits)(pix):------- %d %d width: %d %d height: \ - -----------output-range:----------- %g min: %g max: %d \ - %d lin log %d %d log-height: %d \ - %s %s \ - %s %d %d \ - %d %d \ - %d %d %d\n", - x->x_gui.x_w, 1, x->x_gui.x_h, 8, - x->x_min, x->x_max, 0,/*no_schedule*/ - x->x_lin0_log1, x->x_gui.x_isa.x_loadinit, -1, - x->x_log_height, /*no multi, but iem-characteristic*/ - srl[0]->s_name, srl[1]->s_name, - srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy, - x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize, - 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, - 0xffffff & x->x_gui.x_lcol); - gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); -} - -static void my_numbox_bang(t_my_numbox *x) -{ - outlet_float(x->x_gui.x_obj.ob_outlet, x->x_val); - if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) - pd_float(x->x_gui.x_snd->s_thing, x->x_val); -} - -static void my_numbox_dialog(t_my_numbox *x, t_symbol *s, int argc, - t_atom *argv) -{ - t_symbol *srl[3]; - int w = (int)atom_getintarg(0, argc, argv); - int h = (int)atom_getintarg(1, argc, argv); - double min = (double)atom_getfloatarg(2, argc, argv); - double max = (double)atom_getfloatarg(3, argc, argv); - int lilo = (int)atom_getintarg(4, argc, argv); - int log_height = (int)atom_getintarg(6, argc, argv); - int sr_flags; - - if(lilo != 0) lilo = 1; - x->x_lin0_log1 = lilo; - sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv); - if(w < 1) - w = 1; - x->x_gui.x_w = w; - if(h < 8) - h = 8; - x->x_gui.x_h = h; - if(log_height < 10) - log_height = 10; - x->x_log_height = log_height; - my_numbox_calc_fontwidth(x); - /*if(my_numbox_check_minmax(x, min, max)) - my_numbox_bang(x);*/ - my_numbox_check_minmax(x, min, max); - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_IO + sr_flags); - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG); - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE); - canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x); -} - -static void my_numbox_motion(t_my_numbox *x, t_floatarg dx, t_floatarg dy) -{ - double k2=1.0; - - if(x->x_gui.x_fsf.x_finemoved) - k2 = 0.01; - if(x->x_lin0_log1) - x->x_val *= pow(x->x_k, -k2*dy); - else - x->x_val -= k2*dy; - my_numbox_clip(x); - sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update); - my_numbox_bang(x); - clock_unset(x->x_clock_reset); -} - -static void my_numbox_click(t_my_numbox *x, t_floatarg xpos, t_floatarg ypos, - t_floatarg shift, t_floatarg ctrl, t_floatarg alt) -{ - glist_grab(x->x_gui.x_glist, &x->x_gui.x_obj.te_g, - (t_glistmotionfn)my_numbox_motion, my_numbox_key, xpos, ypos); -} - -static int my_numbox_newclick(t_gobj *z, struct _glist *glist, - int xpix, int ypix, int shift, int alt, int dbl, int doit) -{ - t_my_numbox* x = (t_my_numbox *)z; - - if(doit) - { - my_numbox_click( x, (t_floatarg)xpix, (t_floatarg)ypix, - (t_floatarg)shift, 0, (t_floatarg)alt); - if(shift) - x->x_gui.x_fsf.x_finemoved = 1; - else - x->x_gui.x_fsf.x_finemoved = 0; - if(!x->x_gui.x_fsf.x_change) - { - clock_delay(x->x_clock_wait, 50); - x->x_gui.x_fsf.x_change = 1; - clock_delay(x->x_clock_reset, 3000); - - x->x_buf[0] = 0; - } - else - { - x->x_gui.x_fsf.x_change = 0; - clock_unset(x->x_clock_reset); - x->x_buf[0] = 0; - sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update); - } - } - return (1); -} - -static void my_numbox_set(t_my_numbox *x, t_floatarg f) -{ - x->x_val = f; - my_numbox_clip(x); - sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update); -} - -static void my_numbox_log_height(t_my_numbox *x, t_floatarg lh) -{ - if(lh < 10.0) - lh = 10.0; - x->x_log_height = (int)lh; - if(x->x_lin0_log1) - x->x_k = exp(log(x->x_max/x->x_min)/(double)(x->x_log_height)); - else - x->x_k = 1.0; - -} - -static void my_numbox_float(t_my_numbox *x, t_floatarg f) -{ - my_numbox_set(x, f); - if(x->x_gui.x_fsf.x_put_in2out) - my_numbox_bang(x); -} - -static void my_numbox_size(t_my_numbox *x, t_symbol *s, int ac, t_atom *av) -{ - int h, w; - - w = (int)atom_getintarg(0, ac, av); - if(w < 1) - w = 1; - x->x_gui.x_w = w; - if(ac > 1) - { - h = (int)atom_getintarg(1, ac, av); - if(h < 8) - h = 8; - x->x_gui.x_h = h; - } - my_numbox_calc_fontwidth(x); - iemgui_size((void *)x, &x->x_gui); -} - -static void my_numbox_delta(t_my_numbox *x, t_symbol *s, int ac, t_atom *av) -{iemgui_delta((void *)x, &x->x_gui, s, ac, av);} - -static void my_numbox_pos(t_my_numbox *x, t_symbol *s, int ac, t_atom *av) -{iemgui_pos((void *)x, &x->x_gui, s, ac, av);} - -static void my_numbox_range(t_my_numbox *x, t_symbol *s, int ac, t_atom *av) -{ - if(my_numbox_check_minmax(x, (double)atom_getfloatarg(0, ac, av), - (double)atom_getfloatarg(1, ac, av))) - { - sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update); - /*my_numbox_bang(x);*/ - } -} - -static void my_numbox_color(t_my_numbox *x, t_symbol *s, int ac, t_atom *av) -{iemgui_color((void *)x, &x->x_gui, s, ac, av);} - -static void my_numbox_send(t_my_numbox *x, t_symbol *s) -{iemgui_send(x, &x->x_gui, s);} - -static void my_numbox_receive(t_my_numbox *x, t_symbol *s) -{iemgui_receive(x, &x->x_gui, s);} - -static void my_numbox_label(t_my_numbox *x, t_symbol *s) -{iemgui_label((void *)x, &x->x_gui, s);} - -static void my_numbox_label_pos(t_my_numbox *x, t_symbol *s, int ac, t_atom *av) -{iemgui_label_pos((void *)x, &x->x_gui, s, ac, av);} - -static void my_numbox_label_font(t_my_numbox *x, - t_symbol *s, int ac, t_atom *av) -{ - int f = (int)atom_getintarg(1, ac, av); - - if(f < 4) - f = 4; - x->x_gui.x_fontsize = f; - f = (int)atom_getintarg(0, ac, av); - if((f < 0) || (f > 2)) - f = 0; - x->x_gui.x_fsf.x_font_style = f; - my_numbox_calc_fontwidth(x); - iemgui_label_font((void *)x, &x->x_gui, s, ac, av); -} - -static void my_numbox_log(t_my_numbox *x) -{ - x->x_lin0_log1 = 1; - if(my_numbox_check_minmax(x, x->x_min, x->x_max)) - { - sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update); - /*my_numbox_bang(x);*/ - } -} - -static void my_numbox_lin(t_my_numbox *x) -{ - x->x_lin0_log1 = 0; -} - -static void my_numbox_init(t_my_numbox *x, t_floatarg f) -{ - x->x_gui.x_isa.x_loadinit = (f==0.0)?0:1; -} - -static void my_numbox_loadbang(t_my_numbox *x) -{ - if(!sys_noloadbang && x->x_gui.x_isa.x_loadinit) - { - sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update); - my_numbox_bang(x); - } -} - -static void my_numbox_key(void *z, t_floatarg fkey) -{ - t_my_numbox *x = z; - char c=fkey; - char buf[3]; - buf[1] = 0; - - if (c == 0) - { - x->x_gui.x_fsf.x_change = 0; - clock_unset(x->x_clock_reset); - sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update); - return; - } - if(((c>='0')&&(c<='9'))||(c=='.')||(c=='-')|| - (c=='e')||(c=='+')||(c=='E')) - { - if(strlen(x->x_buf) < (IEMGUI_MAX_NUM_LEN-2)) - { - buf[0] = c; - strcat(x->x_buf, buf); - sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update); - } - } - else if((c=='\b')||(c==127)) - { - int sl=strlen(x->x_buf)-1; - - if(sl < 0) - sl = 0; - x->x_buf[sl] = 0; - sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update); - } - else if((c=='\n')||(c==13)) - { - x->x_val = atof(x->x_buf); - x->x_buf[0] = 0; - x->x_gui.x_fsf.x_change = 0; - clock_unset(x->x_clock_reset); - my_numbox_clip(x); - my_numbox_bang(x); - sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update); - } - clock_delay(x->x_clock_reset, 3000); -} - -static void my_numbox_list(t_my_numbox *x, t_symbol *s, int ac, t_atom *av) -{ - if (IS_A_FLOAT(av,0)) - { - my_numbox_set(x, atom_getfloatarg(0, ac, av)); - my_numbox_bang(x); - } -} - -static void *my_numbox_new(t_symbol *s, int argc, t_atom *argv) -{ - t_my_numbox *x = (t_my_numbox *)pd_new(my_numbox_class); - int bflcol[]={-262144, -1, -1}; - int w=5, h=14; - int lilo=0, f=0, ldx=0, ldy=-8; - int fs=10; - int log_height=256; - double min=-1.0e+37, max=1.0e+37,v=0.0; - char str[144]; - - if((argc >= 17)&&IS_A_FLOAT(argv,0)&&IS_A_FLOAT(argv,1) - &&IS_A_FLOAT(argv,2)&&IS_A_FLOAT(argv,3) - &&IS_A_FLOAT(argv,4)&&IS_A_FLOAT(argv,5) - &&(IS_A_SYMBOL(argv,6)||IS_A_FLOAT(argv,6)) - &&(IS_A_SYMBOL(argv,7)||IS_A_FLOAT(argv,7)) - &&(IS_A_SYMBOL(argv,8)||IS_A_FLOAT(argv,8)) - &&IS_A_FLOAT(argv,9)&&IS_A_FLOAT(argv,10) - &&IS_A_FLOAT(argv,11)&&IS_A_FLOAT(argv,12)&&IS_A_FLOAT(argv,13) - &&IS_A_FLOAT(argv,14)&&IS_A_FLOAT(argv,15)&&IS_A_FLOAT(argv,16)) - { - w = (int)atom_getintarg(0, argc, argv); - h = (int)atom_getintarg(1, argc, argv); - min = (double)atom_getfloatarg(2, argc, argv); - max = (double)atom_getfloatarg(3, argc, argv); - lilo = (int)atom_getintarg(4, argc, argv); - iem_inttosymargs(&x->x_gui.x_isa, atom_getintarg(5, argc, argv)); - iemgui_new_getnames(&x->x_gui, 6, argv); - ldx = (int)atom_getintarg(9, argc, argv); - ldy = (int)atom_getintarg(10, argc, argv); - iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(11, argc, argv)); - fs = (int)atom_getintarg(12, argc, argv); - bflcol[0] = (int)atom_getintarg(13, argc, argv); - bflcol[1] = (int)atom_getintarg(14, argc, argv); - bflcol[2] = (int)atom_getintarg(15, argc, argv); - v = atom_getfloatarg(16, argc, argv); - } - else iemgui_new_getnames(&x->x_gui, 6, 0); - if((argc == 18)&&IS_A_FLOAT(argv,17)) - { - log_height = (int)atom_getintarg(17, argc, argv); - } - x->x_gui.x_draw = (t_iemfunptr)my_numbox_draw; - x->x_gui.x_fsf.x_snd_able = 1; - x->x_gui.x_fsf.x_rcv_able = 1; - x->x_gui.x_glist = (t_glist *)canvas_getcurrent(); - if(x->x_gui.x_isa.x_loadinit) - x->x_val = v; - else - x->x_val = 0.0; - if(lilo != 0) lilo = 1; - x->x_lin0_log1 = lilo; - if(log_height < 10) - log_height = 10; - x->x_log_height = log_height; - if (!strcmp(x->x_gui.x_snd->s_name, "empty")) - x->x_gui.x_fsf.x_snd_able = 0; - if (!strcmp(x->x_gui.x_rcv->s_name, "empty")) - x->x_gui.x_fsf.x_rcv_able = 0; - if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica"); - else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times"); - else { x->x_gui.x_fsf.x_font_style = 0; - strcpy(x->x_gui.x_font, sys_font); } - if (x->x_gui.x_fsf.x_rcv_able) - pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); - x->x_gui.x_ldx = ldx; - x->x_gui.x_ldy = ldy; - if(fs < 4) - fs = 4; - x->x_gui.x_fontsize = fs; - if(w < 1) - w = 1; - x->x_gui.x_w = w; - if(h < 8) - h = 8; - x->x_gui.x_h = h; - x->x_buf[0] = 0; - my_numbox_calc_fontwidth(x); - my_numbox_check_minmax(x, min, max); - iemgui_all_colfromload(&x->x_gui, bflcol); - iemgui_verify_snd_ne_rcv(&x->x_gui); - x->x_clock_reset = clock_new(x, (t_method)my_numbox_tick_reset); - x->x_clock_wait = clock_new(x, (t_method)my_numbox_tick_wait); - x->x_gui.x_fsf.x_change = 0; - outlet_new(&x->x_gui.x_obj, &s_float); - return (x); -} - -static void my_numbox_free(t_my_numbox *x) -{ - if(x->x_gui.x_fsf.x_rcv_able) - pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); - clock_free(x->x_clock_reset); - clock_free(x->x_clock_wait); - gfxstub_deleteforkey(x); -} - -void nbx_setup(void) -{ - my_numbox_class = class_new(gensym("nbx"), (t_newmethod)my_numbox_new, - (t_method)my_numbox_free, sizeof(t_my_numbox), 0, A_GIMME, 0); - class_addcreator((t_newmethod)my_numbox_new, gensym("my_numbox"), - A_GIMME, 0); - class_addbang(my_numbox_class,my_numbox_bang); - class_addfloat(my_numbox_class,my_numbox_float); - class_addlist(my_numbox_class, my_numbox_list); - class_addmethod(my_numbox_class, (t_method)my_numbox_click, - gensym("click"), A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); - class_addmethod(my_numbox_class, (t_method)my_numbox_motion, - gensym("motion"), A_FLOAT, A_FLOAT, 0); - class_addmethod(my_numbox_class, (t_method)my_numbox_dialog, - gensym("dialog"), A_GIMME, 0); - class_addmethod(my_numbox_class, (t_method)my_numbox_loadbang, - gensym("loadbang"), 0); - class_addmethod(my_numbox_class, (t_method)my_numbox_set, - gensym("set"), A_FLOAT, 0); - class_addmethod(my_numbox_class, (t_method)my_numbox_size, - gensym("size"), A_GIMME, 0); - class_addmethod(my_numbox_class, (t_method)my_numbox_delta, - gensym("delta"), A_GIMME, 0); - class_addmethod(my_numbox_class, (t_method)my_numbox_pos, - gensym("pos"), A_GIMME, 0); - class_addmethod(my_numbox_class, (t_method)my_numbox_range, - gensym("range"), A_GIMME, 0); - class_addmethod(my_numbox_class, (t_method)my_numbox_color, - gensym("color"), A_GIMME, 0); - class_addmethod(my_numbox_class, (t_method)my_numbox_send, - gensym("send"), A_DEFSYM, 0); - class_addmethod(my_numbox_class, (t_method)my_numbox_receive, - gensym("receive"), A_DEFSYM, 0); - class_addmethod(my_numbox_class, (t_method)my_numbox_label, - gensym("label"), A_DEFSYM, 0); - class_addmethod(my_numbox_class, (t_method)my_numbox_label_pos, - gensym("label_pos"), A_GIMME, 0); - class_addmethod(my_numbox_class, (t_method)my_numbox_label_font, - gensym("label_font"), A_GIMME, 0); - class_addmethod(my_numbox_class, (t_method)my_numbox_log, - gensym("log"), 0); - class_addmethod(my_numbox_class, (t_method)my_numbox_lin, - gensym("lin"), 0); - class_addmethod(my_numbox_class, (t_method)my_numbox_init, - gensym("init"), A_FLOAT, 0); - class_addmethod(my_numbox_class, (t_method)my_numbox_log_height, - gensym("log_height"), A_FLOAT, 0); - my_numbox_widgetbehavior.w_getrectfn = my_numbox_getrect; - my_numbox_widgetbehavior.w_displacefn = iemgui_displace; - my_numbox_widgetbehavior.w_selectfn = iemgui_select; - my_numbox_widgetbehavior.w_activatefn = NULL; - my_numbox_widgetbehavior.w_deletefn = iemgui_delete; - my_numbox_widgetbehavior.w_visfn = iemgui_vis; - my_numbox_widgetbehavior.w_clickfn = my_numbox_newclick; - class_setwidget(my_numbox_class, &my_numbox_widgetbehavior); - class_sethelpsymbol(my_numbox_class, gensym("numbox2")); - class_setsavefn(my_numbox_class, my_numbox_save); - class_setpropertiesfn(my_numbox_class, my_numbox_properties); -} diff --git a/externals/vanilla/openpanel.c b/externals/vanilla/openpanel.c deleted file mode 100644 index 2efd8dfd49d5c8e724cea5067f6b405fe278d048..0000000000000000000000000000000000000000 --- a/externals/vanilla/openpanel.c +++ /dev/null @@ -1,62 +0,0 @@ -/* Copyright (c) 1997-2000 Miller Puckette. -* For information on usage and redistribution, and for a DISCLAIMER OF ALL -* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -/* dialogs. LATER, deal with the situation where the object goes -away before the panel does... */ - -#include "m_pd.h" -#include <stdio.h> -#include <string.h> - -static t_class *openpanel_class; - -typedef struct _openpanel -{ - t_object x_obj; - t_symbol *x_s; -} t_openpanel; - -static void *openpanel_new( void) -{ - char buf[50]; - t_openpanel *x = (t_openpanel *)pd_new(openpanel_class); - sprintf(buf, "d%lx", (t_int)x); - x->x_s = gensym(buf); - pd_bind(&x->x_obj.ob_pd, x->x_s); - outlet_new(&x->x_obj, &s_symbol); - return (x); -} - -static void openpanel_symbol(t_openpanel *x, t_symbol *s) -{ - char *path = (s && s->s_name) ? s->s_name : "\"\""; - sys_vgui("pdtk_openpanel {%s} {%s}\n", x->x_s->s_name, path); -} - -static void openpanel_bang(t_openpanel *x) -{ - openpanel_symbol(x, &s_); -} - -static void openpanel_callback(t_openpanel *x, t_symbol *s) -{ - outlet_symbol(x->x_obj.ob_outlet, s); -} - - -static void openpanel_free(t_openpanel *x) -{ - pd_unbind(&x->x_obj.ob_pd, x->x_s); -} - -void openpanel_setup(void) -{ - openpanel_class = class_new(gensym("openpanel"), - (t_newmethod)openpanel_new, (t_method)openpanel_free, - sizeof(t_openpanel), 0, 0); - class_addbang(openpanel_class, openpanel_bang); - class_addsymbol(openpanel_class, openpanel_symbol); - class_addmethod(openpanel_class, (t_method)openpanel_callback, - gensym("callback"), A_SYMBOL, 0); -} diff --git a/externals/vanilla/powtodb~.c b/externals/vanilla/powtodb~.c deleted file mode 100644 index 84883d4d3da59c08372c3f10756ae86de2dccb9e..0000000000000000000000000000000000000000 --- a/externals/vanilla/powtodb~.c +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright (c) 1997-2001 Miller Puckette and others. -* For information on usage and redistribution, and for a DISCLAIMER OF ALL -* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -#include "e_sqrt.h" - -typedef struct powtodb_tilde -{ - t_object x_obj; - t_float x_f; -} t_powtodb_tilde; - -t_class *powtodb_tilde_class; - -static void *powtodb_tilde_new(void) -{ - t_powtodb_tilde *x = (t_powtodb_tilde *)pd_new(powtodb_tilde_class); - outlet_new(&x->x_obj, gensym("signal")); - x->x_f = 0; - return (x); -} - -static t_int *powtodb_tilde_perform(t_int *w) -{ - t_sample *in = *(t_sample **)(w+1), *out = *(t_sample **)(w+2); - t_int n = *(t_int *)(w+3); - for (; n--; in++, out++) - { - t_sample f = *in; - if (f <= 0) *out = 0; - else - { - t_sample g = 100 + 10./LOGTEN * log(f); - *out = (g < 0 ? 0 : g); - } - } - return (w + 4); -} - -static void powtodb_tilde_dsp(t_powtodb_tilde *x, t_signal **sp) -{ - dsp_add(powtodb_tilde_perform, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); -} - -void powtodb_tilde_setup(void) -{ - powtodb_tilde_class = class_new(gensym("powtodb~"), (t_newmethod)powtodb_tilde_new, 0, - sizeof(t_powtodb_tilde), 0, 0); - CLASS_MAINSIGNALIN(powtodb_tilde_class, t_powtodb_tilde, x_f); - class_addmethod(powtodb_tilde_class, (t_method)powtodb_tilde_dsp, gensym("dsp"), 0); -} diff --git a/externals/vanilla/pow~.c b/externals/vanilla/pow~.c deleted file mode 100644 index b9920724672fcbbaa27aab5113ac65908c29abe0..0000000000000000000000000000000000000000 --- a/externals/vanilla/pow~.c +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright (c) 1997-2001 Miller Puckette and others. -* For information on usage and redistribution, and for a DISCLAIMER OF ALL -* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -#include "m_pd.h" -#include <math.h> - -static t_class *pow_tilde_class; - -typedef struct _pow_tilde -{ - t_object x_obj; - t_float x_f; -} t_pow_tilde; - -static void *pow_tilde_new(t_symbol *s, int argc, t_atom *argv) -{ - t_pow_tilde *x = (t_pow_tilde *)pd_new(pow_tilde_class); - inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); - outlet_new(&x->x_obj, &s_signal); - x->x_f = 0; - return (x); -} - -t_int *pow_tilde_perform(t_int *w) -{ - t_sample *in1 = (t_sample *)(w[1]); - t_sample *in2 = (t_sample *)(w[2]); - t_sample *out = (t_sample *)(w[3]); - int n = (int)(w[4]); - while (n--) - { - float f = *in1++; - if (f > 0) - *out = pow(f, *in2); - else *out = 0; - out++; - in2++; - } - return (w+5); -} - -static void pow_tilde_dsp(t_pow_tilde *x, t_signal **sp) -{ - dsp_add(pow_tilde_perform, 4, - sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[0]->s_n); -} - -void pow_tilde_setup(void) -{ - pow_tilde_class = class_new(gensym("pow~"), (t_newmethod)pow_tilde_new, 0, - sizeof(t_pow_tilde), 0, A_DEFFLOAT, 0); - CLASS_MAINSIGNALIN(pow_tilde_class, t_pow_tilde, x_f); - class_addmethod(pow_tilde_class, (t_method)pow_tilde_dsp, gensym("dsp"), 0); -} diff --git a/externals/vanilla/print.c b/externals/vanilla/print.c deleted file mode 100644 index 7857454d25e884632ea3adc8363e3fcbffd43122..0000000000000000000000000000000000000000 --- a/externals/vanilla/print.c +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright (c) 1997-1999 Miller Puckette. -* For information on usage and redistribution, and for a DISCLAIMER OF ALL -* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -/* interface objects */ - -#include "m_pd.h" -#include <string.h> - -/* -------------------------- print ------------------------------ */ -static t_class *print_class; - -typedef struct _print -{ - t_object x_obj; - t_symbol *x_sym; -} t_print; - -static void *print_new(t_symbol *sel, int argc, t_atom *argv) -{ - t_print *x = (t_print *)pd_new(print_class); - t_symbol *s = atom_getsymbolarg(0, argc, argv); - if (!*s->s_name) - x->x_sym = gensym("print"); - else if (!strcmp(s->s_name, "-n")) - x->x_sym = &s_; - else x->x_sym = s; - return (x); -} - -static void print_bang(t_print *x) -{ - post("%s%sbang", x->x_sym->s_name, (*x->x_sym->s_name ? ": " : "")); -} - -static void print_pointer(t_print *x, t_gpointer *gp) -{ - post("%s%s(gpointer)", x->x_sym->s_name, (*x->x_sym->s_name ? ": " : "")); -} - -static void print_float(t_print *x, t_float f) -{ - post("%s%s%g", x->x_sym->s_name, (*x->x_sym->s_name ? ": " : ""), f); -} - -static void print_list(t_print *x, t_symbol *s, int argc, t_atom *argv) -{ - int i; - if (argc && argv->a_type != A_SYMBOL) startpost("%s:", x->x_sym->s_name); - else startpost("%s%s%s", x->x_sym->s_name, - (*x->x_sym->s_name ? ": " : ""), - (argc > 1 ? s_list.s_name : (argc == 1 ? s_symbol.s_name : - s_bang.s_name))); - postatom(argc, argv); - endpost(); -} - -static void print_anything(t_print *x, t_symbol *s, int argc, t_atom *argv) -{ - int i; - startpost("%s%s%s", x->x_sym->s_name, (*x->x_sym->s_name ? ": " : ""), - s->s_name); - postatom(argc, argv); - endpost(); -} - -void print_setup(void) -{ - print_class = class_new(gensym("print"), (t_newmethod)print_new, 0, - sizeof(t_print), 0, A_GIMME, 0); - class_addbang(print_class, print_bang); - class_addfloat(print_class, print_float); - class_addpointer(print_class, print_pointer); - class_addlist(print_class, print_list); - class_addanything(print_class, print_anything); -} diff --git a/externals/vanilla/q8_rsqrt~-help.pd b/externals/vanilla/q8_rsqrt~-help.pd deleted file mode 100644 index 865a77ab392a7cbf4e6b18265177cb9f3d15749f..0000000000000000000000000000000000000000 --- a/externals/vanilla/q8_rsqrt~-help.pd +++ /dev/null @@ -1,3 +0,0 @@ -#N canvas 61 168 450 300 10; -#X text 75 126 this is a deprecated alias for; -#X obj 267 126 rsqrt~; diff --git a/externals/vanilla/q8_rsqrt~.pd b/externals/vanilla/q8_rsqrt~.pd deleted file mode 100644 index 867d3d45a217d2d088df4b02fd08915163c21797..0000000000000000000000000000000000000000 --- a/externals/vanilla/q8_rsqrt~.pd +++ /dev/null @@ -1,7 +0,0 @@ -#N canvas 192 364 450 300 10; -#X obj 149 110 inlet~; -#X obj 149 169 outlet~; -#X obj 149 136 rsqrt~; -#X text 84 56 q8_rsqrt~ is an alias for rsqrt~; -#X connect 0 0 2 0; -#X connect 2 0 1 0; diff --git a/externals/vanilla/q8_sqrt~-help.pd b/externals/vanilla/q8_sqrt~-help.pd deleted file mode 100644 index 85bcb202ee22a8192aec43bea786af04b8e800cf..0000000000000000000000000000000000000000 --- a/externals/vanilla/q8_sqrt~-help.pd +++ /dev/null @@ -1,3 +0,0 @@ -#N canvas 61 168 450 300 10; -#X text 75 126 this is a deprecated alias for; -#X obj 267 126 sqrt~; diff --git a/externals/vanilla/q8_sqrt~.pd b/externals/vanilla/q8_sqrt~.pd deleted file mode 100644 index 6a11448a034b5e9763276c334bc8f27731d3e839..0000000000000000000000000000000000000000 --- a/externals/vanilla/q8_sqrt~.pd +++ /dev/null @@ -1,7 +0,0 @@ -#N canvas 192 364 450 300 10; -#X obj 149 110 inlet~; -#X obj 149 169 outlet~; -#X obj 149 136 sqrt~; -#X text 84 56 q8_sqrt~ is an alias for sqrt~; -#X connect 0 0 2 0; -#X connect 2 0 1 0; diff --git a/externals/vanilla/qlist.c b/externals/vanilla/qlist.c deleted file mode 100644 index 57f5b2d1013c8f149e2843639ce2db908fd8202c..0000000000000000000000000000000000000000 --- a/externals/vanilla/qlist.c +++ /dev/null @@ -1,260 +0,0 @@ -/* Copyright (c) 1997-1999 Miller Puckette and others. -* For information on usage and redistribution, and for a DISCLAIMER OF ALL -* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -#include "m_pd.h" -#include <string.h> -#ifdef _WIN32 -#include <io.h> -#else -#include <unistd.h> -#endif - -typedef struct _qlist -{ - t_object x_ob; - t_outlet *x_bangout; - void *x_binbuf; - int x_onset; /* playback position */ - t_clock *x_clock; - t_float x_tempo; - double x_whenclockset; - t_float x_clockdelay; - t_symbol *x_dir; - t_canvas *x_canvas; - int x_reentered; -} t_qlist; - -static void qlist_tick(t_qlist *x); - -static t_class *qlist_class; - -static void *qlist_new( void) -{ - t_symbol *name, *filename = 0; - t_qlist *x = (t_qlist *)pd_new(qlist_class); - x->x_binbuf = binbuf_new(); - x->x_clock = clock_new(x, (t_method)qlist_tick); - outlet_new(&x->x_ob, &s_list); - x->x_bangout = outlet_new(&x->x_ob, &s_bang); - x->x_onset = 0x7fffffff; - x->x_tempo = 1; - x->x_whenclockset = 0; - x->x_clockdelay = 0; - x->x_canvas = canvas_getcurrent(); - x->x_reentered = 0; - return (x); -} - -static void qlist_rewind(t_qlist *x) -{ - x->x_onset = 0; - if (x->x_clock) clock_unset(x->x_clock); - x->x_whenclockset = 0; - x->x_reentered = 1; -} - -static void qlist_donext(t_qlist *x, int drop, int automatic) -{ - t_pd *target = 0; - while (1) - { - int argc = binbuf_getnatom(x->x_binbuf), - count, onset = x->x_onset, onset2, wasreentered; - t_atom *argv = binbuf_getvec(x->x_binbuf); - t_atom *ap = argv + onset, *ap2; - if (onset >= argc) goto end; - while (ap->a_type == A_SEMI || ap->a_type == A_COMMA) - { - if (ap->a_type == A_SEMI) target = 0; - onset++, ap++; - if (onset >= argc) goto end; - } - - if (!target && ap->a_type == A_FLOAT) - { - ap2 = ap + 1; - onset2 = onset + 1; - while (onset2 < argc && ap2->a_type == A_FLOAT) - onset2++, ap2++; - x->x_onset = onset2; - if (automatic) - { - clock_delay(x->x_clock, - x->x_clockdelay = ap->a_w.w_float * x->x_tempo); - x->x_whenclockset = clock_getsystime(); - } - else outlet_list(x->x_ob.ob_outlet, 0, onset2-onset, ap); - return; - } - ap2 = ap + 1; - onset2 = onset + 1; - while (onset2 < argc && - (ap2->a_type == A_FLOAT || ap2->a_type == A_SYMBOL)) - onset2++, ap2++; - x->x_onset = onset2; - count = onset2 - onset; - if (!target) - { - if (ap->a_type != A_SYMBOL) continue; - else if (!(target = ap->a_w.w_symbol->s_thing)) - { - pd_error(x, "qlist: %s: no such object", - ap->a_w.w_symbol->s_name); - continue; - } - ap++; - onset++; - count--; - if (!count) - { - x->x_onset = onset2; - continue; - } - } - wasreentered = x->x_reentered; - x->x_reentered = 0; - if (!drop) - { - if (ap->a_type == A_FLOAT) - typedmess(target, &s_list, count, ap); - else if (ap->a_type == A_SYMBOL) - typedmess(target, ap->a_w.w_symbol, count-1, ap+1); - } - if (x->x_reentered) - return; - x->x_reentered = wasreentered; - } /* while (1); never falls through */ - -end: - x->x_onset = 0x7fffffff; - outlet_bang(x->x_bangout); - x->x_whenclockset = 0; -} - -static void qlist_next(t_qlist *x, t_floatarg drop) -{ - qlist_donext(x, drop != 0, 0); -} - -static void qlist_bang(t_qlist *x) -{ - qlist_rewind(x); - qlist_donext(x, 0, 1); -} - -static void qlist_tick(t_qlist *x) -{ - x->x_whenclockset = 0; - qlist_donext(x, 0, 1); -} - -static void qlist_add(t_qlist *x, t_symbol *s, int ac, t_atom *av) -{ - t_atom a; - SETSEMI(&a); - binbuf_add(x->x_binbuf, ac, av); - binbuf_add(x->x_binbuf, 1, &a); -} - -static void qlist_add2(t_qlist *x, t_symbol *s, int ac, t_atom *av) -{ - binbuf_add(x->x_binbuf, ac, av); -} - -static void qlist_clear(t_qlist *x) -{ - qlist_rewind(x); - binbuf_clear(x->x_binbuf); -} - -static void qlist_set(t_qlist *x, t_symbol *s, int ac, t_atom *av) -{ - qlist_clear(x); - qlist_add(x, s, ac, av); -} - -static void qlist_read(t_qlist *x, t_symbol *filename, t_symbol *format) -{ - int cr = 0; - if (!strcmp(format->s_name, "cr")) - cr = 1; - else if (*format->s_name) - pd_error(x, "qlist_read: unknown flag: %s", format->s_name); - - if (binbuf_read_via_canvas(x->x_binbuf, filename->s_name, x->x_canvas, cr)) - pd_error(x, "%s: read failed", filename->s_name); - x->x_onset = 0x7fffffff; - x->x_reentered = 1; -} - -static void qlist_write(t_qlist *x, t_symbol *filename, t_symbol *format) -{ - int cr = 0; - char buf[MAXPDSTRING]; - canvas_makefilename(x->x_canvas, filename->s_name, - buf, MAXPDSTRING); - if (!strcmp(format->s_name, "cr")) - cr = 1; - else if (*format->s_name) - pd_error(x, "qlist_read: unknown flag: %s", format->s_name); - if (binbuf_write(x->x_binbuf, buf, "", cr)) - pd_error(x, "%s: write failed", filename->s_name); -} - -static void qlist_print(t_qlist *x) -{ - post("--------- textfile or qlist contents: -----------"); - binbuf_print(x->x_binbuf); -} - -static void qlist_tempo(t_qlist *x, t_float f) -{ - t_float newtempo; - if (f < 1e-20) f = 1e-20; - else if (f > 1e20) f = 1e20; - newtempo = 1./f; - if (x->x_whenclockset != 0) - { - t_float elapsed = clock_gettimesince(x->x_whenclockset); - t_float left = x->x_clockdelay - elapsed; - if (left < 0) left = 0; - left *= newtempo / x->x_tempo; - clock_delay(x->x_clock, left); - } - x->x_tempo = newtempo; -} - -static void qlist_free(t_qlist *x) -{ - binbuf_free(x->x_binbuf); - if (x->x_clock) clock_free(x->x_clock); -} - -void qlist_setup(void ) -{ - qlist_class = class_new(gensym("qlist"), (t_newmethod)qlist_new, - (t_method)qlist_free, sizeof(t_qlist), 0, 0); - class_addmethod(qlist_class, (t_method)qlist_rewind, gensym("rewind"), 0); - class_addmethod(qlist_class, (t_method)qlist_next, - gensym("next"), A_DEFFLOAT, 0); - class_addmethod(qlist_class, (t_method)qlist_set, gensym("set"), - A_GIMME, 0); - class_addmethod(qlist_class, (t_method)qlist_clear, gensym("clear"), 0); - class_addmethod(qlist_class, (t_method)qlist_add, gensym("add"), - A_GIMME, 0); - class_addmethod(qlist_class, (t_method)qlist_add2, gensym("add2"), - A_GIMME, 0); - class_addmethod(qlist_class, (t_method)qlist_add, gensym("append"), - A_GIMME, 0); - class_addmethod(qlist_class, (t_method)qlist_read, gensym("read"), - A_SYMBOL, A_DEFSYM, 0); - class_addmethod(qlist_class, (t_method)qlist_write, gensym("write"), - A_SYMBOL, A_DEFSYM, 0); - class_addmethod(qlist_class, (t_method)qlist_print, gensym("print"), - A_DEFSYM, 0); - class_addmethod(qlist_class, (t_method)qlist_tempo, - gensym("tempo"), A_FLOAT, 0); - class_addbang(qlist_class, qlist_bang); -} - diff --git a/externals/vanilla/rmstodb~.c b/externals/vanilla/rmstodb~.c deleted file mode 100644 index a8bac0403590da841dbb2fd6b57c026333ab39a5..0000000000000000000000000000000000000000 --- a/externals/vanilla/rmstodb~.c +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright (c) 1997-2001 Miller Puckette and others. -* For information on usage and redistribution, and for a DISCLAIMER OF ALL -* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -#include "e_sqrt.h" - -typedef struct rmstodb_tilde -{ - t_object x_obj; - t_float x_f; -} t_rmstodb_tilde; - -t_class *rmstodb_tilde_class; - -static void *rmstodb_tilde_new(void) -{ - t_rmstodb_tilde *x = (t_rmstodb_tilde *)pd_new(rmstodb_tilde_class); - outlet_new(&x->x_obj, gensym("signal")); - x->x_f = 0; - return (x); -} - -static t_int *rmstodb_tilde_perform(t_int *w) -{ - t_sample *in = *(t_sample **)(w+1), *out = *(t_sample **)(w+2); - t_int n = *(t_int *)(w+3); - for (; n--; in++, out++) - { - t_sample f = *in; - if (f <= 0) *out = 0; - else - { - t_sample g = 100 + 20./LOGTEN * log(f); - *out = (g < 0 ? 0 : g); - } - } - return (w + 4); -} - -static void rmstodb_tilde_dsp(t_rmstodb_tilde *x, t_signal **sp) -{ - dsp_add(rmstodb_tilde_perform, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); -} - -void rmstodb_tilde_setup(void) -{ - rmstodb_tilde_class = class_new(gensym("rmstodb~"), (t_newmethod)rmstodb_tilde_new, 0, - sizeof(t_rmstodb_tilde), 0, 0); - CLASS_MAINSIGNALIN(rmstodb_tilde_class, t_rmstodb_tilde, x_f); - class_addmethod(rmstodb_tilde_class, (t_method)rmstodb_tilde_dsp, gensym("dsp"), 0); -} diff --git a/externals/vanilla/rsqrt~.c b/externals/vanilla/rsqrt~.c deleted file mode 100644 index e84f4c31fdf6d710cd9f49df710d91ac94f39e63..0000000000000000000000000000000000000000 --- a/externals/vanilla/rsqrt~.c +++ /dev/null @@ -1,80 +0,0 @@ -/* Copyright (c) 1997-2001 Miller Puckette and others. -* For information on usage and redistribution, and for a DISCLAIMER OF ALL -* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -#include "e_sqrt.h" -#include "m_pd.h" -#include <math.h> - -/* sigrsqrt - reciprocal square root good to 8 mantissa bits */ - -static float rsqrt_exptab[DUMTAB1SIZE], rsqrt_mantissatab[DUMTAB2SIZE]; - -static void init_rsqrt(void) -{ - int i; - for (i = 0; i < DUMTAB1SIZE; i++) - { - float f; - int32 l = (i ? (i == DUMTAB1SIZE-1 ? DUMTAB1SIZE-2 : i) : 1)<< 23; - *(int32 *)(&f) = l; - rsqrt_exptab[i] = 1./sqrt(f); - } - for (i = 0; i < DUMTAB2SIZE; i++) - { - float f = 1 + (1./DUMTAB2SIZE) * i; - rsqrt_mantissatab[i] = 1./sqrt(f); - } -} - -typedef struct sigrsqrt -{ - t_object x_obj; - t_float x_f; -} t_sigrsqrt; - -static t_class *sigrsqrt_class; - -static void *sigrsqrt_new(void) -{ - t_sigrsqrt *x = (t_sigrsqrt *)pd_new(sigrsqrt_class); - outlet_new(&x->x_obj, gensym("signal")); - x->x_f = 0; - return (x); -} - -static t_int *sigrsqrt_perform(t_int *w) -{ - t_sample *in = *(t_sample **)(w+1), *out = *(t_sample **)(w+2); - t_int n = *(t_int *)(w+3); - while (n--) - { - t_sample f = *in; - long l = *(long *)(in++); - if (f < 0) *out++ = 0; - else - { - t_sample g = rsqrt_exptab[(l >> 23) & 0xff] * - rsqrt_mantissatab[(l >> 13) & 0x3ff]; - *out++ = 1.5 * g - 0.5 * g * g * g * f; - } - } - return (w + 4); -} - -static void sigrsqrt_dsp(t_sigrsqrt *x, t_signal **sp) -{ - dsp_add(sigrsqrt_perform, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); -} - -void rsqrt_tilde_setup(void) -{ - init_rsqrt(); - sigrsqrt_class = class_new(gensym("rsqrt~"), (t_newmethod)sigrsqrt_new, 0, - sizeof(t_sigrsqrt), 0, 0); - /* an old name for it: */ - class_addcreator(sigrsqrt_new, gensym("q8_rsqrt~"), 0); - CLASS_MAINSIGNALIN(sigrsqrt_class, t_sigrsqrt, x_f); - class_addmethod(sigrsqrt_class, (t_method)sigrsqrt_dsp, gensym("dsp"), 0); -} - diff --git a/externals/vanilla/savepanel.c b/externals/vanilla/savepanel.c deleted file mode 100644 index 33c8cb8a7f06967d80f5d1add0896d0e759f19c0..0000000000000000000000000000000000000000 --- a/externals/vanilla/savepanel.c +++ /dev/null @@ -1,63 +0,0 @@ -/* Copyright (c) 1997-2000 Miller Puckette. -* For information on usage and redistribution, and for a DISCLAIMER OF ALL -* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -/* dialogs. LATER, deal with the situation where the object goes -away before the panel does... */ - -#include "m_pd.h" -#include <stdio.h> -#include <string.h> - -static t_class *savepanel_class; - -typedef struct _savepanel -{ - t_object x_obj; - t_canvas *x_canvas; - t_symbol *x_s; -} t_savepanel; - -static void *savepanel_new( void) -{ - char buf[50]; - t_savepanel *x = (t_savepanel *)pd_new(savepanel_class); - sprintf(buf, "d%lx", (t_int)x); - x->x_s = gensym(buf); - x->x_canvas = canvas_getcurrent(); - pd_bind(&x->x_obj.ob_pd, x->x_s); - outlet_new(&x->x_obj, &s_symbol); - return (x); -} - -static void savepanel_symbol(t_savepanel *x, t_symbol *s) -{ - char *path = (s && s->s_name) ? s->s_name : "\"\""; - sys_vgui("pdtk_savepanel {%s} {%s}\n", x->x_s->s_name, path); -} - -static void savepanel_bang(t_savepanel *x) -{ - savepanel_symbol(x, &s_); -} - -static void savepanel_callback(t_savepanel *x, t_symbol *s) -{ - outlet_symbol(x->x_obj.ob_outlet, s); -} - -static void savepanel_free(t_savepanel *x) -{ - pd_unbind(&x->x_obj.ob_pd, x->x_s); -} - -void savepanel_setup(void) -{ - savepanel_class = class_new(gensym("savepanel"), - (t_newmethod)savepanel_new, (t_method)savepanel_free, - sizeof(t_savepanel), 0, 0); - class_addbang(savepanel_class, savepanel_bang); - class_addsymbol(savepanel_class, savepanel_symbol); - class_addmethod(savepanel_class, (t_method)savepanel_callback, - gensym("callback"), A_SYMBOL, 0); -} diff --git a/externals/vanilla/sqrt~.c b/externals/vanilla/sqrt~.c deleted file mode 100644 index 65c09581ab43603e8a73f737d5eb800e6c4892ed..0000000000000000000000000000000000000000 --- a/externals/vanilla/sqrt~.c +++ /dev/null @@ -1,56 +0,0 @@ -/* Copyright (c) 1997-2001 Miller Puckette and others. -* For information on usage and redistribution, and for a DISCLAIMER OF ALL -* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -#include "e_sqrt.h" - -static float rsqrt_exptab[DUMTAB1SIZE], rsqrt_mantissatab[DUMTAB2SIZE]; - -typedef struct sigsqrt -{ - t_object x_obj; - t_float x_f; -} t_sigsqrt; - -static t_class *sigsqrt_class; - -static void *sigsqrt_new(void) -{ - t_sigsqrt *x = (t_sigsqrt *)pd_new(sigsqrt_class); - outlet_new(&x->x_obj, gensym("signal")); - x->x_f = 0; - return (x); -} - -t_int *sigsqrt_perform(t_int *w) /* not static; also used in d_fft.c */ -{ - t_sample *in = *(t_sample **)(w+1), *out = *(t_sample **)(w+2); - t_int n = *(t_int *)(w+3); - while (n--) - { - t_sample f = *in; - long l = *(long *)(in++); - if (f < 0) *out++ = 0; - else - { - t_sample g = rsqrt_exptab[(l >> 23) & 0xff] * - rsqrt_mantissatab[(l >> 13) & 0x3ff]; - *out++ = f * (1.5 * g - 0.5 * g * g * g * f); - } - } - return (w + 4); -} - -static void sigsqrt_dsp(t_sigsqrt *x, t_signal **sp) -{ - dsp_add(sigsqrt_perform, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); -} - -void sqrt_tilde_setup(void) -{ - sigsqrt_class = class_new(gensym("sqrt~"), (t_newmethod)sigsqrt_new, 0, - sizeof(t_sigsqrt), 0, 0); - class_addcreator(sigsqrt_new, gensym("q8_sqrt~"), 0); /* old name */ - CLASS_MAINSIGNALIN(sigsqrt_class, t_sigsqrt, x_f); - class_addmethod(sigsqrt_class, (t_method)sigsqrt_dsp, gensym("dsp"), 0); -} diff --git a/externals/vanilla/textfile.c b/externals/vanilla/textfile.c deleted file mode 100644 index bc76f360325956c05e08a269f7790d4c0493f2c0..0000000000000000000000000000000000000000 --- a/externals/vanilla/textfile.c +++ /dev/null @@ -1,177 +0,0 @@ -/* Copyright (c) 1997-1999 Miller Puckette and others. -* For information on usage and redistribution, and for a DISCLAIMER OF ALL -* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -#include "m_pd.h" -#include <string.h> -#ifdef _WIN32 -#include <io.h> -#else -#include <unistd.h> -#endif - -typedef struct _qlist -{ - t_object x_ob; - t_outlet *x_bangout; - void *x_binbuf; - int x_onset; /* playback position */ - t_clock *x_clock; - t_float x_tempo; - double x_whenclockset; - t_float x_clockdelay; - t_symbol *x_dir; - t_canvas *x_canvas; - int x_reentered; -} t_qlist; - -static t_class *textfile_class; -typedef t_qlist t_textfile; - -static void qlist_rewind(t_qlist *x) -{ - x->x_onset = 0; - if (x->x_clock) clock_unset(x->x_clock); - x->x_whenclockset = 0; - x->x_reentered = 1; -} - -static void qlist_add(t_qlist *x, t_symbol *s, int ac, t_atom *av) -{ - t_atom a; - SETSEMI(&a); - binbuf_add(x->x_binbuf, ac, av); - binbuf_add(x->x_binbuf, 1, &a); -} - -static void qlist_add2(t_qlist *x, t_symbol *s, int ac, t_atom *av) -{ - binbuf_add(x->x_binbuf, ac, av); -} - -static void qlist_clear(t_qlist *x) -{ - qlist_rewind(x); - binbuf_clear(x->x_binbuf); -} - -static void qlist_set(t_qlist *x, t_symbol *s, int ac, t_atom *av) -{ - qlist_clear(x); - qlist_add(x, s, ac, av); -} - -static void qlist_read(t_qlist *x, t_symbol *filename, t_symbol *format) -{ - int cr = 0; - if (!strcmp(format->s_name, "cr")) - cr = 1; - else if (*format->s_name) - pd_error(x, "qlist_read: unknown flag: %s", format->s_name); - - if (binbuf_read_via_canvas(x->x_binbuf, filename->s_name, x->x_canvas, cr)) - pd_error(x, "%s: read failed", filename->s_name); - x->x_onset = 0x7fffffff; - x->x_reentered = 1; -} - -static void qlist_write(t_qlist *x, t_symbol *filename, t_symbol *format) -{ - int cr = 0; - char buf[MAXPDSTRING]; - canvas_makefilename(x->x_canvas, filename->s_name, - buf, MAXPDSTRING); - if (!strcmp(format->s_name, "cr")) - cr = 1; - else if (*format->s_name) - pd_error(x, "qlist_read: unknown flag: %s", format->s_name); - if (binbuf_write(x->x_binbuf, buf, "", cr)) - pd_error(x, "%s: write failed", filename->s_name); -} - -static void qlist_print(t_qlist *x) -{ - post("--------- textfile or qlist contents: -----------"); - binbuf_print(x->x_binbuf); -} - -static void *textfile_new( void) -{ - t_symbol *name, *filename = 0; - t_textfile *x = (t_textfile *)pd_new(textfile_class); - x->x_binbuf = binbuf_new(); - outlet_new(&x->x_ob, &s_list); - x->x_bangout = outlet_new(&x->x_ob, &s_bang); - x->x_onset = 0x7fffffff; - x->x_reentered = 0; - x->x_tempo = 1; - x->x_whenclockset = 0; - x->x_clockdelay = 0; - x->x_clock = NULL; - x->x_canvas = canvas_getcurrent(); - return (x); -} - -static void textfile_bang(t_textfile *x) -{ - int argc = binbuf_getnatom(x->x_binbuf), - count, onset = x->x_onset, onset2; - t_atom *argv = binbuf_getvec(x->x_binbuf); - t_atom *ap = argv + onset, *ap2; - while (onset < argc && - (ap->a_type == A_SEMI || ap->a_type == A_COMMA)) - onset++, ap++; - onset2 = onset; - ap2 = ap; - while (onset2 < argc && - (ap2->a_type != A_SEMI && ap2->a_type != A_COMMA)) - onset2++, ap2++; - if (onset2 > onset) - { - x->x_onset = onset2; - if (ap->a_type == A_SYMBOL) - outlet_anything(x->x_ob.ob_outlet, ap->a_w.w_symbol, - onset2-onset-1, ap+1); - else outlet_list(x->x_ob.ob_outlet, 0, onset2-onset, ap); - } - else - { - x->x_onset = 0x7fffffff; - outlet_bang(x->x_bangout); - } -} - -static void textfile_rewind(t_qlist *x) -{ - x->x_onset = 0; -} - -static void textfile_free(t_textfile *x) -{ - binbuf_free(x->x_binbuf); -} - -void textfile_setup(void ) -{ - textfile_class = class_new(gensym("textfile"), (t_newmethod)textfile_new, - (t_method)textfile_free, sizeof(t_textfile), 0, 0); - class_addmethod(textfile_class, (t_method)textfile_rewind, gensym("rewind"), - 0); - class_addmethod(textfile_class, (t_method)qlist_set, gensym("set"), - A_GIMME, 0); - class_addmethod(textfile_class, (t_method)qlist_clear, gensym("clear"), 0); - class_addmethod(textfile_class, (t_method)qlist_add, gensym("add"), - A_GIMME, 0); - class_addmethod(textfile_class, (t_method)qlist_add2, gensym("add2"), - A_GIMME, 0); - class_addmethod(textfile_class, (t_method)qlist_add, gensym("append"), - A_GIMME, 0); - class_addmethod(textfile_class, (t_method)qlist_read, gensym("read"), - A_SYMBOL, A_DEFSYM, 0); - class_addmethod(textfile_class, (t_method)qlist_write, gensym("write"), - A_SYMBOL, A_DEFSYM, 0); - class_addmethod(textfile_class, (t_method)qlist_print, gensym("print"), - A_DEFSYM, 0); - class_addbang(textfile_class, textfile_bang); -} - diff --git a/externals/vanilla/tgl.c b/externals/vanilla/tgl.c deleted file mode 100644 index 541521d6e9bce32de3b954f519f03f710743b51f..0000000000000000000000000000000000000000 --- a/externals/vanilla/tgl.c +++ /dev/null @@ -1,475 +0,0 @@ -/* Copyright (c) 1997-1999 Miller Puckette. - * For information on usage and redistribution, and for a DISCLAIMER OF ALL - * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -/* g_7_guis.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ -/* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */ - - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <ctype.h> -#include "m_pd.h" -#include "g_canvas.h" - -#include "g_all_guis.h" -#include <math.h> - -#ifdef MSW -#include <io.h> -#else -#include <unistd.h> -#endif - -/* --------------- tgl gui-toggle ------------------------- */ - -t_widgetbehavior toggle_widgetbehavior; -static t_class *toggle_class; - -/* widget helper functions */ - -void toggle_draw_update(t_toggle *x, t_glist *glist) -{ - if(glist_isvisible(glist)) - { - t_canvas *canvas=glist_getcanvas(glist); - - sys_vgui(".x%lx.c itemconfigure %lxX1 -fill #%6.6x\n", canvas, x, - (x->x_on!=0.0)?x->x_gui.x_fcol:x->x_gui.x_bcol); - sys_vgui(".x%lx.c itemconfigure %lxX2 -fill #%6.6x\n", canvas, x, - (x->x_on!=0.0)?x->x_gui.x_fcol:x->x_gui.x_bcol); - } -} - -void toggle_draw_new(t_toggle *x, t_glist *glist) -{ - t_canvas *canvas=glist_getcanvas(glist); - int w=1, xx=text_xpix(&x->x_gui.x_obj, glist), yy=text_ypix(&x->x_gui.x_obj, glist); - - if(x->x_gui.x_w >= 30) - w = 2; - if(x->x_gui.x_w >= 60) - w = 3; - sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill #%6.6x -tags %lxBASE\n", - canvas, xx, yy, xx + x->x_gui.x_w, yy + x->x_gui.x_h, - x->x_gui.x_bcol, x); - sys_vgui(".x%lx.c create line %d %d %d %d -width %d -fill #%6.6x -tags %lxX1\n", - canvas, xx+w+1, yy+w+1, xx + x->x_gui.x_w-w, yy + x->x_gui.x_h-w, w, - (x->x_on!=0.0)?x->x_gui.x_fcol:x->x_gui.x_bcol, x); - sys_vgui(".x%lx.c create line %d %d %d %d -width %d -fill #%6.6x -tags %lxX2\n", - canvas, xx+w+1, yy + x->x_gui.x_h-w-1, xx + x->x_gui.x_w-w, yy+w, w, - (x->x_on!=0.0)?x->x_gui.x_fcol:x->x_gui.x_bcol, x); - sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \ - -font {{%s} -%d %s} -fill #%6.6x -tags %lxLABEL\n", - canvas, xx+x->x_gui.x_ldx, - yy+x->x_gui.x_ldy, - strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"", - x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, - x->x_gui.x_lcol, x); - if(!x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxOUT%d\n", - canvas, xx, yy + x->x_gui.x_h-1, xx + IOWIDTH, yy + x->x_gui.x_h, x, 0); - if(!x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxIN%d\n", - canvas, xx, yy, xx + IOWIDTH, yy+1, x, 0); -} - -void toggle_draw_move(t_toggle *x, t_glist *glist) -{ - t_canvas *canvas=glist_getcanvas(glist); - int w=1, xx=text_xpix(&x->x_gui.x_obj, glist), yy=text_ypix(&x->x_gui.x_obj, glist); - - if(x->x_gui.x_w >= 30) - w = 2; - - if(x->x_gui.x_w >= 60) - w = 3; - sys_vgui(".x%lx.c coords %lxBASE %d %d %d %d\n", - canvas, x, xx, yy, xx + x->x_gui.x_w, yy + x->x_gui.x_h); - sys_vgui(".x%lx.c itemconfigure %lxX1 -width %d\n", canvas, x, w); - sys_vgui(".x%lx.c coords %lxX1 %d %d %d %d\n", - canvas, x, xx+w+1, yy+w+1, xx + x->x_gui.x_w-w, yy + x->x_gui.x_h-w); - sys_vgui(".x%lx.c itemconfigure %lxX2 -width %d\n", canvas, x, w); - sys_vgui(".x%lx.c coords %lxX2 %d %d %d %d\n", - canvas, x, xx+w+1, yy + x->x_gui.x_h-w-1, xx + x->x_gui.x_w-w, yy+w); - sys_vgui(".x%lx.c coords %lxLABEL %d %d\n", - canvas, x, xx+x->x_gui.x_ldx, yy+x->x_gui.x_ldy); - if(!x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c coords %lxOUT%d %d %d %d %d\n", - canvas, x, 0, xx, yy + x->x_gui.x_h-1, xx + IOWIDTH, yy + x->x_gui.x_h); - if(!x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c coords %lxIN%d %d %d %d %d\n", - canvas, x, 0, xx, yy, xx + IOWIDTH, yy+1); -} - -void toggle_draw_erase(t_toggle* x, t_glist* glist) -{ - t_canvas *canvas=glist_getcanvas(glist); - - sys_vgui(".x%lx.c delete %lxBASE\n", canvas, x); - sys_vgui(".x%lx.c delete %lxX1\n", canvas, x); - sys_vgui(".x%lx.c delete %lxX2\n", canvas, x); - sys_vgui(".x%lx.c delete %lxLABEL\n", canvas, x); - if(!x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c delete %lxOUT%d\n", canvas, x, 0); - if(!x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c delete %lxIN%d\n", canvas, x, 0); -} - -void toggle_draw_config(t_toggle* x, t_glist* glist) -{ - t_canvas *canvas=glist_getcanvas(glist); - - sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {{%s} -%d %s} -fill #%6.6x -text {%s} \n", - canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, - x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_lcol, - strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:""); - sys_vgui(".x%lx.c itemconfigure %lxBASE -fill #%6.6x\n", canvas, x, - x->x_gui.x_bcol); - sys_vgui(".x%lx.c itemconfigure %lxX1 -fill #%6.6x\n", canvas, x, - x->x_on?x->x_gui.x_fcol:x->x_gui.x_bcol); - sys_vgui(".x%lx.c itemconfigure %lxX2 -fill #%6.6x\n", canvas, x, - x->x_on?x->x_gui.x_fcol:x->x_gui.x_bcol); -} - -void toggle_draw_io(t_toggle* x, t_glist* glist, int old_snd_rcv_flags) -{ - int xpos=text_xpix(&x->x_gui.x_obj, glist); - int ypos=text_ypix(&x->x_gui.x_obj, glist); - t_canvas *canvas=glist_getcanvas(glist); - - if((old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && !x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxOUT%d\n", - canvas, xpos, - ypos + x->x_gui.x_h-1, xpos + IOWIDTH, - ypos + x->x_gui.x_h, x, 0); - if(!(old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c delete %lxOUT%d\n", canvas, x, 0); - if((old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && !x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxIN%d\n", - canvas, xpos, ypos, - xpos + IOWIDTH, ypos+1, x, 0); - if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c delete %lxIN%d\n", canvas, x, 0); -} - -void toggle_draw_select(t_toggle* x, t_glist* glist) -{ - t_canvas *canvas=glist_getcanvas(glist); - - if(x->x_gui.x_fsf.x_selected) - { - sys_vgui(".x%lx.c itemconfigure %lxBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED); - sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED); - } - else - { - sys_vgui(".x%lx.c itemconfigure %lxBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); - sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol); - } -} - -void toggle_draw(t_toggle *x, t_glist *glist, int mode) -{ - if(mode == IEM_GUI_DRAW_MODE_UPDATE) - toggle_draw_update(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_MOVE) - toggle_draw_move(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_NEW) - toggle_draw_new(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_SELECT) - toggle_draw_select(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_ERASE) - toggle_draw_erase(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_CONFIG) - toggle_draw_config(x, glist); - else if(mode >= IEM_GUI_DRAW_MODE_IO) - toggle_draw_io(x, glist, mode - IEM_GUI_DRAW_MODE_IO); -} - -/* ------------------------ tgl widgetbehaviour----------------------------- */ - -static void toggle_getrect(t_gobj *z, t_glist *glist, int *xp1, int *yp1, int *xp2, int *yp2) -{ - t_toggle *x = (t_toggle *)z; - - *xp1 = text_xpix(&x->x_gui.x_obj, glist); - *yp1 = text_ypix(&x->x_gui.x_obj, glist); - *xp2 = *xp1 + x->x_gui.x_w; - *yp2 = *yp1 + x->x_gui.x_h; -} - -static void toggle_save(t_gobj *z, t_binbuf *b) -{ - t_toggle *x = (t_toggle *)z; - int bflcol[3]; - t_symbol *srl[3]; - - iemgui_save(&x->x_gui, srl, bflcol); - binbuf_addv(b, "ssiisiisssiiiiiiiff", gensym("#X"),gensym("obj"), - (int)x->x_gui.x_obj.te_xpix, - (int)x->x_gui.x_obj.te_ypix, - gensym("tgl"), x->x_gui.x_w, - iem_symargstoint(&x->x_gui.x_isa), - srl[0], srl[1], srl[2], - x->x_gui.x_ldx, x->x_gui.x_ldy, - iem_fstyletoint(&x->x_gui.x_fsf), x->x_gui.x_fontsize, - bflcol[0], bflcol[1], bflcol[2], x->x_on, x->x_nonzero); - binbuf_addv(b, ";"); -} - -static void toggle_properties(t_gobj *z, t_glist *owner) -{ - t_toggle *x = (t_toggle *)z; - char buf[800]; - t_symbol *srl[3]; - - iemgui_properties(&x->x_gui, srl); - sprintf(buf, "pdtk_iemgui_dialog %%s |tgl| \ - ----------dimensions(pix):----------- %d %d size: 0 0 empty \ - -----------non-zero-value:----------- %g value: 0.0 empty %g \ - -1 lin log %d %d empty %d \ - %s %s \ - %s %d %d \ - %d %d \ - %d %d %d\n", - x->x_gui.x_w, IEM_GUI_MINSIZE, - x->x_nonzero, 1.0,/*non_zero-schedule*/ - x->x_gui.x_isa.x_loadinit, -1, -1,/*no multi*/ - srl[0]->s_name, srl[1]->s_name, - srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy, - x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize, - 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol); - gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); -} - -static void toggle_bang(t_toggle *x) -{ - x->x_on = (x->x_on==0.0)?x->x_nonzero:0.0; - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); - outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on); - if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) - pd_float(x->x_gui.x_snd->s_thing, x->x_on); -} - -static void toggle_dialog(t_toggle *x, t_symbol *s, int argc, t_atom *argv) -{ - t_symbol *srl[3]; - int a = (int)atom_getintarg(0, argc, argv); - t_float nonzero = (t_float)atom_getfloatarg(2, argc, argv); - int sr_flags; - - if(nonzero == 0.0) - nonzero = 1.0; - x->x_nonzero = nonzero; - if(x->x_on != 0.0) - x->x_on = x->x_nonzero; - sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv); - x->x_gui.x_w = iemgui_clip_size(a); - x->x_gui.x_h = x->x_gui.x_w; - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG); - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_IO + sr_flags); - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE); - canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x); -} - -static void toggle_click(t_toggle *x, t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl, t_floatarg alt) -{toggle_bang(x);} - -static int toggle_newclick(t_gobj *z, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit) -{ - if(doit) - toggle_click((t_toggle *)z, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, 0, (t_floatarg)alt); - return (1); -} - -static void toggle_set(t_toggle *x, t_floatarg f) -{ - x->x_on = f; - if(f != 0.0) - x->x_nonzero = f; - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); -} - -static void toggle_float(t_toggle *x, t_floatarg f) -{ - toggle_set(x, f); - if(x->x_gui.x_fsf.x_put_in2out) - { - outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on); - if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) - pd_float(x->x_gui.x_snd->s_thing, x->x_on); - } -} - -static void toggle_fout(t_toggle *x, t_floatarg f) -{ - toggle_set(x, f); - outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on); - if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) - pd_float(x->x_gui.x_snd->s_thing, x->x_on); -} - -static void toggle_loadbang(t_toggle *x) -{ - if(!sys_noloadbang && x->x_gui.x_isa.x_loadinit) - toggle_fout(x, (t_float)x->x_on); -} - -static void toggle_size(t_toggle *x, t_symbol *s, int ac, t_atom *av) -{ - x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av)); - x->x_gui.x_h = x->x_gui.x_w; - iemgui_size((void *)x, &x->x_gui); -} - -static void toggle_delta(t_toggle *x, t_symbol *s, int ac, t_atom *av) -{iemgui_delta((void *)x, &x->x_gui, s, ac, av);} - -static void toggle_pos(t_toggle *x, t_symbol *s, int ac, t_atom *av) -{iemgui_pos((void *)x, &x->x_gui, s, ac, av);} - -static void toggle_color(t_toggle *x, t_symbol *s, int ac, t_atom *av) -{iemgui_color((void *)x, &x->x_gui, s, ac, av);} - -static void toggle_send(t_toggle *x, t_symbol *s) -{iemgui_send(x, &x->x_gui, s);} - -static void toggle_receive(t_toggle *x, t_symbol *s) -{iemgui_receive(x, &x->x_gui, s);} - -static void toggle_label(t_toggle *x, t_symbol *s) -{iemgui_label((void *)x, &x->x_gui, s);} - -static void toggle_label_font(t_toggle *x, t_symbol *s, int ac, t_atom *av) -{iemgui_label_font((void *)x, &x->x_gui, s, ac, av);} - -static void toggle_label_pos(t_toggle *x, t_symbol *s, int ac, t_atom *av) -{iemgui_label_pos((void *)x, &x->x_gui, s, ac, av);} - -static void toggle_init(t_toggle *x, t_floatarg f) -{ - x->x_gui.x_isa.x_loadinit = (f==0.0)?0:1; -} - -static void toggle_nonzero(t_toggle *x, t_floatarg f) -{ - if(f != 0.0) - x->x_nonzero = f; -} - -static void *toggle_new(t_symbol *s, int argc, t_atom *argv) -{ - t_toggle *x = (t_toggle *)pd_new(toggle_class); - int bflcol[]={-262144, -1, -1}; - int a=IEM_GUI_DEFAULTSIZE, f=0; - int ldx=17, ldy=7; - int fs=10; - t_float on=0.0, nonzero=1.0; - char str[144]; - - iem_inttosymargs(&x->x_gui.x_isa, 0); - iem_inttofstyle(&x->x_gui.x_fsf, 0); - - if(((argc == 13)||(argc == 14))&&IS_A_FLOAT(argv,0) - &&IS_A_FLOAT(argv,1) - &&(IS_A_SYMBOL(argv,2)||IS_A_FLOAT(argv,2)) - &&(IS_A_SYMBOL(argv,3)||IS_A_FLOAT(argv,3)) - &&(IS_A_SYMBOL(argv,4)||IS_A_FLOAT(argv,4)) - &&IS_A_FLOAT(argv,5)&&IS_A_FLOAT(argv,6) - &&IS_A_FLOAT(argv,7)&&IS_A_FLOAT(argv,8)&&IS_A_FLOAT(argv,9) - &&IS_A_FLOAT(argv,10)&&IS_A_FLOAT(argv,11)&&IS_A_FLOAT(argv,12)) - { - a = (int)atom_getintarg(0, argc, argv); - iem_inttosymargs(&x->x_gui.x_isa, atom_getintarg(1, argc, argv)); - iemgui_new_getnames(&x->x_gui, 2, argv); - ldx = (int)atom_getintarg(5, argc, argv); - ldy = (int)atom_getintarg(6, argc, argv); - iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(7, argc, argv)); - fs = (int)atom_getintarg(8, argc, argv); - bflcol[0] = (int)atom_getintarg(9, argc, argv); - bflcol[1] = (int)atom_getintarg(10, argc, argv); - bflcol[2] = (int)atom_getintarg(11, argc, argv); - on = (t_float)atom_getfloatarg(12, argc, argv); - } - else iemgui_new_getnames(&x->x_gui, 2, 0); - if((argc == 14)&&IS_A_FLOAT(argv,13)) - nonzero = (t_float)atom_getfloatarg(13, argc, argv); - x->x_gui.x_draw = (t_iemfunptr)toggle_draw; - - x->x_gui.x_fsf.x_snd_able = 1; - x->x_gui.x_fsf.x_rcv_able = 1; - x->x_gui.x_glist = (t_glist *)canvas_getcurrent(); - if (!strcmp(x->x_gui.x_snd->s_name, "empty")) - x->x_gui.x_fsf.x_snd_able = 0; - if (!strcmp(x->x_gui.x_rcv->s_name, "empty")) - x->x_gui.x_fsf.x_rcv_able = 0; - if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica"); - else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times"); - else { x->x_gui.x_fsf.x_font_style = 0; - strcpy(x->x_gui.x_font, sys_font); } - x->x_nonzero = (nonzero!=0.0)?nonzero:1.0; - if(x->x_gui.x_isa.x_loadinit) - x->x_on = (on!=0.0)?nonzero:0.0; - else - x->x_on = 0.0; - if (x->x_gui.x_fsf.x_rcv_able) - pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); - x->x_gui.x_ldx = ldx; - x->x_gui.x_ldy = ldy; - - if(fs < 4) - fs = 4; - x->x_gui.x_fontsize = fs; - x->x_gui.x_w = iemgui_clip_size(a); - x->x_gui.x_h = x->x_gui.x_w; - iemgui_all_colfromload(&x->x_gui, bflcol); - iemgui_verify_snd_ne_rcv(&x->x_gui); - outlet_new(&x->x_gui.x_obj, &s_float); - return (x); -} - -static void toggle_ff(t_toggle *x) -{ - if(x->x_gui.x_fsf.x_rcv_able) - pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); - gfxstub_deleteforkey(x); -} - -void tgl_setup(void) -{ - toggle_class = class_new(gensym("tgl"), (t_newmethod)toggle_new, - (t_method)toggle_ff, sizeof(t_toggle), 0, A_GIMME, 0); - class_addcreator((t_newmethod)toggle_new, gensym("toggle"), A_GIMME, 0); - class_addbang(toggle_class, toggle_bang); - class_addfloat(toggle_class, toggle_float); - class_addmethod(toggle_class, (t_method)toggle_click, gensym("click"), - A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); - class_addmethod(toggle_class, (t_method)toggle_dialog, gensym("dialog"), - A_GIMME, 0); - class_addmethod(toggle_class, (t_method)toggle_loadbang, gensym("loadbang"), 0); - class_addmethod(toggle_class, (t_method)toggle_set, gensym("set"), A_FLOAT, 0); - class_addmethod(toggle_class, (t_method)toggle_size, gensym("size"), A_GIMME, 0); - class_addmethod(toggle_class, (t_method)toggle_delta, gensym("delta"), A_GIMME, 0); - class_addmethod(toggle_class, (t_method)toggle_pos, gensym("pos"), A_GIMME, 0); - class_addmethod(toggle_class, (t_method)toggle_color, gensym("color"), A_GIMME, 0); - class_addmethod(toggle_class, (t_method)toggle_send, gensym("send"), A_DEFSYM, 0); - class_addmethod(toggle_class, (t_method)toggle_receive, gensym("receive"), A_DEFSYM, 0); - class_addmethod(toggle_class, (t_method)toggle_label, gensym("label"), A_DEFSYM, 0); - class_addmethod(toggle_class, (t_method)toggle_label_pos, gensym("label_pos"), A_GIMME, 0); - class_addmethod(toggle_class, (t_method)toggle_label_font, gensym("label_font"), A_GIMME, 0); - class_addmethod(toggle_class, (t_method)toggle_init, gensym("init"), A_FLOAT, 0); - class_addmethod(toggle_class, (t_method)toggle_nonzero, gensym("nonzero"), A_FLOAT, 0); - toggle_widgetbehavior.w_getrectfn = toggle_getrect; - toggle_widgetbehavior.w_displacefn = iemgui_displace; - toggle_widgetbehavior.w_selectfn = iemgui_select; - toggle_widgetbehavior.w_activatefn = NULL; - toggle_widgetbehavior.w_deletefn = iemgui_delete; - toggle_widgetbehavior.w_visfn = iemgui_vis; - toggle_widgetbehavior.w_clickfn = toggle_newclick; - class_setwidget(toggle_class, &toggle_widgetbehavior); - class_sethelpsymbol(toggle_class, gensym("toggle")); - class_setsavefn(toggle_class, toggle_save); - class_setpropertiesfn(toggle_class, toggle_properties); -} diff --git a/externals/vanilla/vanilla-meta.pd b/externals/vanilla/vanilla-meta.pd deleted file mode 100644 index 2fa718b357ce1590f9c6698650f57114cb587766..0000000000000000000000000000000000000000 --- a/externals/vanilla/vanilla-meta.pd +++ /dev/null @@ -1,6 +0,0 @@ -#N canvas 230 230 450 300 10; -#X text 44 30 NAME vanilla; -#X text 44 50 DESCRIPTION Pure Data internals broken out into a standalone -library; -#X text 44 70 VERSION 0.43.1; -#X text 44 90 LICENSE SIBSD; diff --git a/externals/vanilla/vradio.c b/externals/vanilla/vradio.c deleted file mode 100644 index a0a08dbfd76e09f0300667d707cbfc2ed96ba177..0000000000000000000000000000000000000000 --- a/externals/vanilla/vradio.c +++ /dev/null @@ -1,719 +0,0 @@ -/* Copyright (c) 1997-1999 Miller Puckette. - * For information on usage and redistribution, and for a DISCLAIMER OF ALL - * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -/* vdial.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ - -/* name change to vradio by MSP (it's a radio button really) and changed to -put out a "float" as in sliders, toggles, etc. */ - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <ctype.h> -#include "m_pd.h" -#include "g_canvas.h" - -#include "g_all_guis.h" -#include <math.h> - -/*------------------ global variables -------------------------*/ - - -/*------------------ global functions -------------------------*/ - - - - -/* ------------- vdl gui-vertical radio button ---------------------- */ - -t_widgetbehavior vradio_widgetbehavior; -static t_class *vradio_class, *vradio_old_class; - -/* widget helper functions */ - -void vradio_draw_update(t_gobj *client, t_glist *glist) -{ - t_hradio *x = (t_hradio *)client; - if(glist_isvisible(glist)) - { - t_canvas *canvas=glist_getcanvas(glist); - - sys_vgui(".x%lx.c itemconfigure %lxBUT%d -fill #%6.6x -outline #%6.6x\n", - canvas, x, x->x_drawn, - x->x_gui.x_bcol, x->x_gui.x_bcol); - sys_vgui(".x%lx.c itemconfigure %lxBUT%d -fill #%6.6x -outline #%6.6x\n", - canvas, x, x->x_on, - x->x_gui.x_fcol, x->x_gui.x_fcol); - x->x_drawn = x->x_on; - } -} - -void vradio_draw_new(t_vradio *x, t_glist *glist) -{ - t_canvas *canvas=glist_getcanvas(glist); - int n=x->x_number, i, dy=x->x_gui.x_h, s4=dy/4; - int yy11b=text_ypix(&x->x_gui.x_obj, glist); - int yy11=yy11b, yy12=yy11+dy; - int yy21=yy11+s4, yy22=yy12-s4; - int xx11=text_xpix(&x->x_gui.x_obj, glist), xx12=xx11+dy; - int xx21=xx11+s4, xx22=xx12-s4; - - for(i=0; i<n; i++) - { - sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill #%6.6x -tags %lxBASE%d\n", - canvas, xx11, yy11, xx12, yy12, - x->x_gui.x_bcol, x, i); - sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill #%6.6x -outline #%6.6x -tags %lxBUT%d\n", - canvas, xx21, yy21, xx22, yy22, - (x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol, - (x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol, x, i); - yy11 += dy; - yy12 += dy; - yy21 += dy; - yy22 += dy; - x->x_drawn = x->x_on; - } - sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \ - -font {{%s} -%d %s} -fill #%6.6x -tags %lxLABEL\n", - canvas, xx11+x->x_gui.x_ldx, yy11b+x->x_gui.x_ldy, - strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"", - x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, - x->x_gui.x_lcol, x); - if(!x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxOUT%d\n", - canvas, xx11, yy11-1, xx11 + IOWIDTH, yy11, x, 0); - if(!x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxIN%d\n", - canvas, xx11, yy11b, xx11 + IOWIDTH, yy11b+1, x, 0); -} - -void vradio_draw_move(t_vradio *x, t_glist *glist) -{ - t_canvas *canvas=glist_getcanvas(glist); - int n=x->x_number, i, dy=x->x_gui.x_h, s4=dy/4; - int yy11b=text_ypix(&x->x_gui.x_obj, glist); - int yy11=yy11b, yy12=yy11+dy; - int yy21=yy11+s4, yy22=yy12-s4; - int xx11=text_xpix(&x->x_gui.x_obj, glist), xx12=xx11+dy; - int xx21=xx11+s4, xx22=xx12-s4; - - for(i=0; i<n; i++) - { - sys_vgui(".x%lx.c coords %lxBASE%d %d %d %d %d\n", - canvas, x, i, xx11, yy11, xx12, yy12); - sys_vgui(".x%lx.c coords %lxBUT%d %d %d %d %d\n", - canvas, x, i, xx21, yy21, xx22, yy22); - yy11 += dy; - yy12 += dy; - yy21 += dy; - yy22 += dy; - } - sys_vgui(".x%lx.c coords %lxLABEL %d %d\n", - canvas, x, xx11+x->x_gui.x_ldx, yy11b+x->x_gui.x_ldy); - if(!x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c coords %lxOUT%d %d %d %d %d\n", - canvas, x, 0, xx11, yy11-1, xx11 + IOWIDTH, yy11); - if(!x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c coords %lxIN%d %d %d %d %d\n", - canvas, x, 0, xx11, yy11b, xx11 + IOWIDTH, yy11b+1); -} - -void vradio_draw_erase(t_vradio* x, t_glist* glist) -{ - t_canvas *canvas=glist_getcanvas(glist); - int n=x->x_number, i; - - for(i=0; i<n; i++) - { - sys_vgui(".x%lx.c delete %lxBASE%d\n", canvas, x, i); - sys_vgui(".x%lx.c delete %lxBUT%d\n", canvas, x, i); - } - sys_vgui(".x%lx.c delete %lxLABEL\n", canvas, x); - if(!x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c delete %lxOUT%d\n", canvas, x, 0); - if(!x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c delete %lxIN%d\n", canvas, x, 0); -} - -void vradio_draw_config(t_vradio* x, t_glist* glist) -{ - t_canvas *canvas=glist_getcanvas(glist); - int n=x->x_number, i; - - sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {{%s} -%d %s} -fill #%6.6x -text {%s} \n", - canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, - x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_lcol, - strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:""); - for(i=0; i<n; i++) - { - sys_vgui(".x%lx.c itemconfigure %lxBASE%d -fill #%6.6x\n", canvas, x, i, - x->x_gui.x_bcol); - sys_vgui(".x%lx.c itemconfigure %lxBUT%d -fill #%6.6x -outline #%6.6x\n", canvas, x, i, - (x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol, - (x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol); - } -} - -void vradio_draw_io(t_vradio* x, t_glist* glist, int old_snd_rcv_flags) -{ - t_canvas *canvas=glist_getcanvas(glist); - int xpos=text_xpix(&x->x_gui.x_obj, glist); - int ypos=text_ypix(&x->x_gui.x_obj, glist); - - if((old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && !x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxOUT%d\n", - canvas, xpos, - ypos+(x->x_number*x->x_gui.x_h)-1, - xpos+ IOWIDTH, - ypos+(x->x_number*x->x_gui.x_h), x, 0); - if(!(old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c delete %lxOUT%d\n", canvas, x, 0); - if((old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && !x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxIN%d\n", - canvas, xpos, ypos, - xpos+ IOWIDTH, ypos+1, - x, 0); - if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c delete %lxIN%d\n", canvas, x, 0); -} - -void vradio_draw_select(t_vradio* x, t_glist* glist) -{ - t_canvas *canvas=glist_getcanvas(glist); - int n=x->x_number, i; - - if(x->x_gui.x_fsf.x_selected) - { - for(i=0; i<n; i++) - { - sys_vgui(".x%lx.c itemconfigure %lxBASE%d -outline #%6.6x\n", canvas, x, i, - IEM_GUI_COLOR_SELECTED); - } - sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED); - } - else - { - for(i=0; i<n; i++) - { - sys_vgui(".x%lx.c itemconfigure %lxBASE%d -outline #%6.6x\n", canvas, x, i, - IEM_GUI_COLOR_NORMAL); - } - sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill #%6.6x\n", canvas, x, - x->x_gui.x_lcol); - } -} - -void vradio_draw(t_vradio *x, t_glist *glist, int mode) -{ - if(mode == IEM_GUI_DRAW_MODE_UPDATE) - sys_queuegui(x, glist, vradio_draw_update); - else if(mode == IEM_GUI_DRAW_MODE_MOVE) - vradio_draw_move(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_NEW) - vradio_draw_new(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_SELECT) - vradio_draw_select(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_ERASE) - vradio_draw_erase(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_CONFIG) - vradio_draw_config(x, glist); - else if(mode >= IEM_GUI_DRAW_MODE_IO) - vradio_draw_io(x, glist, mode - IEM_GUI_DRAW_MODE_IO); -} - -/* ------------------------ vdl widgetbehaviour----------------------------- */ - -static void vradio_getrect(t_gobj *z, t_glist *glist, int *xp1, int *yp1, int *xp2, int *yp2) -{ - t_vradio *x = (t_vradio *)z; - - *xp1 = text_xpix(&x->x_gui.x_obj, glist); - *yp1 = text_ypix(&x->x_gui.x_obj, glist); - *xp2 = *xp1 + x->x_gui.x_w; - *yp2 = *yp1 + x->x_gui.x_h*x->x_number; -} - -static void vradio_save(t_gobj *z, t_binbuf *b) -{ - t_vradio *x = (t_vradio *)z; - int bflcol[3]; - t_symbol *srl[3]; - - iemgui_save(&x->x_gui, srl, bflcol); - binbuf_addv(b, "ssiisiiiisssiiiiiiii", gensym("#X"),gensym("obj"), - (int)x->x_gui.x_obj.te_xpix, - (int)x->x_gui.x_obj.te_ypix, - (pd_class(&x->x_gui.x_obj.ob_pd) == vradio_old_class ? - gensym("vdl") : gensym("vradio")), - x->x_gui.x_w, - x->x_change, iem_symargstoint(&x->x_gui.x_isa), x->x_number, - srl[0], srl[1], srl[2], - x->x_gui.x_ldx, x->x_gui.x_ldy, - iem_fstyletoint(&x->x_gui.x_fsf), x->x_gui.x_fontsize, - bflcol[0], bflcol[1], bflcol[2], x->x_on); - binbuf_addv(b, ";"); -} - -static void vradio_properties(t_gobj *z, t_glist *owner) -{ - t_vradio *x = (t_vradio *)z; - char buf[800]; - t_symbol *srl[3]; - int hchange=-1; - - iemgui_properties(&x->x_gui, srl); - if(pd_class(&x->x_gui.x_obj.ob_pd) == vradio_old_class) - hchange = x->x_change; - sprintf(buf, "pdtk_iemgui_dialog %%s |vradio| \ - ----------dimensions(pix):----------- %d %d size: 0 0 empty \ - empty 0.0 empty 0.0 empty %d \ - %d new-only new&old %d %d number: %d \ - %s %s \ - %s %d %d \ - %d %d \ - %d %d %d\n", - x->x_gui.x_w, IEM_GUI_MINSIZE, - 0,/*no_schedule*/ - hchange, x->x_gui.x_isa.x_loadinit, -1, x->x_number, - srl[0]->s_name, srl[1]->s_name, - srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy, - x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize, - 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol); - gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); -} - -static void vradio_dialog(t_vradio *x, t_symbol *s, int argc, t_atom *argv) -{ - t_symbol *srl[3]; - int a = (int)atom_getintarg(0, argc, argv); - int chg = (int)atom_getintarg(4, argc, argv); - int num = (int)atom_getintarg(6, argc, argv); - int sr_flags; - - if(chg != 0) chg = 1; - x->x_change = chg; - sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv); - x->x_gui.x_w = iemgui_clip_size(a); - x->x_gui.x_h = x->x_gui.x_w; - if(x->x_number != num) - { - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_ERASE); - x->x_number = num; - if(x->x_on >= x->x_number) - { - x->x_on = x->x_number - 1; - x->x_on_old = x->x_on; - } - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_NEW); - } - else - { - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG); - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_IO + sr_flags); - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE); - canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x); - } -} - -static void vradio_set(t_vradio *x, t_floatarg f) -{ - int i=(int)f; - int old; - - if(i < 0) - i = 0; - if(i >= x->x_number) - i = x->x_number-1; - if(x->x_on != x->x_on_old) - { - old = x->x_on_old; - x->x_on_old = x->x_on; - x->x_on = i; - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); - x->x_on_old = old; - } - else - { - x->x_on = i; - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); - } -} - -static void vradio_bang(t_vradio *x) -{ - /* compatibility with earlier "vdial" behavior */ - if (pd_class(&x->x_gui.x_obj.ob_pd) == vradio_old_class) - { - if((x->x_change)&&(x->x_on != x->x_on_old)) - { - SETFLOAT(x->x_at, (t_float)x->x_on_old); - SETFLOAT(x->x_at+1, 0.0); - outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); - if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) - pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); - } - x->x_on_old = x->x_on; - SETFLOAT(x->x_at, (t_float)x->x_on); - SETFLOAT(x->x_at+1, 1.0); - outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); - if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) - pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); - } - else - { - outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on); - if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) - pd_float(x->x_gui.x_snd->s_thing, x->x_on); - } -} - -static void vradio_fout(t_vradio *x, t_floatarg f) -{ - int i=(int)f; - - if(i < 0) - i = 0; - if(i >= x->x_number) - i = x->x_number-1; - - if (pd_class(&x->x_gui.x_obj.ob_pd) == vradio_old_class) - { - /* compatibility with earlier "vdial" behavior */ - if((x->x_change)&&(i != x->x_on_old)) - { - SETFLOAT(x->x_at, (t_float)x->x_on_old); - SETFLOAT(x->x_at+1, 0.0); - outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); - if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) - pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); - } - if(x->x_on != x->x_on_old) - x->x_on_old = x->x_on; - x->x_on = i; - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); - x->x_on_old = x->x_on; - SETFLOAT(x->x_at, (t_float)x->x_on); - SETFLOAT(x->x_at+1, 1.0); - outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); - if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) - pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); - } - else - { - x->x_on_old = x->x_on; - x->x_on = i; - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); - outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on); - if (x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) - pd_float(x->x_gui.x_snd->s_thing, x->x_on); - } -} - -static void vradio_float(t_vradio *x, t_floatarg f) -{ - int i=(int)f; - - if(i < 0) - i = 0; - if(i >= x->x_number) - i = x->x_number-1; - - if (pd_class(&x->x_gui.x_obj.ob_pd) == vradio_old_class) - { - /* compatibility with earlier "vdial" behavior */ - if((x->x_change)&&(i != x->x_on_old)) - { - if(x->x_gui.x_fsf.x_put_in2out) - { - SETFLOAT(x->x_at, (t_float)x->x_on_old); - SETFLOAT(x->x_at+1, 0.0); - outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); - if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) - pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); - } - } - if(x->x_on != x->x_on_old) - x->x_on_old = x->x_on; - x->x_on = i; - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); - x->x_on_old = x->x_on; - if(x->x_gui.x_fsf.x_put_in2out) - { - SETFLOAT(x->x_at, (t_float)x->x_on); - SETFLOAT(x->x_at+1, 1.0); - outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); - if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) - pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); - } - } - else - { - x->x_on_old = x->x_on; - x->x_on = i; - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); - if (x->x_gui.x_fsf.x_put_in2out) - { - outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on); - if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) - pd_float(x->x_gui.x_snd->s_thing, x->x_on); - } - } -} - -static void vradio_click(t_vradio *x, t_floatarg xpos, t_floatarg ypos, - t_floatarg shift, t_floatarg ctrl, t_floatarg alt) -{ - int yy = (int)ypos - text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist); - - vradio_fout(x, (t_float)(yy / x->x_gui.x_h)); -} - -static int vradio_newclick(t_gobj *z, struct _glist *glist, - int xpix, int ypix, int shift, int alt, int dbl, int doit) -{ - if(doit) - vradio_click((t_vradio *)z, (t_floatarg)xpix, (t_floatarg)ypix, - (t_floatarg)shift, 0, (t_floatarg)alt); - return (1); -} - -static void vradio_loadbang(t_vradio *x) -{ - if(!sys_noloadbang && x->x_gui.x_isa.x_loadinit) - vradio_bang(x); -} - -static void vradio_number(t_vradio *x, t_floatarg num) -{ - int n=(int)num; - - if(n < 1) - n = 1; - if(n > IEM_RADIO_MAX) - n = IEM_RADIO_MAX; - if(n != x->x_number) - { - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_ERASE); - x->x_number = n; - if(x->x_on >= x->x_number) - x->x_on = x->x_number - 1; - x->x_on_old = x->x_on; - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_NEW); - } -} - -static void vradio_size(t_vradio *x, t_symbol *s, int ac, t_atom *av) -{ - x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av)); - x->x_gui.x_h = x->x_gui.x_w; - iemgui_size((void *)x, &x->x_gui); -} - -static void vradio_delta(t_vradio *x, t_symbol *s, int ac, t_atom *av) -{iemgui_delta((void *)x, &x->x_gui, s, ac, av);} - -static void vradio_pos(t_vradio *x, t_symbol *s, int ac, t_atom *av) -{iemgui_pos((void *)x, &x->x_gui, s, ac, av);} - -static void vradio_color(t_vradio *x, t_symbol *s, int ac, t_atom *av) -{iemgui_color((void *)x, &x->x_gui, s, ac, av);} - -static void vradio_send(t_vradio *x, t_symbol *s) -{iemgui_send(x, &x->x_gui, s);} - -static void vradio_receive(t_vradio *x, t_symbol *s) -{iemgui_receive(x, &x->x_gui, s);} - -static void vradio_label(t_vradio *x, t_symbol *s) -{iemgui_label((void *)x, &x->x_gui, s);} - -static void vradio_label_pos(t_vradio *x, t_symbol *s, int ac, t_atom *av) -{iemgui_label_pos((void *)x, &x->x_gui, s, ac, av);} - -static void vradio_label_font(t_vradio *x, t_symbol *s, int ac, t_atom *av) -{iemgui_label_font((void *)x, &x->x_gui, s, ac, av);} - -static void vradio_init(t_vradio *x, t_floatarg f) -{ - x->x_gui.x_isa.x_loadinit = (f==0.0)?0:1; -} - -static void vradio_double_change(t_vradio *x) -{x->x_change = 1;} - -static void vradio_single_change(t_vradio *x) -{x->x_change = 0;} - -static void *vradio_donew(t_symbol *s, int argc, t_atom *argv, int old) -{ - t_vradio *x = (t_vradio *)pd_new(old? vradio_old_class : vradio_class); - int bflcol[]={-262144, -1, -1}; - int a=IEM_GUI_DEFAULTSIZE, on=0, f=0; - int ldx=0, ldy=-8, chg=1, num=8; - int fs=10; - int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME, fthold=IEM_BNG_DEFAULTHOLDFLASHTIME; - char str[144]; - - if((argc == 15)&&IS_A_FLOAT(argv,0)&&IS_A_FLOAT(argv,1)&&IS_A_FLOAT(argv,2) - &&IS_A_FLOAT(argv,3) - &&(IS_A_SYMBOL(argv,4)||IS_A_FLOAT(argv,4)) - &&(IS_A_SYMBOL(argv,5)||IS_A_FLOAT(argv,5)) - &&(IS_A_SYMBOL(argv,6)||IS_A_FLOAT(argv,6)) - &&IS_A_FLOAT(argv,7)&&IS_A_FLOAT(argv,8) - &&IS_A_FLOAT(argv,9)&&IS_A_FLOAT(argv,10)&&IS_A_FLOAT(argv,11) - &&IS_A_FLOAT(argv,12)&&IS_A_FLOAT(argv,13)&&IS_A_FLOAT(argv,14)) - { - a = (int)atom_getintarg(0, argc, argv); - chg = (int)atom_getintarg(1, argc, argv); - iem_inttosymargs(&x->x_gui.x_isa, atom_getintarg(2, argc, argv)); - num = (int)atom_getintarg(3, argc, argv); - iemgui_new_getnames(&x->x_gui, 4, argv); - ldx = (int)atom_getintarg(7, argc, argv); - ldy = (int)atom_getintarg(8, argc, argv); - iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(9, argc, argv)); - fs = (int)atom_getintarg(10, argc, argv); - bflcol[0] = (int)atom_getintarg(11, argc, argv); - bflcol[1] = (int)atom_getintarg(12, argc, argv); - bflcol[2] = (int)atom_getintarg(13, argc, argv); - on = (int)atom_getintarg(14, argc, argv); - } - else iemgui_new_getnames(&x->x_gui, 4, 0); - x->x_gui.x_draw = (t_iemfunptr)vradio_draw; - x->x_gui.x_fsf.x_snd_able = 1; - x->x_gui.x_fsf.x_rcv_able = 1; - x->x_gui.x_glist = (t_glist *)canvas_getcurrent(); - if (!strcmp(x->x_gui.x_snd->s_name, "empty")) - x->x_gui.x_fsf.x_snd_able = 0; - if (!strcmp(x->x_gui.x_rcv->s_name, "empty")) - x->x_gui.x_fsf.x_rcv_able = 0; - if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica"); - else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times"); - else { x->x_gui.x_fsf.x_font_style = 0; - strcpy(x->x_gui.x_font, sys_font); } - if(num < 1) - num = 1; - if(num > IEM_RADIO_MAX) - num = IEM_RADIO_MAX; - x->x_number = num; - if(on < 0) - on = 0; - if(on >= x->x_number) - on = x->x_number - 1; - if(x->x_gui.x_isa.x_loadinit) - x->x_on = on; - else - x->x_on = 0; - x->x_on_old = x->x_on; - x->x_change = (chg==0)?0:1; - if (x->x_gui.x_fsf.x_rcv_able) - pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); - x->x_gui.x_ldx = ldx; - x->x_gui.x_ldy = ldy; - if(fs < 4) - fs = 4; - x->x_gui.x_fontsize = fs; - x->x_gui.x_w = iemgui_clip_size(a); - x->x_gui.x_h = x->x_gui.x_w; - iemgui_verify_snd_ne_rcv(&x->x_gui); - iemgui_all_colfromload(&x->x_gui, bflcol); - outlet_new(&x->x_gui.x_obj, &s_list); - return (x); -} - -static void *vradio_new(t_symbol *s, int argc, t_atom *argv) -{ - return (vradio_donew(s, argc, argv, 0)); -} - -static void *vdial_new(t_symbol *s, int argc, t_atom *argv) -{ - return (vradio_donew(s, argc, argv, 1)); -} - -static void vradio_ff(t_vradio *x) -{ - if(x->x_gui.x_fsf.x_rcv_able) - pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); - gfxstub_deleteforkey(x); -} - -void vradio_setup(void) -{ - vradio_class = class_new(gensym("vradio"), (t_newmethod)vradio_new, - (t_method)vradio_ff, sizeof(t_vradio), 0, A_GIMME, 0); - class_addbang(vradio_class, vradio_bang); - class_addfloat(vradio_class, vradio_float); - class_addmethod(vradio_class, (t_method)vradio_click, gensym("click"), - A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); - class_addmethod(vradio_class, (t_method)vradio_dialog, gensym("dialog"), - A_GIMME, 0); - class_addmethod(vradio_class, (t_method)vradio_loadbang, - gensym("loadbang"), 0); - class_addmethod(vradio_class, (t_method)vradio_set, - gensym("set"), A_FLOAT, 0); - class_addmethod(vradio_class, (t_method)vradio_size, - gensym("size"), A_GIMME, 0); - class_addmethod(vradio_class, (t_method)vradio_delta, - gensym("delta"), A_GIMME, 0); - class_addmethod(vradio_class, (t_method)vradio_pos, - gensym("pos"), A_GIMME, 0); - class_addmethod(vradio_class, (t_method)vradio_color, - gensym("color"), A_GIMME, 0); - class_addmethod(vradio_class, (t_method)vradio_send, - gensym("send"), A_DEFSYM, 0); - class_addmethod(vradio_class, (t_method)vradio_receive, - gensym("receive"), A_DEFSYM, 0); - class_addmethod(vradio_class, (t_method)vradio_label, - gensym("label"), A_DEFSYM, 0); - class_addmethod(vradio_class, (t_method)vradio_label_pos, - gensym("label_pos"), A_GIMME, 0); - class_addmethod(vradio_class, (t_method)vradio_label_font, - gensym("label_font"), A_GIMME, 0); - class_addmethod(vradio_class, (t_method)vradio_init, - gensym("init"), A_FLOAT, 0); - class_addmethod(vradio_class, (t_method)vradio_number, - gensym("number"), A_FLOAT, 0); - class_addmethod(vradio_class, (t_method)vradio_single_change, - gensym("single_change"), 0); - class_addmethod(vradio_class, (t_method)vradio_double_change, - gensym("double_change"), 0); - vradio_widgetbehavior.w_getrectfn = vradio_getrect; - vradio_widgetbehavior.w_displacefn = iemgui_displace; - vradio_widgetbehavior.w_selectfn = iemgui_select; - vradio_widgetbehavior.w_activatefn = NULL; - vradio_widgetbehavior.w_deletefn = iemgui_delete; - vradio_widgetbehavior.w_visfn = iemgui_vis; - vradio_widgetbehavior.w_clickfn = vradio_newclick; - class_setwidget(vradio_class, &vradio_widgetbehavior); - class_sethelpsymbol(vradio_class, gensym("vradio")); - class_setsavefn(vradio_class, vradio_save); - class_setpropertiesfn(vradio_class, vradio_properties); - - /* obsolete version (0.34-0.35) */ - vradio_old_class = class_new(gensym("vdl"), (t_newmethod)vdial_new, - (t_method)vradio_ff, sizeof(t_vradio), 0, A_GIMME, 0); - class_addbang(vradio_old_class, vradio_bang); - class_addfloat(vradio_old_class, vradio_float); - class_addmethod(vradio_old_class, (t_method)vradio_click, gensym("click"), - A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); - class_addmethod(vradio_old_class, (t_method)vradio_dialog, gensym("dialog"), - A_GIMME, 0); - class_addmethod(vradio_old_class, (t_method)vradio_loadbang, gensym("loadbang"), 0); - class_addmethod(vradio_old_class, (t_method)vradio_set, gensym("set"), A_FLOAT, 0); - class_addmethod(vradio_old_class, (t_method)vradio_size, gensym("size"), A_GIMME, 0); - class_addmethod(vradio_old_class, (t_method)vradio_delta, gensym("delta"), A_GIMME, 0); - class_addmethod(vradio_old_class, (t_method)vradio_pos, gensym("pos"), A_GIMME, 0); - class_addmethod(vradio_old_class, (t_method)vradio_color, gensym("color"), A_GIMME, 0); - class_addmethod(vradio_old_class, (t_method)vradio_send, gensym("send"), A_DEFSYM, 0); - class_addmethod(vradio_old_class, (t_method)vradio_receive, gensym("receive"), A_DEFSYM, 0); - class_addmethod(vradio_old_class, (t_method)vradio_label, gensym("label"), A_DEFSYM, 0); - class_addmethod(vradio_old_class, (t_method)vradio_label_pos, gensym("label_pos"), A_GIMME, 0); - class_addmethod(vradio_old_class, (t_method)vradio_label_font, gensym("label_font"), A_GIMME, 0); - class_addmethod(vradio_old_class, (t_method)vradio_init, gensym("init"), A_FLOAT, 0); - class_addmethod(vradio_old_class, (t_method)vradio_number, gensym("number"), A_FLOAT, 0); - class_addmethod(vradio_old_class, (t_method)vradio_single_change, gensym("single_change"), 0); - class_addmethod(vradio_old_class, (t_method)vradio_double_change, gensym("double_change"), 0); - class_setwidget(vradio_old_class, &vradio_widgetbehavior); - class_sethelpsymbol(vradio_old_class, gensym("vradio")); -} diff --git a/externals/vanilla/vslider.c b/externals/vanilla/vslider.c deleted file mode 100644 index fac5d2e86a76f45181a299251e86277b0edb24c5..0000000000000000000000000000000000000000 --- a/externals/vanilla/vslider.c +++ /dev/null @@ -1,629 +0,0 @@ -/* Copyright (c) 1997-1999 Miller Puckette. - * For information on usage and redistribution, and for a DISCLAIMER OF ALL - * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -/* g_7_guis.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ -/* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */ - - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <ctype.h> -#include "m_pd.h" -#include "g_canvas.h" - -#include "g_all_guis.h" -#include <math.h> - -#ifdef MSW -#include <io.h> -#else -#include <unistd.h> -#endif - - -/* ------------ vsl gui-vertical slider ----------------------- */ - -t_widgetbehavior vslider_widgetbehavior; -static t_class *vslider_class; - -/* widget helper functions */ - -static void vslider_draw_update(t_gobj *client, t_glist *glist) -{ - t_vslider *x = (t_vslider *)client; - if (glist_isvisible(glist)) - { - int r = text_ypix(&x->x_gui.x_obj, glist) + x->x_gui.x_h - (x->x_val + 50)/100; - int xpos=text_xpix(&x->x_gui.x_obj, glist); - - sys_vgui(".x%lx.c coords %lxKNOB %d %d %d %d\n", - glist_getcanvas(glist), x, xpos+1, r, - xpos + x->x_gui.x_w, r); - } -} - -static void vslider_draw_new(t_vslider *x, t_glist *glist) -{ - int xpos=text_xpix(&x->x_gui.x_obj, glist); - int ypos=text_ypix(&x->x_gui.x_obj, glist); - int r = ypos + x->x_gui.x_h - (x->x_val + 50)/100; - t_canvas *canvas=glist_getcanvas(glist); - - sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill #%6.6x -tags %lxBASE\n", - canvas, xpos, ypos-2, - xpos + x->x_gui.x_w, ypos + x->x_gui.x_h+3, - x->x_gui.x_bcol, x); - sys_vgui(".x%lx.c create line %d %d %d %d -width 3 -fill #%6.6x -tags %lxKNOB\n", - canvas, xpos+1, r, - xpos + x->x_gui.x_w, r, x->x_gui.x_fcol, x); - sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \ - -font {{%s} -%d %s} -fill #%6.6x -tags %lxLABEL\n", - canvas, xpos+x->x_gui.x_ldx, ypos+x->x_gui.x_ldy, - strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"", - x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, - x->x_gui.x_lcol, x); - if(!x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxOUT%d\n", - canvas, - xpos, ypos + x->x_gui.x_h+2, - xpos+7, ypos + x->x_gui.x_h+3, - x, 0); - if(!x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxIN%d\n", - canvas, - xpos, ypos-2, - xpos+7, ypos-1, - x, 0); -} - -static void vslider_draw_move(t_vslider *x, t_glist *glist) -{ - int xpos=text_xpix(&x->x_gui.x_obj, glist); - int ypos=text_ypix(&x->x_gui.x_obj, glist); - int r = ypos + x->x_gui.x_h - (x->x_val + 50)/100; - t_canvas *canvas=glist_getcanvas(glist); - - sys_vgui(".x%lx.c coords %lxBASE %d %d %d %d\n", - canvas, x, - xpos, ypos-2, - xpos + x->x_gui.x_w, ypos + x->x_gui.x_h+3); - sys_vgui(".x%lx.c coords %lxKNOB %d %d %d %d\n", - canvas, x, xpos+1, r, - xpos + x->x_gui.x_w, r); - sys_vgui(".x%lx.c coords %lxLABEL %d %d\n", - canvas, x, xpos+x->x_gui.x_ldx, ypos+x->x_gui.x_ldy); - if(!x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c coords %lxOUT%d %d %d %d %d\n", - canvas, x, 0, - xpos, ypos + x->x_gui.x_h+2, - xpos+7, ypos + x->x_gui.x_h+3); - if(!x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c coords %lxIN%d %d %d %d %d\n", - canvas, x, 0, - xpos, ypos-2, - xpos+7, ypos-1); -} - -static void vslider_draw_erase(t_vslider* x,t_glist* glist) -{ - t_canvas *canvas=glist_getcanvas(glist); - - sys_vgui(".x%lx.c delete %lxBASE\n", canvas, x); - sys_vgui(".x%lx.c delete %lxKNOB\n", canvas, x); - sys_vgui(".x%lx.c delete %lxLABEL\n", canvas, x); - if(!x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c delete %lxOUT%d\n", canvas, x, 0); - if(!x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c delete %lxIN%d\n", canvas, x, 0); -} - -static void vslider_draw_config(t_vslider* x,t_glist* glist) -{ - t_canvas *canvas=glist_getcanvas(glist); - - sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {{%s} -%d %s} -fill #%6.6x -text {%s} \n", - canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, - x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_lcol, - strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:""); - sys_vgui(".x%lx.c itemconfigure %lxKNOB -fill #%6.6x\n", canvas, - x, x->x_gui.x_fcol); - sys_vgui(".x%lx.c itemconfigure %lxBASE -fill #%6.6x\n", canvas, - x, x->x_gui.x_bcol); -} - -static void vslider_draw_io(t_vslider* x,t_glist* glist, int old_snd_rcv_flags) -{ - int xpos=text_xpix(&x->x_gui.x_obj, glist); - int ypos=text_ypix(&x->x_gui.x_obj, glist); - t_canvas *canvas=glist_getcanvas(glist); - - if((old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && !x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxOUT%d\n", - canvas, - xpos, ypos + x->x_gui.x_h+2, - xpos+7, ypos + x->x_gui.x_h+3, - x, 0); - if(!(old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && x->x_gui.x_fsf.x_snd_able) - sys_vgui(".x%lx.c delete %lxOUT%d\n", canvas, x, 0); - if((old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && !x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxIN%d\n", - canvas, - xpos, ypos-2, - xpos+7, ypos-1, - x, 0); - if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able) - sys_vgui(".x%lx.c delete %lxIN%d\n", canvas, x, 0); -} - -static void vslider_draw_select(t_vslider *x, t_glist *glist) -{ - t_canvas *canvas=glist_getcanvas(glist); - - if(x->x_gui.x_fsf.x_selected) - { - sys_vgui(".x%lx.c itemconfigure %lxBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED); - sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED); - } - else - { - sys_vgui(".x%lx.c itemconfigure %lxBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); - sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol); - } -} - -void vslider_draw(t_vslider *x, t_glist *glist, int mode) -{ - if(mode == IEM_GUI_DRAW_MODE_UPDATE) - sys_queuegui(x, glist, vslider_draw_update); - else if(mode == IEM_GUI_DRAW_MODE_MOVE) - vslider_draw_move(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_NEW) - vslider_draw_new(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_SELECT) - vslider_draw_select(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_ERASE) - vslider_draw_erase(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_CONFIG) - vslider_draw_config(x, glist); - else if(mode >= IEM_GUI_DRAW_MODE_IO) - vslider_draw_io(x, glist, mode - IEM_GUI_DRAW_MODE_IO); -} - -/* ------------------------ vsl widgetbehaviour----------------------------- */ - - -static void vslider_getrect(t_gobj *z, t_glist *glist, - int *xp1, int *yp1, int *xp2, int *yp2) -{ - t_vslider* x = (t_vslider*)z; - - *xp1 = text_xpix(&x->x_gui.x_obj, glist); - *yp1 = text_ypix(&x->x_gui.x_obj, glist) - 2; - *xp2 = *xp1 + x->x_gui.x_w; - *yp2 = *yp1 + x->x_gui.x_h + 5; -} - -static void vslider_save(t_gobj *z, t_binbuf *b) -{ - t_vslider *x = (t_vslider *)z; - int bflcol[3]; - t_symbol *srl[3]; - - iemgui_save(&x->x_gui, srl, bflcol); - binbuf_addv(b, "ssiisiiffiisssiiiiiiiii", gensym("#X"),gensym("obj"), - (int)x->x_gui.x_obj.te_xpix, (int)x->x_gui.x_obj.te_ypix, - gensym("vsl"), x->x_gui.x_w, x->x_gui.x_h, - (t_float)x->x_min, (t_float)x->x_max, - x->x_lin0_log1, iem_symargstoint(&x->x_gui.x_isa), - srl[0], srl[1], srl[2], - x->x_gui.x_ldx, x->x_gui.x_ldy, - iem_fstyletoint(&x->x_gui.x_fsf), x->x_gui.x_fontsize, - bflcol[0], bflcol[1], bflcol[2], - x->x_val, x->x_steady); - binbuf_addv(b, ";"); -} - -void vslider_check_height(t_vslider *x, int h) -{ - if(h < IEM_SL_MINSIZE) - h = IEM_SL_MINSIZE; - x->x_gui.x_h = h; - if(x->x_val > (x->x_gui.x_h*100 - 100)) - { - x->x_pos = x->x_gui.x_h*100 - 100; - x->x_val = x->x_pos; - } - if(x->x_lin0_log1) - x->x_k = log(x->x_max/x->x_min)/(double)(x->x_gui.x_h - 1); - else - x->x_k = (x->x_max - x->x_min)/(double)(x->x_gui.x_h - 1); -} - -void vslider_check_minmax(t_vslider *x, double min, double max) -{ - if(x->x_lin0_log1) - { - if((min == 0.0)&&(max == 0.0)) - max = 1.0; - if(max > 0.0) - { - if(min <= 0.0) - min = 0.01*max; - } - else - { - if(min > 0.0) - max = 0.01*min; - } - } - x->x_min = min; - x->x_max = max; - if(x->x_min > x->x_max) /* bugfix */ - x->x_gui.x_isa.x_reverse = 1; - else - x->x_gui.x_isa.x_reverse = 0; - if(x->x_lin0_log1) - x->x_k = log(x->x_max/x->x_min)/(double)(x->x_gui.x_h - 1); - else - x->x_k = (x->x_max - x->x_min)/(double)(x->x_gui.x_h - 1); -} - -static void vslider_properties(t_gobj *z, t_glist *owner) -{ - t_vslider *x = (t_vslider *)z; - char buf[800]; - t_symbol *srl[3]; - - iemgui_properties(&x->x_gui, srl); - - sprintf(buf, "pdtk_iemgui_dialog %%s |vsl| \ - --------dimensions(pix)(pix):-------- %d %d width: %d %d height: \ - -----------output-range:----------- %g bottom: %g top: %d \ - %d lin log %d %d empty %d \ - %s %s \ - %s %d %d \ - %d %d \ - %d %d %d\n", - x->x_gui.x_w, IEM_GUI_MINSIZE, x->x_gui.x_h, IEM_SL_MINSIZE, - x->x_min, x->x_max, 0,/*no_schedule*/ - x->x_lin0_log1, x->x_gui.x_isa.x_loadinit, x->x_steady, -1,/*no multi, but iem-characteristic*/ - srl[0]->s_name, srl[1]->s_name, - srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy, - x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize, - 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol); - gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); -} - -static void vslider_bang(t_vslider *x) -{ - double out; - - if(x->x_lin0_log1) - out = x->x_min*exp(x->x_k*(double)(x->x_val)*0.01); - else - out = (double)(x->x_val)*0.01*x->x_k + x->x_min; - if((out < 1.0e-10)&&(out > -1.0e-10)) - out = 0.0; - - outlet_float(x->x_gui.x_obj.ob_outlet, out); - if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) - pd_float(x->x_gui.x_snd->s_thing, out); -} - -static void vslider_dialog(t_vslider *x, t_symbol *s, int argc, t_atom *argv) -{ - t_symbol *srl[3]; - int w = (int)atom_getintarg(0, argc, argv); - int h = (int)atom_getintarg(1, argc, argv); - double min = (double)atom_getfloatarg(2, argc, argv); - double max = (double)atom_getfloatarg(3, argc, argv); - int lilo = (int)atom_getintarg(4, argc, argv); - int steady = (int)atom_getintarg(17, argc, argv); - int sr_flags; - - if(lilo != 0) lilo = 1; - x->x_lin0_log1 = lilo; - if(steady) - x->x_steady = 1; - else - x->x_steady = 0; - sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv); - x->x_gui.x_w = iemgui_clip_size(w); - vslider_check_height(x, h); - vslider_check_minmax(x, min, max); - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG); - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_IO + sr_flags); - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE); - canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x); -} - -static void vslider_motion(t_vslider *x, t_floatarg dx, t_floatarg dy) -{ - int old = x->x_val; - - if(x->x_gui.x_fsf.x_finemoved) - x->x_pos -= (int)dy; - else - x->x_pos -= 100*(int)dy; - x->x_val = x->x_pos; - if(x->x_val > (100*x->x_gui.x_h - 100)) - { - x->x_val = 100*x->x_gui.x_h - 100; - x->x_pos += 50; - x->x_pos -= x->x_pos%100; - } - if(x->x_val < 0) - { - x->x_val = 0; - x->x_pos -= 50; - x->x_pos -= x->x_pos%100; - } - if(old != x->x_val) - { - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); - vslider_bang(x); - } -} - -static void vslider_click(t_vslider *x, t_floatarg xpos, t_floatarg ypos, - t_floatarg shift, t_floatarg ctrl, t_floatarg alt) -{ - if(!x->x_steady) - x->x_val = (int)(100.0 * (x->x_gui.x_h + text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist) - ypos)); - if(x->x_val > (100*x->x_gui.x_h - 100)) - x->x_val = 100*x->x_gui.x_h - 100; - if(x->x_val < 0) - x->x_val = 0; - x->x_pos = x->x_val; - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); - vslider_bang(x); - glist_grab(x->x_gui.x_glist, &x->x_gui.x_obj.te_g, - (t_glistmotionfn)vslider_motion, 0, xpos, ypos); -} - -static int vslider_newclick(t_gobj *z, struct _glist *glist, - int xpix, int ypix, int shift, int alt, int dbl, int doit) -{ - t_vslider* x = (t_vslider *)z; - - if(doit) - { - vslider_click( x, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, - 0, (t_floatarg)alt); - if(shift) - x->x_gui.x_fsf.x_finemoved = 1; - else - x->x_gui.x_fsf.x_finemoved = 0; - } - return (1); -} - -static void vslider_set(t_vslider *x, t_floatarg f) -{ - double g; - - if(x->x_gui.x_isa.x_reverse) /* bugfix */ - { - if(f > x->x_min) - f = x->x_min; - if(f < x->x_max) - f = x->x_max; - } - else - { - if(f > x->x_max) - f = x->x_max; - if(f < x->x_min) - f = x->x_min; - } - if(x->x_lin0_log1) - g = log(f/x->x_min)/x->x_k; - else - g = (f - x->x_min) / x->x_k; - x->x_val = (int)(100.0*g + 0.49999); - x->x_pos = x->x_val; - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); -} - -static void vslider_float(t_vslider *x, t_floatarg f) -{ - vslider_set(x, f); - if(x->x_gui.x_fsf.x_put_in2out) - vslider_bang(x); -} - -static void vslider_size(t_vslider *x, t_symbol *s, int ac, t_atom *av) -{ - x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av)); - if(ac > 1) - vslider_check_height(x, (int)atom_getintarg(1, ac, av)); - iemgui_size((void *)x, &x->x_gui); -} - -static void vslider_delta(t_vslider *x, t_symbol *s, int ac, t_atom *av) -{iemgui_delta((void *)x, &x->x_gui, s, ac, av);} - -static void vslider_pos(t_vslider *x, t_symbol *s, int ac, t_atom *av) -{iemgui_pos((void *)x, &x->x_gui, s, ac, av);} - -static void vslider_range(t_vslider *x, t_symbol *s, int ac, t_atom *av) -{ - vslider_check_minmax(x, (double)atom_getfloatarg(0, ac, av), - (double)atom_getfloatarg(1, ac, av)); -} - -static void vslider_color(t_vslider *x, t_symbol *s, int ac, t_atom *av) -{iemgui_color((void *)x, &x->x_gui, s, ac, av);} - -static void vslider_send(t_vslider *x, t_symbol *s) -{iemgui_send(x, &x->x_gui, s);} - -static void vslider_receive(t_vslider *x, t_symbol *s) -{iemgui_receive(x, &x->x_gui, s);} - -static void vslider_label(t_vslider *x, t_symbol *s) -{iemgui_label((void *)x, &x->x_gui, s);} - -static void vslider_label_pos(t_vslider *x, t_symbol *s, int ac, t_atom *av) -{iemgui_label_pos((void *)x, &x->x_gui, s, ac, av);} - -static void vslider_label_font(t_vslider *x, t_symbol *s, int ac, t_atom *av) -{iemgui_label_font((void *)x, &x->x_gui, s, ac, av);} - -static void vslider_log(t_vslider *x) -{ - x->x_lin0_log1 = 1; - vslider_check_minmax(x, x->x_min, x->x_max); -} - -static void vslider_lin(t_vslider *x) -{ - x->x_lin0_log1 = 0; - x->x_k = (x->x_max - x->x_min)/(double)(x->x_gui.x_h - 1); -} - -static void vslider_init(t_vslider *x, t_floatarg f) -{ - x->x_gui.x_isa.x_loadinit = (f==0.0)?0:1; -} - -static void vslider_steady(t_vslider *x, t_floatarg f) -{ - x->x_steady = (f==0.0)?0:1; -} - -static void vslider_loadbang(t_vslider *x) -{ - if(!sys_noloadbang && x->x_gui.x_isa.x_loadinit) - { - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); - vslider_bang(x); - } -} - -static void *vslider_new(t_symbol *s, int argc, t_atom *argv) -{ - t_vslider *x = (t_vslider *)pd_new(vslider_class); - int bflcol[]={-262144, -1, -1}; - int w=IEM_GUI_DEFAULTSIZE, h=IEM_SL_DEFAULTSIZE; - int lilo=0, f=0, ldx=0, ldy=-9; - int fs=10, v=0, steady=1; - double min=0.0, max=(double)(IEM_SL_DEFAULTSIZE-1); - char str[144]; - - iem_inttosymargs(&x->x_gui.x_isa, 0); - iem_inttofstyle(&x->x_gui.x_fsf, 0); - - if(((argc == 17)||(argc == 18))&&IS_A_FLOAT(argv,0)&&IS_A_FLOAT(argv,1) - &&IS_A_FLOAT(argv,2)&&IS_A_FLOAT(argv,3) - &&IS_A_FLOAT(argv,4)&&IS_A_FLOAT(argv,5) - &&(IS_A_SYMBOL(argv,6)||IS_A_FLOAT(argv,6)) - &&(IS_A_SYMBOL(argv,7)||IS_A_FLOAT(argv,7)) - &&(IS_A_SYMBOL(argv,8)||IS_A_FLOAT(argv,8)) - &&IS_A_FLOAT(argv,9)&&IS_A_FLOAT(argv,10) - &&IS_A_FLOAT(argv,11)&&IS_A_FLOAT(argv,12)&&IS_A_FLOAT(argv,13) - &&IS_A_FLOAT(argv,14)&&IS_A_FLOAT(argv,15)&&IS_A_FLOAT(argv,16)) - { - w = (int)atom_getintarg(0, argc, argv); - h = (int)atom_getintarg(1, argc, argv); - min = (double)atom_getfloatarg(2, argc, argv); - max = (double)atom_getfloatarg(3, argc, argv); - lilo = (int)atom_getintarg(4, argc, argv); - iem_inttosymargs(&x->x_gui.x_isa, atom_getintarg(5, argc, argv)); - iemgui_new_getnames(&x->x_gui, 6, argv); - ldx = (int)atom_getintarg(9, argc, argv); - ldy = (int)atom_getintarg(10, argc, argv); - iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(11, argc, argv)); - fs = (int)atom_getintarg(12, argc, argv); - bflcol[0] = (int)atom_getintarg(13, argc, argv); - bflcol[1] = (int)atom_getintarg(14, argc, argv); - bflcol[2] = (int)atom_getintarg(15, argc, argv); - v = (int)atom_getintarg(16, argc, argv); - } - else iemgui_new_getnames(&x->x_gui, 6, 0); - if((argc == 18)&&IS_A_FLOAT(argv,17)) - steady = (int)atom_getintarg(17, argc, argv); - x->x_gui.x_draw = (t_iemfunptr)vslider_draw; - x->x_gui.x_fsf.x_snd_able = 1; - x->x_gui.x_fsf.x_rcv_able = 1; - x->x_gui.x_glist = (t_glist *)canvas_getcurrent(); - if(x->x_gui.x_isa.x_loadinit) - x->x_val = v; - else - x->x_val = 0; - x->x_pos = x->x_val; - if(lilo != 0) lilo = 1; - x->x_lin0_log1 = lilo; - if(steady != 0) steady = 1; - x->x_steady = steady; - if(!strcmp(x->x_gui.x_snd->s_name, "empty")) x->x_gui.x_fsf.x_snd_able = 0; - if(!strcmp(x->x_gui.x_rcv->s_name, "empty")) x->x_gui.x_fsf.x_rcv_able = 0; - if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica"); - else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times"); - else { x->x_gui.x_fsf.x_font_style = 0; - strcpy(x->x_gui.x_font, sys_font); } - if(x->x_gui.x_fsf.x_rcv_able) pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); - x->x_gui.x_ldx = ldx; - x->x_gui.x_ldy = ldy; - if(fs < 4) - fs = 4; - x->x_gui.x_fontsize = fs; - x->x_gui.x_w = iemgui_clip_size(w); - vslider_check_height(x, h); - vslider_check_minmax(x, min, max); - iemgui_all_colfromload(&x->x_gui, bflcol); - iemgui_verify_snd_ne_rcv(&x->x_gui); - outlet_new(&x->x_gui.x_obj, &s_float); - return (x); -} - -static void vslider_free(t_vslider *x) -{ - if(x->x_gui.x_fsf.x_rcv_able) - pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); - gfxstub_deleteforkey(x); -} - -void vsl_setup(void) -{ - vslider_class = class_new(gensym("vsl"), (t_newmethod)vslider_new, - (t_method)vslider_free, sizeof(t_vslider), 0, A_GIMME, 0); - class_addcreator((t_newmethod)vslider_new, gensym("vslider"), A_GIMME, 0); - class_addbang(vslider_class,vslider_bang); - class_addfloat(vslider_class,vslider_float); - class_addmethod(vslider_class, (t_method)vslider_click, gensym("click"), - A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); - class_addmethod(vslider_class, (t_method)vslider_motion, gensym("motion"), - A_FLOAT, A_FLOAT, 0); - class_addmethod(vslider_class, (t_method)vslider_dialog, gensym("dialog"), - A_GIMME, 0); - class_addmethod(vslider_class, (t_method)vslider_loadbang, gensym("loadbang"), 0); - class_addmethod(vslider_class, (t_method)vslider_set, gensym("set"), A_FLOAT, 0); - class_addmethod(vslider_class, (t_method)vslider_size, gensym("size"), A_GIMME, 0); - class_addmethod(vslider_class, (t_method)vslider_delta, gensym("delta"), A_GIMME, 0); - class_addmethod(vslider_class, (t_method)vslider_pos, gensym("pos"), A_GIMME, 0); - class_addmethod(vslider_class, (t_method)vslider_range, gensym("range"), A_GIMME, 0); - class_addmethod(vslider_class, (t_method)vslider_color, gensym("color"), A_GIMME, 0); - class_addmethod(vslider_class, (t_method)vslider_send, gensym("send"), A_DEFSYM, 0); - class_addmethod(vslider_class, (t_method)vslider_receive, gensym("receive"), A_DEFSYM, 0); - class_addmethod(vslider_class, (t_method)vslider_label, gensym("label"), A_DEFSYM, 0); - class_addmethod(vslider_class, (t_method)vslider_label_pos, gensym("label_pos"), A_GIMME, 0); - class_addmethod(vslider_class, (t_method)vslider_label_font, gensym("label_font"), A_GIMME, 0); - class_addmethod(vslider_class, (t_method)vslider_log, gensym("log"), 0); - class_addmethod(vslider_class, (t_method)vslider_lin, gensym("lin"), 0); - class_addmethod(vslider_class, (t_method)vslider_init, gensym("init"), A_FLOAT, 0); - class_addmethod(vslider_class, (t_method)vslider_steady, gensym("steady"), A_FLOAT, 0); - vslider_widgetbehavior.w_getrectfn = vslider_getrect; - vslider_widgetbehavior.w_displacefn = iemgui_displace; - vslider_widgetbehavior.w_selectfn = iemgui_select; - vslider_widgetbehavior.w_activatefn = NULL; - vslider_widgetbehavior.w_deletefn = iemgui_delete; - vslider_widgetbehavior.w_visfn = iemgui_vis; - vslider_widgetbehavior.w_clickfn = vslider_newclick; - class_setwidget(vslider_class, &vslider_widgetbehavior); - class_sethelpsymbol(vslider_class, gensym("vslider")); - class_setsavefn(vslider_class, vslider_save); - class_setpropertiesfn(vslider_class, vslider_properties); -} diff --git a/externals/vanilla/vu.c b/externals/vanilla/vu.c deleted file mode 100644 index a9afd255c35aa5d3984426d8a8f2ce428a36077a..0000000000000000000000000000000000000000 --- a/externals/vanilla/vu.c +++ /dev/null @@ -1,739 +0,0 @@ -/* Copyright (c) 1997-1999 Miller Puckette. - * For information on usage and redistribution, and for a DISCLAIMER OF ALL - * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -/* g_7_guis.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ -/* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */ - - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <ctype.h> -#include "m_pd.h" -#include "g_canvas.h" - -#include "g_all_guis.h" -#include <math.h> - -#ifdef MSW -#include <io.h> -#else -#include <unistd.h> -#endif - -/* ----- vu gui-peak- & rms- vu-meter-display ---------- */ - -t_widgetbehavior vu_widgetbehavior; -static t_class *vu_class; - -/* widget helper functions */ - -static void vu_update_rms(t_vu *x, t_glist *glist) -{ - if(glist_isvisible(glist)) - { - int w4=x->x_gui.x_w/4, off=text_ypix(&x->x_gui.x_obj, glist)-1; - int xpos=text_xpix(&x->x_gui.x_obj, glist), quad1=xpos+w4+1, quad3=xpos+x->x_gui.x_w-w4-1; - - sys_vgui(".x%lx.c coords %lxRCOVER %d %d %d %d\n", - glist_getcanvas(glist), x, quad1, off, quad3, - off + (x->x_led_size+1)*(IEM_VU_STEPS-x->x_rms)); - } -} - -static void vu_update_peak(t_vu *x, t_glist *glist) -{ - t_canvas *canvas=glist_getcanvas(glist); - - if(glist_isvisible(glist)) - { - int xpos=text_xpix(&x->x_gui.x_obj, glist); - int ypos=text_ypix(&x->x_gui.x_obj, glist); - - if(x->x_peak) - { - int i=iemgui_vu_col[x->x_peak]; - int j=ypos + (x->x_led_size+1)*(IEM_VU_STEPS+1-x->x_peak) - - (x->x_led_size+1)/2; - - sys_vgui(".x%lx.c coords %lxPLED %d %d %d %d\n", canvas, x, - xpos, j, - xpos+x->x_gui.x_w+1, j); - sys_vgui(".x%lx.c itemconfigure %lxPLED -fill #%6.6x\n", canvas, x, - iemgui_color_hex[i]); - } - else - { - int mid=xpos+x->x_gui.x_w/2; - - sys_vgui(".x%lx.c itemconfigure %lxPLED -fill #%6.6x\n", - canvas, x, x->x_gui.x_bcol); - sys_vgui(".x%lx.c coords %lxPLED %d %d %d %d\n", - canvas, x, mid, ypos+20, - mid, ypos+20); - } - } -} - -static void vu_draw_update(t_gobj *client, t_glist *glist) -{ - t_vu *x = (t_vu *)client; - if (x->x_updaterms) - { - vu_update_rms(x, glist); - x->x_updaterms = 0; - } - if (x->x_updatepeak) - { - vu_update_peak(x, glist); - x->x_updatepeak = 0; - } -} - -static void vu_draw_new(t_vu *x, t_glist *glist) -{ - t_canvas *canvas=glist_getcanvas(glist); - - int xpos=text_xpix(&x->x_gui.x_obj, glist); - int ypos=text_ypix(&x->x_gui.x_obj, glist); - int w4=x->x_gui.x_w/4, mid=xpos+x->x_gui.x_w/2, - quad1=xpos+w4+1; - int quad3=xpos+x->x_gui.x_w-w4, - end=xpos+x->x_gui.x_w+4; - int k1=x->x_led_size+1, k2=IEM_VU_STEPS+1, k3=k1/2; - int led_col, yyy, i, k4=ypos-k3; - - sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill #%6.6x -tags %lxBASE\n", - canvas, xpos-1, ypos-2, - xpos+x->x_gui.x_w+1, - ypos+x->x_gui.x_h+2, x->x_gui.x_bcol, x); - for(i=1; i<=IEM_VU_STEPS; i++) - { - led_col = iemgui_vu_col[i]; - yyy = k4 + k1*(k2-i); - sys_vgui(".x%lx.c create line %d %d %d %d -width %d -fill #%6.6x -tags %lxRLED%d\n", - canvas, quad1, yyy, quad3, yyy, x->x_led_size, iemgui_color_hex[led_col], x, i); - if(((i+2)&3) && (x->x_scale)) - sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \ - -font {{%s} -%d %s} -fill #%6.6x -tags %lxSCALE%d\n", - canvas, end, yyy+k3, iemgui_vu_scale_str[i], - x->x_gui.x_font, x->x_gui.x_fontsize, - sys_fontweight, x->x_gui.x_lcol, x, i); - } - if(x->x_scale) - { - i=IEM_VU_STEPS+1; - yyy = k4 + k1*(k2-i); - sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \ - -font {{%s} -%d %s} -fill #%6.6x -tags %lxSCALE%d\n", - canvas, end, yyy+k3, iemgui_vu_scale_str[i], x->x_gui.x_font, - x->x_gui.x_fontsize, sys_fontweight, - x->x_gui.x_lcol, x, i); - } - sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill #%6.6x -outline #%6.6x -tags %lxRCOVER\n", - canvas, quad1, ypos-1, quad3-1, - ypos-1 + k1*IEM_VU_STEPS, x->x_gui.x_bcol, x->x_gui.x_bcol, x); - sys_vgui(".x%lx.c create line %d %d %d %d -width %d -fill #%6.6x -tags %lxPLED\n", - canvas, mid, ypos+10, - mid, ypos+10, x->x_led_size, x->x_gui.x_bcol, x); - sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \ - -font {{%s} -%d %s} -fill #%6.6x -tags %lxLABEL\n", - canvas, xpos+x->x_gui.x_ldx, ypos+x->x_gui.x_ldy, - strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"", - x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, - x->x_gui.x_lcol, x); - if(!x->x_gui.x_fsf.x_snd_able) - { - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxOUT%d\n", - canvas, - xpos-1, ypos + x->x_gui.x_h+1, - xpos + IOWIDTH-1, ypos + x->x_gui.x_h+2, - x, 0); - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxOUT%d\n", - canvas, - xpos+x->x_gui.x_w+1-IOWIDTH, ypos + x->x_gui.x_h+1, - xpos+x->x_gui.x_w+1, ypos + x->x_gui.x_h+2, - x, 1); - } - if(!x->x_gui.x_fsf.x_rcv_able) - { - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxIN%d\n", - canvas, - xpos-1, ypos-2, - xpos + IOWIDTH-1, ypos-1, - x, 0); - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxIN%d\n", - canvas, - xpos+x->x_gui.x_w+1-IOWIDTH, ypos-2, - xpos+x->x_gui.x_w+1, ypos-1, - x, 1); - } - x->x_updaterms = x->x_updatepeak = 1; - sys_queuegui(x, x->x_gui.x_glist, vu_draw_update); -} - - -static void vu_draw_move(t_vu *x, t_glist *glist) -{ - t_canvas *canvas=glist_getcanvas(glist); - - int xpos=text_xpix(&x->x_gui.x_obj, glist); - int ypos=text_ypix(&x->x_gui.x_obj, glist); - int w4=x->x_gui.x_w/4, quad1=xpos+w4+1; - int quad3=xpos+x->x_gui.x_w-w4, - end=xpos+x->x_gui.x_w+4; - int k1=x->x_led_size+1, k2=IEM_VU_STEPS+1, k3=k1/2; - int yyy, i, k4=ypos-k3; - - sys_vgui(".x%lx.c coords %lxBASE %d %d %d %d\n", - canvas, x, xpos-1, ypos-2, - xpos+x->x_gui.x_w+1,ypos+x->x_gui.x_h+2); - for(i=1; i<=IEM_VU_STEPS; i++) - { - yyy = k4 + k1*(k2-i); - sys_vgui(".x%lx.c coords %lxRLED%d %d %d %d %d\n", - canvas, x, i, quad1, yyy, quad3, yyy); - if(((i+2)&3) && (x->x_scale)) - sys_vgui(".x%lx.c coords %lxSCALE%d %d %d\n", - canvas, x, i, end, yyy+k3); - } - if(x->x_scale) - { - i=IEM_VU_STEPS+1; - yyy = k4 + k1*(k2-i); - sys_vgui(".x%lx.c coords %lxSCALE%d %d %d\n", - canvas, x, i, end, yyy+k3); - } - x->x_updaterms = x->x_updatepeak = 1; - sys_queuegui(x, glist, vu_draw_update); - sys_vgui(".x%lx.c coords %lxLABEL %d %d\n", - canvas, x, xpos+x->x_gui.x_ldx, - ypos+x->x_gui.x_ldy); - if(!x->x_gui.x_fsf.x_snd_able) - { - sys_vgui(".x%lx.c coords %lxOUT%d %d %d %d %d\n", - canvas, x, 0, - xpos-1, ypos + x->x_gui.x_h+1, - xpos + IOWIDTH-1, ypos + x->x_gui.x_h+2); - sys_vgui(".x%lx.c coords %lxOUT%d %d %d %d %d\n", - canvas, x, 1, - xpos+x->x_gui.x_w+1-IOWIDTH, ypos + x->x_gui.x_h+1, - xpos+x->x_gui.x_w+1, ypos + x->x_gui.x_h+2); - } - if(!x->x_gui.x_fsf.x_rcv_able) - { - sys_vgui(".x%lx.c coords %lxIN%d %d %d %d %d\n", - canvas, x, 0, - xpos-1, ypos-2, - xpos + IOWIDTH-1, ypos-1); - sys_vgui(".x%lx.c coords %lxIN%d %d %d %d %d\n", - canvas, x, 1, - xpos+x->x_gui.x_w+1-IOWIDTH, ypos-2, - xpos+x->x_gui.x_w+1, ypos-1); - } -} - -static void vu_draw_erase(t_vu* x,t_glist* glist) -{ - int i; - t_canvas *canvas=glist_getcanvas(glist); - - sys_vgui(".x%lx.c delete %lxBASE\n", canvas, x); - for(i=1; i<=IEM_VU_STEPS; i++) - { - sys_vgui(".x%lx.c delete %lxRLED%d\n", canvas, x, i); - if(((i+2)&3) && (x->x_scale)) - sys_vgui(".x%lx.c delete %lxSCALE%d\n", canvas, x, i); - } - if(x->x_scale) - { - i=IEM_VU_STEPS+1; - sys_vgui(".x%lx.c delete %lxSCALE%d\n", canvas, x, i); - } - sys_vgui(".x%lx.c delete %lxPLED\n", canvas, x); - sys_vgui(".x%lx.c delete %lxRCOVER\n", canvas, x); - sys_vgui(".x%lx.c delete %lxLABEL\n", canvas, x); - if(!x->x_gui.x_fsf.x_snd_able) - { - sys_vgui(".x%lx.c delete %lxOUT%d\n", canvas, x, 0); - sys_vgui(".x%lx.c delete %lxOUT%d\n", canvas, x, 1); - } - if(!x->x_gui.x_fsf.x_rcv_able) - { - sys_vgui(".x%lx.c delete %lxIN%d\n", canvas, x, 0); - sys_vgui(".x%lx.c delete %lxIN%d\n", canvas, x, 1); - } -} - -static void vu_draw_config(t_vu* x, t_glist* glist) -{ - int i; - t_canvas *canvas=glist_getcanvas(glist); - - sys_vgui(".x%lx.c itemconfigure %lxBASE -fill #%6.6x\n", canvas, x, x->x_gui.x_bcol); - for(i=1; i<=IEM_VU_STEPS; i++) - { - sys_vgui(".x%lx.c itemconfigure %lxRLED%d -width %d\n", canvas, x, i, - x->x_led_size); - if(((i+2)&3) && (x->x_scale)) - sys_vgui(".x%lx.c itemconfigure %lxSCALE%d -text {%s} -font {{%s} -%d %s} -fill #%6.6x\n", - canvas, x, i, iemgui_vu_scale_str[i], x->x_gui.x_font, - x->x_gui.x_fontsize, sys_fontweight, - x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_lcol); - } - if(x->x_scale) - { - i=IEM_VU_STEPS+1; - sys_vgui(".x%lx.c itemconfigure %lxSCALE%d -text {%s} -font {{%s} -%d %s} -fill #%6.6x\n", - canvas, x, i, iemgui_vu_scale_str[i], x->x_gui.x_font, - x->x_gui.x_fontsize, sys_fontweight, - x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_lcol); - } - sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {{%s} -%d %s} -fill #%6.6x -text {%s} \n", - canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, - x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_lcol, - strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:""); - - sys_vgui(".x%lx.c itemconfigure %lxRCOVER -fill #%6.6x -outline #%6.6x\n", canvas, - x, x->x_gui.x_bcol, x->x_gui.x_bcol); - sys_vgui(".x%lx.c itemconfigure %lxPLED -width %d\n", canvas, x, - x->x_led_size); -} - -static void vu_draw_io(t_vu* x, t_glist* glist, int old_snd_rcv_flags) -{ - int xpos=text_xpix(&x->x_gui.x_obj, glist); - int ypos=text_ypix(&x->x_gui.x_obj, glist); - t_canvas *canvas=glist_getcanvas(glist); - - if((old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && !x->x_gui.x_fsf.x_snd_able) - { - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxOUT%d\n", - canvas, - xpos-1, ypos + x->x_gui.x_h+1, - xpos + IOWIDTH-1, ypos + x->x_gui.x_h+2, - x, 0); - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxOUT%d\n", - canvas, - xpos+x->x_gui.x_w+1-IOWIDTH, ypos + x->x_gui.x_h+1, - xpos+x->x_gui.x_w+1, ypos + x->x_gui.x_h+2, - x, 1); - } - if(!(old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && x->x_gui.x_fsf.x_snd_able) - { - sys_vgui(".x%lx.c delete %lxOUT%d\n", canvas, x, 0); - sys_vgui(".x%lx.c delete %lxOUT%d\n", canvas, x, 1); - } - if((old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && !x->x_gui.x_fsf.x_rcv_able) - { - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxIN%d\n", - canvas, - xpos-1, ypos-2, - xpos + IOWIDTH-1, ypos-1, - x, 0); - sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxIN%d\n", - canvas, - xpos+x->x_gui.x_w+1-IOWIDTH, ypos-2, - xpos+x->x_gui.x_w+1, ypos-1, - x, 1); - } - if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able) - { - sys_vgui(".x%lx.c delete %lxIN%d\n", canvas, x, 0); - sys_vgui(".x%lx.c delete %lxIN%d\n", canvas, x, 1); - } -} - -static void vu_draw_select(t_vu* x,t_glist* glist) -{ - int i; - t_canvas *canvas=glist_getcanvas(glist); - - if(x->x_gui.x_fsf.x_selected) - { - sys_vgui(".x%lx.c itemconfigure %lxBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED); - for(i=1; i<=IEM_VU_STEPS; i++) - { - if(((i+2)&3) && (x->x_scale)) - sys_vgui(".x%lx.c itemconfigure %lxSCALE%d -fill #%6.6x\n", - canvas, x, i, IEM_GUI_COLOR_SELECTED); - } - if(x->x_scale) - { - i=IEM_VU_STEPS+1; - sys_vgui(".x%lx.c itemconfigure %lxSCALE%d -fill #%6.6x\n", - canvas, x, i, IEM_GUI_COLOR_SELECTED); - } - sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED); - } - else - { - sys_vgui(".x%lx.c itemconfigure %lxBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); - for(i=1; i<=IEM_VU_STEPS; i++) - { - if(((i+2)&3) && (x->x_scale)) - sys_vgui(".x%lx.c itemconfigure %lxSCALE%d -fill #%6.6x\n", - canvas, x, i, x->x_gui.x_lcol); - } - if(x->x_scale) - { - i=IEM_VU_STEPS+1; - sys_vgui(".x%lx.c itemconfigure %lxSCALE%d -fill #%6.6x\n", - canvas, x, i, x->x_gui.x_lcol); - } - sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol); - } -} - -void vu_draw(t_vu *x, t_glist *glist, int mode) -{ - if(mode == IEM_GUI_DRAW_MODE_MOVE) - vu_draw_move(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_NEW) - vu_draw_new(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_SELECT) - vu_draw_select(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_ERASE) - vu_draw_erase(x, glist); - else if(mode == IEM_GUI_DRAW_MODE_CONFIG) - vu_draw_config(x, glist); - else if(mode >= IEM_GUI_DRAW_MODE_IO) - vu_draw_io(x, glist, mode - IEM_GUI_DRAW_MODE_IO); -} - -/* ------------------------ vu widgetbehaviour----------------------------- */ - - -static void vu_getrect(t_gobj *z, t_glist *glist, - int *xp1, int *yp1, int *xp2, int *yp2) -{ - t_vu* x = (t_vu*)z; - - *xp1 = text_xpix(&x->x_gui.x_obj, glist) - 1; - *yp1 = text_ypix(&x->x_gui.x_obj, glist) - 2; - *xp2 = *xp1 + x->x_gui.x_w + 2; - *yp2 = *yp1 + x->x_gui.x_h + 4; -} - -static void vu_save(t_gobj *z, t_binbuf *b) -{ - t_vu *x = (t_vu *)z; - int bflcol[3]; - t_symbol *srl[3]; - - iemgui_save(&x->x_gui, srl, bflcol); - binbuf_addv(b, "ssiisiissiiiiiiii", gensym("#X"),gensym("obj"), - (int)x->x_gui.x_obj.te_xpix, (int)x->x_gui.x_obj.te_ypix, - gensym("vu"), x->x_gui.x_w, x->x_gui.x_h, - srl[1], srl[2], - x->x_gui.x_ldx, x->x_gui.x_ldy, - iem_fstyletoint(&x->x_gui.x_fsf), x->x_gui.x_fontsize, - bflcol[0], bflcol[2], x->x_scale, - iem_symargstoint(&x->x_gui.x_isa)); - binbuf_addv(b, ";"); -} - -void vu_check_height(t_vu *x, int h) -{ - int n; - - n = h / IEM_VU_STEPS; - if(n < IEM_VU_MINSIZE) - n = IEM_VU_MINSIZE; - x->x_led_size = n-1; - x->x_gui.x_h = IEM_VU_STEPS * n; -} - -static void vu_scale(t_vu *x, t_floatarg fscale) -{ - int i, scale = (int)fscale; - - if(scale != 0) scale = 1; - if(x->x_scale && !scale) - { - t_canvas *canvas=glist_getcanvas(x->x_gui.x_glist); - - x->x_scale = (int)scale; - if(glist_isvisible(x->x_gui.x_glist)) - { - for(i=1; i<=IEM_VU_STEPS; i++) - { - if((i+2)&3) - sys_vgui(".x%lx.c delete %lxSCALE%d\n", canvas, x, i); - } - i=IEM_VU_STEPS+1; - sys_vgui(".x%lx.c delete %lxSCALE%d\n", canvas, x, i); - } - } - if(!x->x_scale && scale) - { - int w4=x->x_gui.x_w/4, end=text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist)+x->x_gui.x_w+4; - int k1=x->x_led_size+1, k2=IEM_VU_STEPS+1, k3=k1/2; - int yyy, k4=text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist)-k3; - t_canvas *canvas=glist_getcanvas(x->x_gui.x_glist); - - x->x_scale = (int)scale; - if(glist_isvisible(x->x_gui.x_glist)) - { - for(i=1; i<=IEM_VU_STEPS; i++) - { - yyy = k4 + k1*(k2-i); - if((i+2)&3) - sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \ - -font {{%s} -%d %s} -fill #%6.6x -tags %lxSCALE%d\n", - canvas, end, yyy+k3, iemgui_vu_scale_str[i], - x->x_gui.x_font, x->x_gui.x_fontsize, - sys_fontweight, x->x_gui.x_lcol, x, i); - } - i=IEM_VU_STEPS+1; - yyy = k4 + k1*(k2-i); - sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \ - -font {{%s} -%d %s} -fill #%6.6x -tags %lxSCALE%d\n", - canvas, end, yyy+k3, iemgui_vu_scale_str[i], - x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight, - sys_fontweight, x->x_gui.x_lcol, x, i); - } - } -} - -static void vu_properties(t_gobj *z, t_glist *owner) -{ - t_vu *x = (t_vu *)z; - char buf[800]; - t_symbol *srl[3]; - - iemgui_properties(&x->x_gui, srl); - sprintf(buf, "pdtk_iemgui_dialog %%s |vu| \ - --------dimensions(pix)(pix):-------- %d %d width: %d %d height: \ - empty 0.0 empty 0.0 empty %d \ - %d no_scale scale %d %d empty %d \ - %s %s \ - %s %d %d \ - %d %d \ - %d %d %d\n", - x->x_gui.x_w, IEM_GUI_MINSIZE, x->x_gui.x_h, IEM_VU_STEPS*IEM_VU_MINSIZE, - 0,/*no_schedule*/ - x->x_scale, -1, -1, -1,/*no linlog, no init, no multi*/ - "nosndno", srl[1]->s_name,/*no send*/ - srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy, - x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize, - 0xffffff & x->x_gui.x_bcol, -1/*no front-color*/, 0xffffff & x->x_gui.x_lcol); - gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); -} - -static void vu_dialog(t_vu *x, t_symbol *s, int argc, t_atom *argv) -{ - t_symbol *srl[3]; - int w = (int)atom_getintarg(0, argc, argv); - int h = (int)atom_getintarg(1, argc, argv); - int scale = (int)atom_getintarg(4, argc, argv); - int sr_flags; - - srl[0] = gensym("empty"); - sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv); - x->x_gui.x_fsf.x_snd_able = 0; - x->x_gui.x_isa.x_loadinit = 0; - x->x_gui.x_w = iemgui_clip_size(w); - vu_check_height(x, h); - if(scale != 0) - scale = 1; - vu_scale(x, (t_float)scale); - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG); - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_IO + sr_flags); - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE); - canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x); -} - -static void vu_size(t_vu *x, t_symbol *s, int ac, t_atom *av) -{ - x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av)); - if(ac > 1) - vu_check_height(x, (int)atom_getintarg(1, ac, av)); - if(glist_isvisible(x->x_gui.x_glist)) - { - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE); - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG); - canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x); - } -} - -static void vu_delta(t_vu *x, t_symbol *s, int ac, t_atom *av) -{iemgui_delta((void *)x, &x->x_gui, s, ac, av);} - -static void vu_pos(t_vu *x, t_symbol *s, int ac, t_atom *av) -{iemgui_pos((void *)x, &x->x_gui, s, ac, av);} - -static void vu_color(t_vu *x, t_symbol *s, int ac, t_atom *av) -{iemgui_color((void *)x, &x->x_gui, s, ac, av);} - -static void vu_receive(t_vu *x, t_symbol *s) -{iemgui_receive(x, &x->x_gui, s);} - -static void vu_label(t_vu *x, t_symbol *s) -{iemgui_label((void *)x, &x->x_gui, s);} - -static void vu_label_pos(t_vu *x, t_symbol *s, int ac, t_atom *av) -{iemgui_label_pos((void *)x, &x->x_gui, s, ac, av);} - -static void vu_label_font(t_vu *x, t_symbol *s, int ac, t_atom *av) -{iemgui_label_font((void *)x, &x->x_gui, s, ac, av);} - -static void vu_float(t_vu *x, t_floatarg rms) -{ - int i; - - if(rms <= IEM_VU_MINDB) - x->x_rms = 0; - else if(rms >= IEM_VU_MAXDB) - x->x_rms = IEM_VU_STEPS; - else - { - int i = (int)(2.0*(rms + IEM_VU_OFFSET)); - x->x_rms = iemgui_vu_db2i[i]; - } - i = (int)(100.0*rms + 10000.5); - rms = 0.01*(t_float)(i - 10000); - x->x_fr = rms; - outlet_float(x->x_out_rms, rms); - x->x_updaterms = 1; - sys_queuegui(x, x->x_gui.x_glist, vu_draw_update); -} - -static void vu_ft1(t_vu *x, t_floatarg peak) -{ - int i; - - if(peak <= IEM_VU_MINDB) - x->x_peak = 0; - else if(peak >= IEM_VU_MAXDB) - x->x_peak = IEM_VU_STEPS; - else - { - int i = (int)(2.0*(peak + IEM_VU_OFFSET)); - x->x_peak = iemgui_vu_db2i[i]; - } - i = (int)(100.0*peak + 10000.5); - peak = 0.01*(t_float)(i - 10000); - x->x_fp = peak; - x->x_updatepeak = 1; - sys_queuegui(x, x->x_gui.x_glist, vu_draw_update); - outlet_float(x->x_out_peak, peak); -} - -static void vu_bang(t_vu *x) -{ - outlet_float(x->x_out_peak, x->x_fp); - outlet_float(x->x_out_rms, x->x_fr); - x->x_updaterms = x->x_updatepeak = 1; - sys_queuegui(x, x->x_gui.x_glist, vu_draw_update); -} - -static void *vu_new(t_symbol *s, int argc, t_atom *argv) -{ - t_vu *x = (t_vu *)pd_new(vu_class); - int bflcol[]={-66577, -1, -1}; - int w=IEM_GUI_DEFAULTSIZE, h=IEM_VU_STEPS*IEM_VU_DEFAULTSIZE; - int ldx=-1, ldy=-8, f=0, fs=10, scale=1; - int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME, fthold=IEM_BNG_DEFAULTHOLDFLASHTIME; - char str[144]; - - iem_inttosymargs(&x->x_gui.x_isa, 0); - iem_inttofstyle(&x->x_gui.x_fsf, 0); - - if((argc >= 11)&&IS_A_FLOAT(argv,0)&&IS_A_FLOAT(argv,1) - &&(IS_A_SYMBOL(argv,2)||IS_A_FLOAT(argv,2)) - &&(IS_A_SYMBOL(argv,3)||IS_A_FLOAT(argv,3)) - &&IS_A_FLOAT(argv,4)&&IS_A_FLOAT(argv,5) - &&IS_A_FLOAT(argv,6)&&IS_A_FLOAT(argv,7) - &&IS_A_FLOAT(argv,8)&&IS_A_FLOAT(argv,9)&&IS_A_FLOAT(argv,10)) - { - w = (int)atom_getintarg(0, argc, argv); - h = (int)atom_getintarg(1, argc, argv); - iemgui_new_getnames(&x->x_gui, 1, argv); - ldx = (int)atom_getintarg(4, argc, argv); - ldy = (int)atom_getintarg(5, argc, argv); - iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(6, argc, argv)); - fs = (int)atom_getintarg(7, argc, argv); - bflcol[0] = (int)atom_getintarg(8, argc, argv); - bflcol[2] = (int)atom_getintarg(9, argc, argv); - scale = (int)atom_getintarg(10, argc, argv); - } - else iemgui_new_getnames(&x->x_gui, 1, 0); - if((argc == 12)&&IS_A_FLOAT(argv,11)) - iem_inttosymargs(&x->x_gui.x_isa, atom_getintarg(11, argc, argv)); - x->x_gui.x_draw = (t_iemfunptr)vu_draw; - - x->x_gui.x_fsf.x_snd_able = 0; - x->x_gui.x_fsf.x_rcv_able = 1; - x->x_gui.x_glist = (t_glist *)canvas_getcurrent(); - if (!strcmp(x->x_gui.x_rcv->s_name, "empty")) - x->x_gui.x_fsf.x_rcv_able = 0; - if (x->x_gui.x_fsf.x_font_style == 1) - strcpy(x->x_gui.x_font, "helvetica"); - else if(x->x_gui.x_fsf.x_font_style == 2) - strcpy(x->x_gui.x_font, "times"); - else { x->x_gui.x_fsf.x_font_style = 0; - strcpy(x->x_gui.x_font, sys_font); } - if(x->x_gui.x_fsf.x_rcv_able) - pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); - x->x_gui.x_ldx = ldx; - x->x_gui.x_ldy = ldy; - - if(fs < 4) - fs = 4; - x->x_gui.x_fontsize = fs; - x->x_gui.x_w = iemgui_clip_size(w); - vu_check_height(x, h); - iemgui_all_colfromload(&x->x_gui, bflcol); - if(scale != 0) - scale = 1; - x->x_scale = scale; - x->x_peak = 0; - x->x_rms = 0; - x->x_fp = -101.0; - x->x_fr = -101.0; - iemgui_verify_snd_ne_rcv(&x->x_gui); - inlet_new(&x->x_gui.x_obj, &x->x_gui.x_obj.ob_pd, &s_float, gensym("ft1")); - x->x_out_rms = outlet_new(&x->x_gui.x_obj, &s_float); - x->x_out_peak = outlet_new(&x->x_gui.x_obj, &s_float); - return (x); -} - -static void vu_free(t_vu *x) -{ - if(x->x_gui.x_fsf.x_rcv_able) - pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); - gfxstub_deleteforkey(x); -} - -void vu_setup(void) -{ - vu_class = class_new(gensym("vu"), (t_newmethod)vu_new, (t_method)vu_free, - sizeof(t_vu), 0, A_GIMME, 0); - class_addbang(vu_class,vu_bang); - class_addfloat(vu_class,vu_float); - class_addmethod(vu_class, (t_method)vu_ft1, gensym("ft1"), A_FLOAT, 0); - class_addmethod(vu_class, (t_method)vu_dialog, gensym("dialog"), - A_GIMME, 0); - class_addmethod(vu_class, (t_method)vu_size, gensym("size"), A_GIMME, 0); - class_addmethod(vu_class, (t_method)vu_scale, gensym("scale"), A_DEFFLOAT, 0); - class_addmethod(vu_class, (t_method)vu_delta, gensym("delta"), A_GIMME, 0); - class_addmethod(vu_class, (t_method)vu_pos, gensym("pos"), A_GIMME, 0); - class_addmethod(vu_class, (t_method)vu_color, gensym("color"), A_GIMME, 0); - class_addmethod(vu_class, (t_method)vu_receive, gensym("receive"), A_DEFSYM, 0); - class_addmethod(vu_class, (t_method)vu_label, gensym("label"), A_DEFSYM, 0); - class_addmethod(vu_class, (t_method)vu_label_pos, gensym("label_pos"), A_GIMME, 0); - class_addmethod(vu_class, (t_method)vu_label_font, gensym("label_font"), A_GIMME, 0); - vu_widgetbehavior.w_getrectfn = vu_getrect; - vu_widgetbehavior.w_displacefn = iemgui_displace; - vu_widgetbehavior.w_selectfn = iemgui_select; - vu_widgetbehavior.w_activatefn = NULL; - vu_widgetbehavior.w_deletefn = iemgui_delete; - vu_widgetbehavior.w_visfn = iemgui_vis; - vu_widgetbehavior.w_clickfn = NULL; - class_setwidget(vu_class,&vu_widgetbehavior); - class_sethelpsymbol(vu_class, gensym("vu")); - class_setsavefn(vu_class, vu_save); - class_setpropertiesfn(vu_class, vu_properties); -} diff --git a/externals/vanilla/wrap~.c b/externals/vanilla/wrap~.c deleted file mode 100644 index ef7137ab31bc803118f0166ba5dea37b6a7dce7f..0000000000000000000000000000000000000000 --- a/externals/vanilla/wrap~.c +++ /dev/null @@ -1,53 +0,0 @@ -/* Copyright (c) 1997-2001 Miller Puckette and others. -* For information on usage and redistribution, and for a DISCLAIMER OF ALL -* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -/* mathematical functions and other transfer functions, including tilde - versions of stuff from x_acoustics.c. -*/ - -#include "m_pd.h" -#include <math.h> - -typedef struct wrap -{ - t_object x_obj; - t_float x_f; -} t_sigwrap; - -t_class *sigwrap_class; - -static void *sigwrap_new(void) -{ - t_sigwrap *x = (t_sigwrap *)pd_new(sigwrap_class); - outlet_new(&x->x_obj, gensym("signal")); - x->x_f = 0; - return (x); -} - -static t_int *sigwrap_perform(t_int *w) -{ - t_sample *in = *(t_sample **)(w+1), *out = *(t_sample **)(w+2); - t_int n = *(t_int *)(w+3); - while (n--) - { - t_sample f = *in++; - int k = f; - if (f > 0) *out++ = f-k; - else *out++ = f - (k-1); - } - return (w + 4); -} - -static void sigwrap_dsp(t_sigwrap *x, t_signal **sp) -{ - dsp_add(sigwrap_perform, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); -} - -void wrap_tilde_setup(void) -{ - sigwrap_class = class_new(gensym("wrap~"), (t_newmethod)sigwrap_new, 0, - sizeof(t_sigwrap), 0, 0); - CLASS_MAINSIGNALIN(sigwrap_class, t_sigwrap, x_f); - class_addmethod(sigwrap_class, (t_method)sigwrap_dsp, gensym("dsp"), 0); -}