aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuenter Geiger <ggeiger@users.sourceforge.net>2004-02-06 17:03:34 +0000
committerGuenter Geiger <ggeiger@users.sourceforge.net>2004-02-06 17:03:34 +0000
commitbf3b411929e54fc69aaee784b8b1572a12621f4a (patch)
treeb07c1e1d42d1364c6eb130284e9e656e4b974c40
parent6ae2adb4937216e964c0d795c76277947fba77fb (diff)
fixed widgetbehaviour for MS compiler
svn path=/trunk/externals/ggee/; revision=1314
-rw-r--r--gui/button.c30
-rwxr-xr-xgui/envgen.c29
-rw-r--r--gui/fatom.h30
-rw-r--r--gui/image.c2
-rwxr-xr-xgui/slider.c29
-rw-r--r--gui/sliderh.c31
-rwxr-xr-xgui/ticker.c33
-rwxr-xr-xgui/w_envgen.h3
8 files changed, 99 insertions, 88 deletions
diff --git a/gui/button.c b/gui/button.c
index f954d10..a83f242 100644
--- a/gui/button.c
+++ b/gui/button.c
@@ -259,21 +259,8 @@ static void button_vis(t_gobj *z, t_glist *glist, int vis)
static void button_save(t_gobj *z, t_binbuf *b);
-t_widgetbehavior button_widgetbehavior = {
- w_getrectfn: button_getrect,
- w_displacefn: button_displace,
- w_selectfn: button_select,
- w_activatefn: button_activate,
- w_deletefn: button_delete,
- w_visfn: button_vis,
-#if PD_MINOR_VERSION < 37
- w_savefn: button_save,
-#endif
- w_clickfn: NULL,
-#if PD_MINOR_VERSION < 37
- w_propertiesfn: NULL,
-#endif
-};
+t_widgetbehavior button_widgetbehavior;
+
void button_size(t_button* x,t_floatarg w,t_floatarg h) {
@@ -353,6 +340,19 @@ void button_setup(void) {
class_addbang(button_class, (t_method)button_bang);
class_addmethod(button_class, (t_method)button_b,gensym("b"),0);
+ button_widgetbehavior.w_getrectfn= button_getrect,
+ button_widgetbehavior.w_displacefn= button_displace,
+ button_widgetbehavior.w_selectfn= button_select,
+ button_widgetbehavior.w_activatefn= button_activate,
+ button_widgetbehavior.w_deletefn= button_delete,
+ button_widgetbehavior.w_visfn= button_vis,
+#if PD_MINOR_VERSION < 37
+ button_widgetbehavior.w_savefn= button_save,
+#endif
+ button_widgetbehavior.w_clickfn= NULL,
+#if PD_MINOR_VERSION < 37
+ button_widgetbehavior.w_propertiesfn= NULL,
+#endif
class_setwidget(button_class,&button_widgetbehavior);
#if PD_MINOR_VERSION >= 37
class_setsavefn(button_class,&button_save);
diff --git a/gui/envgen.c b/gui/envgen.c
index e80eb72..fae391b 100755
--- a/gui/envgen.c
+++ b/gui/envgen.c
@@ -296,19 +296,8 @@ void envgen_click(t_envgen *x,
t_floatarg alt);
void envgen_key(t_envgen *x, t_floatarg f);
-t_widgetbehavior envgen_widgetbehavior = {
- w_getrectfn: envgen_getrect,
- w_displacefn: envgen_displace,
- w_selectfn: envgen_select,
- w_activatefn: envgen_activate,
- w_deletefn: envgen_delete,
- w_visfn: envgen_vis,
- w_clickfn: envgen_newclick,
-#if PD_MINOR_VERSION < 37
- w_propertiesfn: NULL,
- w_savefn: envgen_save
-#endif
-};
+t_widgetbehavior envgen_widgetbehavior;
+
void envgen_setup(void)
@@ -334,9 +323,23 @@ void envgen_setup(void)
class_addmethod(envgen_class,(t_method)envgen_freeze,gensym("freeze"),A_FLOAT,NULL);
class_addmethod(envgen_class,(t_method)envgen_setresize,gensym("resize"),A_FLOAT,A_NULL);
+ envgen_widgetbehavior.w_getrectfn = envgen_getrect;
+ envgen_widgetbehavior.w_displacefn = envgen_displace;
+ envgen_widgetbehavior.w_selectfn = envgen_select;
+ envgen_widgetbehavior.w_activatefn = envgen_activate;
+ envgen_widgetbehavior.w_deletefn = envgen_delete;
+ envgen_widgetbehavior.w_visfn = envgen_vis;
+ envgen_widgetbehavior.w_clickfn = envgen_newclick;
+#if PD_MINOR_VERSION < 37
+ envgen_widgetbehavior.w_propertiesfn = NULL;
+ envgen_widgetbehavior.w_savefn = envgen_save;
+#endif
+
class_setwidget(envgen_class,&envgen_widgetbehavior);
#if PD_MINOR_VERSION >= 37
class_setsavefn(envgen_class,&envgen_save);
#endif
class_addmethod(envgen_class,(t_method)envgen_dump,gensym("dump"),A_NULL);
+
+
}
diff --git a/gui/fatom.h b/gui/fatom.h
index 40d362a..8b2c457 100644
--- a/gui/fatom.h
+++ b/gui/fatom.h
@@ -93,7 +93,7 @@ static void create_widget(t_fatom *x, t_glist *glist)
if (!strcmp(x->x_type->s_name,"vslider")) {
x->x_rect_width = x->x_width+15;
- x->x_rect_height = x->x_max-x->x_min+24;
+ x->x_rect_height = x->x_max-x->x_min+26;
sys_vgui("scale .x%x.c.s%x \
-sliderlength 10 \
@@ -312,19 +312,9 @@ static void fatom_vis(t_gobj *z, t_glist *glist, int vis)
static void fatom_save(t_gobj *z, t_binbuf *b);
-t_widgetbehavior fatom_widgetbehavior = {
- w_getrectfn: fatom_getrect,
- w_displacefn: fatom_displace,
- w_selectfn: fatom_select,
- w_activatefn: fatom_activate,
- w_deletefn: fatom_delete,
- w_visfn: fatom_vis,
-#if PD_MINOR_VERSION < 37
- w_savefn: fatom_save,
- w_propertiesfn: NULL,
-#endif
- w_clickfn: NULL,
-};
+t_widgetbehavior fatom_widgetbehavior;
+
+
void fatom_size(t_fatom* x,t_floatarg w,t_floatarg h) {
@@ -420,6 +410,18 @@ static void *fatom_new(t_fatom* x,t_floatarg max, t_floatarg min, t_floatarg h,t
void fatom_setup_common(t_class* class)
{
+ fatom_widgetbehavior.w_getrectfn = fatom_getrect;
+ fatom_widgetbehavior.w_displacefn = fatom_displace;
+ fatom_widgetbehavior.w_selectfn = fatom_select;
+ fatom_widgetbehavior.w_activatefn = fatom_activate;
+ fatom_widgetbehavior.w_deletefn = fatom_delete;
+ fatom_widgetbehavior.w_visfn = fatom_vis;
+#if PD_MINOR_VERSION < 37
+ fatom_widgetbehavior.w_savefn = fatom_save;
+ fatom_widgetbehavior.w_propertiesfn = NULL,
+#endif
+ fatom_widgetbehavior.w_clickfn = NULL,
+
class_addfloat(class, (t_method)fatom_float);
class_addbang(class, (t_method)fatom_bang);
class_addmethod(class, (t_method)fatom_f, gensym("f"),
diff --git a/gui/image.c b/gui/image.c
index 65e4801..d3134d6 100644
--- a/gui/image.c
+++ b/gui/image.c
@@ -210,7 +210,7 @@ void image_setup(void)
image_setwidget();
class_setwidget(image_class,&image_widgetbehavior);
#if PD_MINOR_VERSION >= 37
- class_setsavefn(image_class,&image_widgetbehavior);
+ class_setsavefn(image_class,&image_save);
#endif
}
diff --git a/gui/slider.c b/gui/slider.c
index 06dedb9..8e74a8e 100755
--- a/gui/slider.c
+++ b/gui/slider.c
@@ -24,25 +24,26 @@ static void *slider_new(t_floatarg max, t_floatarg min, t_floatarg h)
}
-t_widgetbehavior slider_widgetbehavior = {
- w_getrectfn: fatom_getrect,
- w_displacefn: fatom_displace,
- w_selectfn: fatom_select,
- w_activatefn: fatom_activate,
- w_deletefn: fatom_delete,
- w_visfn: fatom_vis,
-#if PD_MINOR_VERSION < 37
- w_savefn: slider_save,
- w_propertiesfn: NULL,
-#endif
- w_clickfn: NULL,
-};
+t_widgetbehavior slider_widgetbehavior;
+
void slider_setup() {
slider_class = class_new(gensym("slider"), (t_newmethod)slider_new, 0,
sizeof(t_fatom),0,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0);
- fatom_setup_common(slider_class);
+ slider_widgetbehavior.w_getrectfn = fatom_getrect,
+ slider_widgetbehavior.w_displacefn = fatom_displace,
+ slider_widgetbehavior.w_selectfn = fatom_select,
+ slider_widgetbehavior.w_activatefn = fatom_activate,
+ slider_widgetbehavior.w_deletefn = fatom_delete,
+ slider_widgetbehavior.w_visfn= fatom_vis,
+#if PD_MINOR_VERSION < 37
+ slider_widgetbehavior.w_savefn = slider_save,
+ slider_widgetbehavior.w_propertiesfn = NULL,
+#endif
+ slider_widgetbehavior.w_clickfn = NULL,
+
+ fatom_setup_common(slider_class);
class_setwidget(slider_class,&slider_widgetbehavior);
#if PD_MINOR_VERSION >= 37
class_setsavefn(slider_class,&slider_save);
diff --git a/gui/sliderh.c b/gui/sliderh.c
index cbecea5..d89b6de 100644
--- a/gui/sliderh.c
+++ b/gui/sliderh.c
@@ -33,19 +33,9 @@ static void *sliderh_new(t_floatarg max, t_floatarg min,t_floatarg h)
}
-t_widgetbehavior sliderh_widgetbehavior = {
- w_getrectfn: fatom_getrect,
- w_displacefn: fatom_displace,
- w_selectfn: fatom_select,
- w_activatefn: fatom_activate,
- w_deletefn: fatom_delete,
- w_visfn: fatom_vis,
-#if PD_MINOR_VERSION < 37
- w_savefn: sliderh_save,
- w_propertiesfn: NULL,
-#endif
- w_clickfn: NULL,
-};
+t_widgetbehavior sliderh_widgetbehavior;
+
+
void sliderh_setup() {
@@ -53,7 +43,20 @@ void sliderh_setup() {
sizeof(t_fatom),0,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0);
fatom_setup_common(sliderh_class);
- class_setwidget(sliderh_class,&sliderh_widgetbehavior);
+
+ sliderh_widgetbehavior.w_getrectfn = fatom_getrect;
+ sliderh_widgetbehavior.w_displacefn= fatom_displace;
+ sliderh_widgetbehavior.w_selectfn= fatom_select;
+ sliderh_widgetbehavior.w_activatefn=fatom_activate;
+ sliderh_widgetbehavior.w_deletefn= fatom_delete;
+ sliderh_widgetbehavior.w_visfn= fatom_vis;
+#if PD_MINOR_VERSION < 37
+ sliderh_widgetbehavior.w_savefn= sliderh_save;
+ sliderh_widgetbehavior.w_propertiesfn= NULL;
+#endif
+ sliderh_widgetbehavior.w_clickfn= NULL;
+
+ class_setwidget(sliderh_class,&sliderh_widgetbehavior);
#if PD_MINOR_VERSION >= 37
class_setsavefn(sliderh_class,&sliderh_save);
#endif
diff --git a/gui/ticker.c b/gui/ticker.c
index 95e6c2e..74fa325 100755
--- a/gui/ticker.c
+++ b/gui/ticker.c
@@ -38,28 +38,31 @@ static void *ticker_new(t_symbol* t)
}
-t_widgetbehavior ticker_widgetbehavior = {
- w_getrectfn: fatom_getrect,
- w_displacefn: fatom_displace,
- w_selectfn: fatom_select,
- w_activatefn: fatom_activate,
- w_deletefn: fatom_delete,
- w_visfn: fatom_vis,
-#if PD_MINOR_VERSION < 37
- w_savefn: ticker_save,
- w_propertiesfn: NULL,
-#endif
- w_clickfn: NULL,
-};
+t_widgetbehavior ticker_widgetbehavior;
+
void ticker_setup() {
ticker_class = class_new(gensym("ticker"), (t_newmethod)ticker_new, 0,
sizeof(t_fatom),0,A_DEFSYMBOL,0);
class_addbang(ticker_class,ticker_bang);
- fatom_setup_common(ticker_class);
+ fatom_setup_common(ticker_class);
class_addbang(ticker_class, (t_method)ticker_bang);
- class_setwidget(ticker_class,&ticker_widgetbehavior);
+
+ ticker_widgetbehavior.w_getrectfn= fatom_getrect;
+ ticker_widgetbehavior.w_displacefn= fatom_displace;
+ ticker_widgetbehavior.w_selectfn= fatom_select;
+ ticker_widgetbehavior.w_activatefn= fatom_activate;
+ ticker_widgetbehavior.w_deletefn= fatom_delete;
+ ticker_widgetbehavior.w_visfn= fatom_vis;
+#if PD_MINOR_VERSION < 37
+ ticker_widgetbehavior.w_savefn= ticker_save;
+ ticker_widgetbehavior.w_propertiesfn= NULL;
+#endif
+ ticker_widgetbehavior.w_clickfn= NULL;
+
+
+ class_setwidget(ticker_class,&ticker_widgetbehavior);
#if PD_MINOR_VERSION >= 37
class_setsavefn(ticker_class,&ticker_save);
#endif
diff --git a/gui/w_envgen.h b/gui/w_envgen.h
index 02439f2..89a6c85 100755
--- a/gui/w_envgen.h
+++ b/gui/w_envgen.h
@@ -308,7 +308,6 @@ static void envgen_getrect(t_gobj *z, t_glist *owner,
int width, height;
t_envgen* s = (t_envgen*)z;
-
width = s->w.width + 2*BORDER;
height = s->w.height + 2*BORDER;
*xp1 = s->x_obj.te_xpix-BORDER;
@@ -402,7 +401,7 @@ static void envgen_followpointer(t_envgen* x)
void envgen_motion(t_envgen *x, t_floatarg dx, t_floatarg dy)
{
- if (x->w.shift) {
+ if (x->w.shift) {
x->w.pointerx+=dx/1000.f;
x->w.pointery+=dy/1000.f;
}