From 98b615e077661e36dc213c94d0da5b7405c8ab7d Mon Sep 17 00:00:00 2001 From: Damien HENRY Date: Wed, 20 Nov 2002 06:22:16 +0000 Subject: to try... svn path=/trunk/; revision=222 --- xgui/xgui-lib/seg.c | 186 +++++++++++++++++++++++++++------------------------- 1 file changed, 96 insertions(+), 90 deletions(-) (limited to 'xgui/xgui-lib') diff --git a/xgui/xgui-lib/seg.c b/xgui/xgui-lib/seg.c index a7a0566e..2f1a9bed 100644 --- a/xgui/xgui-lib/seg.c +++ b/xgui/xgui-lib/seg.c @@ -1,90 +1,96 @@ -/* Copyright (c) 2002 Damien HENRY. -* For information on usage and redistribution, and for a DISCLAIMER OF ALL -* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -/* code for seg pd class NOT WORKING YET*/ - -#include "m_pd.h" -#include "g_canvas.h" -#include "t_tk.h" - -typedef struct s_pd_obj_seg -{ - t_object t_ob; - t_symbol *seg_name; - t_float *posx; - t_float *posy; - t_float *x1; - t_float *y1; - t_float *x2; - t_float *y2; - t_float *width; - t_symbol *color; -} t_seg; - -typedef struct s_seg -{ - t_object t_ob; - t_symbol* seg_name; - t_float posx; - t_float posy; - t_float x1; - t_float y1; - t_float x2; - t_float y2; - t_float width; - t_symbol color; -} t_seg; - -void seg_help(t_seg *x) -{ - post(" "); - post("seg v001"); - post("+ symbol list :"); - post("++ help : this help !!!"); - post(" "); -} - -void seg_width(t_seg *x, t_floatarg f) -{ - post("seg: width %f",f); - t_atom my_atom ; - t_atom *my_pointer = &my_atom; - SETFLOAT(my_pointer, *f); - outlet_anything(x->x_obj.ob_outlet, gensym("!width"), 1,my_pointer); -} - - -void seg_pos(t_seg *x, t_floatarg f1, t_floatarg f2) -{ - outlet_float(x->x_outlet1, (t_float)f1+(t_float)f2); -} - -void seg_free(void) -{ - post("seg_free"); -} - -t_class *seg_class; - -void *seg_new(void) -{ - t_seg *x = (t_seg *)pd_new(seg_class); - post("seg created"); - x->posx = 0; x->posy = 0; - x->x1 = 10; x->y1 = 10; - x->x1 = 20; x->y1 = 20; - x->x_outlet1 = outlet_new(&x->t_ob, &s_float); - return (void *)x; -} - -void seg_setup(void) -{ - post("seg_setup"); - seg_class = class_new(gensym("seg"), (t_newmethod)seg_new,(t_method)seg_free, sizeof(t_seg), 0, A_GIMME, 0); - class_addmethod(seg_class, (t_method)seg_width, gensym("width"),A_FLOAT, 0); - class_addmethod(seg_class, (t_method)seg_pos, gensym("pos"),A_FLOAT,A_FLOAT, 0); - class_addmethod(seg_class, (t_method)seg_help, gensym("help"), 0); - class_sethelpsymbol(seg_class, gensym("xgui/help_seg")); -} - +/* Copyright (c) 2002 Damien HENRY. +* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* code for seg pd class NOT WORKING YET*/ + +#include "m_pd.h" +#include "g_canvas.h" +#include "t_tk.h" + +typedef struct s_pd_obj_seg +{ + t_object t_ob; + t_symbol *seg_name; + t_float *posx; + t_float *posy; + t_float *x1; + t_float *y1; + t_float *x2; + t_float *y2; + t_float *width; + t_symbol *color; +} t_seg; + +typedef struct s_seg +{ + t_object t_ob; + t_symbol* seg_name; + t_float posx; + t_float posy; + t_float x1; + t_float y1; + t_float x2; + t_float y2; + t_float width; + t_symbol color; +} t_seg; + +void seg_help(t_seg *x) +{ + post(" "); + post("seg v001"); + post("+ symbol list :"); + post("++ help : this help !!!"); + post(" "); +} + +void seg_width(t_seg *x, t_floatarg f) +{ + post("seg: width %f",f); + t_atom my_atom ; + t_atom *my_pointer = &my_atom; + SETFLOAT(my_pointer, *f); + outlet_anything(x->x_obj.ob_outlet, gensym("!width"), 1,my_pointer); +} + + +void seg_pos(t_seg *x, t_floatarg f1, t_floatarg f2) +{ + outlet_float(x->x_outlet1, (t_float)f1+(t_float)f2); +} + +void seg_free(void) +{ + post("seg_free"); +} + +t_class *seg_class; + +void *seg_new(void) +{ + t_seg *x = (t_seg *)pd_new(seg_class); + post("seg created"); + + sys_vgui(".x%x.c create oval 10 10 20 20\n",glist_getcanvas(glist), + x->x_obj.te_xpos+1,x->x_obj.te_ypos+1, + x->x_obj.te_xpos + x->x_width -1, + x->x_obj.te_ypos + x->x_height -1,x->x_color->s_name,x); + x->posx = 0; x->posy = 0; + x->x1 = 10; x->y1 = 10; + x->x1 = 20; x->y1 = 20; + x->x_outlet1 = outlet_new(&x->t_ob, &s_float); + + return (void *)x; +} + +void seg_setup(void) +{ + post("seg_setup"); + seg_class = class_new(gensym("seg"), (t_newmethod)seg_new,(t_method)seg_free, sizeof(t_seg), 0, A_GIMME, 0); + class_addmethod(seg_class, (t_method)seg_width, gensym("width"),A_FLOAT, 0); + class_addmethod(seg_class, (t_method)seg_pos, gensym("pos"),A_FLOAT,A_FLOAT, 0); + class_addmethod(seg_class, (t_method)seg_help, gensym("help"), 0); + class_sethelpsymbol(seg_class, gensym("xgui/help_seg")); +} + -- cgit v1.2.1