diff options
-rw-r--r-- | src/Makefile | 11 | ||||
-rw-r--r-- | src/open_help.c | 36 | ||||
-rw-r--r-- | tof/open_help-help.pd | 19 |
3 files changed, 50 insertions, 16 deletions
diff --git a/src/Makefile b/src/Makefile index 9e3647e..02ed017 100644 --- a/src/Makefile +++ b/src/Makefile @@ -62,7 +62,7 @@ CWD := $(shell pwd) export MACOSX_DEPLOYMENT_TARGET = 10.3 # DEFAULT TARGET # Find a way to list all c files target -ALL = $((patsubst %.c,%.o,$(wildcard *.c))) +ALL = $(patsubst %.c,%.$(EXTENSION),$(wildcard *.c)) default: $(ALL) .SUFFIXES: .$(EXTENSION) .$(SHARED_LIB) @@ -145,14 +145,7 @@ CXXFLAGS = $(CFLAGS) rm -f -- $*.o mv $*.$(EXTENSION) $(OUTPUT) -### C files -#.c: -# $(CC) $(OPT_CFLAGS) $(CFLAGS) -o "$*.o" -c "$*.c" -# $(CC) $(LDFLAGS) -o "$*.$(EXTENSION)" "$*.o" $(LIBS) -# chmod a-x "$*.$(EXTENSION)" -# $(STRIP) $*.$(EXTENSION) -# rm -f -- $*.o -# mv $*.$(EXTENSION) $(OUTPUT) + diff --git a/src/open_help.c b/src/open_help.c index 380d2ed..bc0b940 100644 --- a/src/open_help.c +++ b/src/open_help.c @@ -16,6 +16,7 @@ typedef struct _open_help { //t_outlet* outlet1; //t_canvas* canvas; t_symbol* dir; + t_symbol* help; } t_open_help; @@ -36,6 +37,7 @@ static void open_help_bang(t_open_help *x) { static void open_help_symbol(t_open_help *x, t_symbol *s) { + x->help = s; //int length = tof_anything_to_string(s,ac,av,tof_buf_temp_a); //strcat(tof_buf_temp_a,".pd"); @@ -59,11 +61,35 @@ static void open_help_free(t_open_help *x) } + +static void open_help_bang(t_open_help *x) { + if ( x->help) open_help_symbol(x,x->help); +} + + +static void open_help_click(t_open_help *x, t_floatarg xpos, t_floatarg ypos, + t_floatarg shift, t_floatarg ctrl, t_floatarg alt) +{ + if ( x->help) open_help_symbol(x,x->help); +} + + void *open_help_new(t_symbol *s, int argc, t_atom *argv) { t_open_help *x = (t_open_help *)pd_new(open_help_class); x->dir = tof_get_dir(tof_get_canvas()); + + + + x->help=NULL; + if ( argc && IS_A_SYMBOL(argv,0) ) { + x->help = atom_getsymbol(argv); + + } + + + //strcpy(tof_buf_temp_a,x->dir->s_name); //strcat(tof_buf_temp_a,"/"); //x->dir = gensym(tof_buf_temp_a); @@ -76,14 +102,16 @@ void *open_help_new(t_symbol *s, int argc, t_atom *argv) return (void *)x; } + + void open_help_setup(void) { open_help_class = class_new(gensym("open_help"), (t_newmethod)open_help_new, (t_method)open_help_free, sizeof(t_open_help), - CLASS_DEFAULT, + 0, A_GIMME, 0); - // class_addbang(open_help_class, open_help_bang); + class_addbang(open_help_class, open_help_bang); //class_addanything(open_help_class,open_help_anything); class_addsymbol(open_help_class,open_help_symbol); //class_addmethod(open_help_class, @@ -97,4 +125,8 @@ void open_help_setup(void) { */ //class_addlist (open_help_class, open_help_list); + class_addmethod(open_help_class, (t_method)open_help_click, + gensym("click"), + A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); + } diff --git a/tof/open_help-help.pd b/tof/open_help-help.pd index 991d5c8..5ef4fbb 100644 --- a/tof/open_help-help.pd +++ b/tof/open_help-help.pd @@ -1,15 +1,24 @@ -#N canvas 125 137 619 503 10; -#X msg 77 213 symbol list; -#X msg 157 247 symbol until; +#N canvas 522 138 619 503 10; +#X msg 27 167 symbol list; +#X msg 107 201 symbol until; #X obj -1 29 cnv 15 400 100 empty empty empty 20 12 0 14 -249661 -66577 0; #X text 4 85 author: mrtoftrash@gmail.com; -#X msg 178 298 symbol zexy/list2symbol; +#X msg 128 252 symbol zexy/list2symbol; #X text 4 28 description: searches for an external's or an abstraction's help file and tries to open it.; #X text 4 106 version: 2009-09-25; #X text 3 65 tags: file patch; -#X obj 77 340 tof/open_help; +#X obj 27 294 tof/open_help; +#X obj 70 412 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 +-1; +#X obj 69 434 tof/open_help tof/param; +#X text 102 371 If you define the name of an external or abstraction +as an argument \, open_help will open that abstraction's or external's +help file when you send a bang to the inlet or when you CLICK open_help. +; +#X text 216 433 <- CLICK; #X connect 0 0 8 0; #X connect 1 0 8 0; #X connect 4 0 8 0; +#X connect 9 0 10 0; |