Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Wynn
purr-data
Commits
ec6f964c
Commit
ec6f964c
authored
Aug 20, 2014
by
Mathieu L Bouchard
Browse files
merged more scalehandle stuff together & put h_offset feature back in
parent
1e317c5a
Changes
10
Hide whitespace changes
Inline
Side-by-side
pd/src/g_all_guis.c
View file @
ec6f964c
...
...
@@ -18,6 +18,7 @@
#include <math.h>
t_symbol
*
s_empty
;
t_class
*
scalehandle_class
;
int
iemgui_color_hex
[]
=
{
0xfcfcfc
,
0xa0a0a0
,
0x404040
,
0xfce0e0
,
0xfce0c0
,
0xfcfcc8
,
0xd8fcd8
,
0xd8fcfc
,
0xdce4fc
,
0xf8d8fc
,
...
...
@@ -742,8 +743,8 @@ void scalehandle_draw(t_iemgui *x) {
}
}
t_scalehandle
*
scalehandle_new
(
t_class
*
c
,
t_object
*
x
,
t_glist
*
glist
,
int
scale
)
{
t_scalehandle
*
h
=
(
t_scalehandle
*
)
pd_new
(
c
);
t_scalehandle
*
scalehandle_new
(
t_object
*
x
,
t_glist
*
glist
,
int
scale
,
t_clickhandlefn
chf
,
t_motionhandlefn
mhf
)
{
t_scalehandle
*
h
=
(
t_scalehandle
*
)
pd_new
(
scalehandle_class
);
char
buf
[
19
];
// 3 + max size of %lx
h
->
h_master
=
x
;
h
->
h_glist
=
glist
;
...
...
@@ -756,6 +757,8 @@ t_scalehandle *scalehandle_new(t_class *c, t_object *x, t_glist *glist, int scal
//h->h_offset_y = 0; // unused (maybe keep for later)
h
->
h_vis
=
0
;
sprintf
(
h
->
h_pathname
,
".x%lx.h%lx"
,
(
t_int
)
h
->
h_glist
,
(
t_int
)
h
);
h
->
h_clickfn
=
chf
;
h
->
h_motionfn
=
mhf
;
return
h
;
}
...
...
@@ -873,6 +876,21 @@ void scalehandle_drag_scale(t_scalehandle *h) {
}
}
static
void
scalehandle_clickhook
(
t_scalehandle
*
h
,
t_floatarg
f
,
t_floatarg
xxx
,
t_floatarg
yyy
)
{
h
->
h_offset_x
=
xxx
;
h
->
h_offset_y
=
yyy
;
h
->
h_clickfn
(
h
,
f
);
}
static
void
scalehandle_motionhook
(
t_scalehandle
*
h
,
t_floatarg
f1
,
t_floatarg
f2
)
{
h
->
h_motionfn
(
h
,
f1
-
h
->
h_offset_x
,
f2
-
h
->
h_offset_y
);
}
void
iemgui__clickhook3
(
t_scalehandle
*
sh
,
int
newstate
)
{
if
(
!
sh
->
h_dragon
&&
newstate
&&
sh
->
h_scale
)
scalehandle_click_scale
(
sh
);
...
...
@@ -1127,6 +1145,12 @@ void iemgui_class_addmethods(t_class *c) {
void
g_iemgui_setup
(
void
)
{
s_empty
=
gensym
(
"empty"
);
scalehandle_class
=
class_new
(
gensym
(
"_scalehandle"
),
0
,
0
,
sizeof
(
t_scalehandle
),
CLASS_PD
,
0
);
class_addmethod
(
scalehandle_class
,
(
t_method
)
scalehandle_clickhook
,
gensym
(
"_click"
),
A_FLOAT
,
A_FLOAT
,
A_FLOAT
,
0
);
class_addmethod
(
scalehandle_class
,
(
t_method
)
scalehandle_motionhook
,
gensym
(
"_motion"
),
A_FLOAT
,
A_FLOAT
,
0
);
}
const
char
*
selection_color
=
"$pd_colors(selection)"
;
...
...
pd/src/g_all_guis.h
View file @
ec6f964c
...
...
@@ -34,6 +34,12 @@
typedef
void
(
*
t_iemfunptr
)(
void
*
x
,
t_glist
*
glist
,
int
mode
);
struct
_scalehandle
;
typedef
void
(
*
t_clickhandlefn
)(
struct
_scalehandle
*
sh
,
int
newstate
);
typedef
void
(
*
t_motionhandlefn
)(
struct
_scalehandle
*
sh
,
t_floatarg
f1
,
t_floatarg
f2
);
EXTERN
t_class
*
scalehandle_class
;
typedef
struct
_scalehandle
{
t_pd
h_pd
;
...
...
@@ -46,9 +52,11 @@ typedef struct _scalehandle
int
h_dragon
;
// bool
int
h_dragx
;
int
h_dragy
;
int
h_offset_x
;
// unused. bring back their use for extra precision.
int
h_offset_y
;
// ditto.
int
h_offset_x
;
int
h_offset_y
;
int
h_vis
;
// bool
t_clickhandlefn
h_clickfn
;
t_motionhandlefn
h_motionfn
;
}
t_scalehandle
;
typedef
struct
_iemgui
...
...
@@ -224,7 +232,7 @@ EXTERN void scalehandle_draw_select2(t_iemgui *x);
EXTERN
void
scalehandle_draw_erase
(
t_scalehandle
*
h
);
EXTERN
void
scalehandle_draw_erase2
(
t_iemgui
*
x
);
EXTERN
void
scalehandle_draw
(
t_iemgui
*
x
);
EXTERN
t_scalehandle
*
scalehandle_new
(
t_class
*
c
,
t_object
*
x
,
t_glist
*
glist
,
int
scale
);
EXTERN
t_scalehandle
*
scalehandle_new
(
t_object
*
x
,
t_glist
*
glist
,
int
scale
,
t_clickhandlefn
chf
,
t_motionhandlefn
mhf
);
EXTERN
void
scalehandle_free
(
t_scalehandle
*
h
);
EXTERN
void
properties_set_field_int
(
long
props
,
const
char
*
gui_field
,
int
value
);
EXTERN
void
scalehandle_dragon_label
(
t_scalehandle
*
h
,
float
f1
,
float
f2
);
...
...
pd/src/g_bang.c
View file @
ec6f964c
...
...
@@ -18,7 +18,6 @@
#define IEM_BNG_MINHOLDFLASHTIME 50
#define IEM_BNG_MINBREAKFLASHTIME 10
static
t_class
*
scalehandle_class
;
extern
int
gfxstub_haveproperties
(
void
*
key
);
t_widgetbehavior
bng_widgetbehavior
;
static
t_class
*
bng_class
;
...
...
@@ -76,11 +75,9 @@ void bng_draw_config(t_bng* x, t_glist* glist)
canvas
,
x
,
x
->
x_flashed
?
x
->
x_gui
.
x_fcol
:
x
->
x_gui
.
x_bcol
);
}
static
void
bng__clickhook
(
t_scalehandle
*
sh
,
t_floatarg
f
,
t_floatarg
xxx
,
t_floatarg
yyy
)
static
void
bng__clickhook
(
t_scalehandle
*
sh
,
int
newstate
)
{
t_bng
*
x
=
(
t_bng
*
)(
sh
->
h_master
);
int
newstate
=
(
int
)
f
;
if
(
sh
->
h_dragon
&&
newstate
==
0
&&
sh
->
h_scale
)
{
canvas_apply_setundo
(
x
->
x_gui
.
x_glist
,
(
t_gobj
*
)
x
);
...
...
@@ -368,8 +365,8 @@ static void *bng_new(t_symbol *s, int argc, t_atom *argv)
x
->
x_clock_lck
=
clock_new
(
x
,
(
t_method
)
bng_tick_lck
);
outlet_new
(
&
x
->
x_gui
.
x_obj
,
&
s_bang
);
x
->
x_gui
.
x_handle
=
scalehandle_new
(
scalehandle_class
,
(
t_object
*
)
x
,
x
->
x_gui
.
x_glist
,
1
);
x
->
x_gui
.
x_lhandle
=
scalehandle_new
(
scalehandle_class
,
(
t_object
*
)
x
,
x
->
x_gui
.
x_glist
,
0
);
x
->
x_gui
.
x_handle
=
scalehandle_new
((
t_object
*
)
x
,
x
->
x_gui
.
x_glist
,
1
,
bng__clickhook
,
bng__motionhook
);
x
->
x_gui
.
x_lhandle
=
scalehandle_new
((
t_object
*
)
x
,
x
->
x_gui
.
x_glist
,
0
,
bng__clickhook
,
bng__motionhook
);
x
->
x_gui
.
x_obj
.
te_iemgui
=
1
;
x
->
x_gui
.
x_changed
=
0
;
...
...
@@ -410,13 +407,6 @@ void g_bang_setup(void)
A_GIMME
,
0
);
class_addmethod
(
bng_class
,
(
t_method
)
iemgui_init
,
gensym
(
"init"
),
A_FLOAT
,
0
);
scalehandle_class
=
class_new
(
gensym
(
"_scalehandle"
),
0
,
0
,
sizeof
(
t_scalehandle
),
CLASS_PD
,
0
);
class_addmethod
(
scalehandle_class
,
(
t_method
)
bng__clickhook
,
gensym
(
"_click"
),
A_FLOAT
,
A_FLOAT
,
A_FLOAT
,
0
);
class_addmethod
(
scalehandle_class
,
(
t_method
)
bng__motionhook
,
gensym
(
"_motion"
),
A_FLOAT
,
A_FLOAT
,
0
);
wb_init
(
&
bng_widgetbehavior
,
bng_getrect
,
bng_newclick
);
class_setwidget
(
bng_class
,
&
bng_widgetbehavior
);
class_sethelpsymbol
(
bng_class
,
gensym
(
"bng"
));
...
...
pd/src/g_canvas.c
View file @
ec6f964c
...
...
@@ -15,7 +15,6 @@ to be different but are now unified except for some fossilized names.) */
#include "g_all_guis.h"
#include <string.h>
static
t_class
*
scalehandle_class
;
extern
int
do_not_redraw
;
extern
void
canvas_drawconnection
(
t_canvas
*
x
,
int
lx1
,
int
ly1
,
int
lx2
,
int
ly2
,
t_int
tag
,
int
issignal
);
extern
void
canvas_updateconnection
(
t_canvas
*
x
,
int
lx1
,
int
ly1
,
int
lx2
,
int
ly2
,
t_int
tag
);
...
...
@@ -350,6 +349,9 @@ void glist_init(t_glist *x)
x
->
gl_ylabel
=
(
t_symbol
**
)
t_getbytes
(
0
);
}
void
canvasgop__clickhook
(
t_scalehandle
*
sh
,
int
newstate
);
void
canvasgop__motionhook
(
t_scalehandle
*
sh
,
t_floatarg
f1
,
t_floatarg
f2
);
/* make a new glist. It will either be a "root" canvas or else
it appears as a "text" object in another window (canvas_getcurrent()
tells us which.) */
...
...
@@ -441,8 +443,8 @@ t_canvas *canvas_new(void *dummy, t_symbol *sel, int argc, t_atom *argv)
pd_pushsym
(
&
x
->
gl_pd
);
//dpsaha@vt.edu gop resize (refactored by mathieu)
x
->
x_handle
=
scalehandle_new
(
scalehandle_class
,(
t_object
*
)
x
,
x
,
1
);
x
->
x_mhandle
=
scalehandle_new
(
scalehandle_class
,(
t_object
*
)
x
,
x
,
0
);
x
->
x_handle
=
scalehandle_new
(
(
t_object
*
)
x
,
x
,
1
,
canvasgop__clickhook
,
canvasgop__motionhook
);
x
->
x_mhandle
=
scalehandle_new
(
(
t_object
*
)
x
,
x
,
0
,
canvasgop__clickhook
,
canvasgop__motionhook
);
x
->
u_queue
=
canvas_undo_init
(
x
);
return
(
x
);
...
...
@@ -1924,11 +1926,9 @@ extern void canvas_canvas_setundo(t_canvas *x);
extern
void
graph_checkgop_rect
(
t_gobj
*
z
,
t_glist
*
glist
,
int
*
xp1
,
int
*
yp1
,
int
*
xp2
,
int
*
yp2
);
void
canvasgop__clickhook
(
t_scalehandle
*
sh
,
t_floatarg
f
,
t_floatarg
xxx
,
t_floatarg
yyy
)
void
canvasgop__clickhook
(
t_scalehandle
*
sh
,
int
newstate
)
{
t_canvas
*
x
=
(
t_canvas
*
)(
sh
->
h_master
);
int
newstate
=
(
int
)
f
;
if
(
sh
->
h_dragon
&&
newstate
==
0
)
{
/* done dragging */
...
...
@@ -2228,12 +2228,4 @@ void g_canvas_setup(void)
g_graph_setup
();
g_editor_setup
();
g_readwrite_setup
();
/* -------------- dpsaha@vt.edu gop resize move-----------------------*/
scalehandle_class
=
class_new
(
gensym
(
"_scalehandle"
),
0
,
0
,
sizeof
(
t_scalehandle
),
CLASS_PD
,
0
);
class_addmethod
(
scalehandle_class
,
(
t_method
)
canvasgop__clickhook
,
gensym
(
"_click"
),
A_FLOAT
,
A_FLOAT
,
A_FLOAT
,
0
);
class_addmethod
(
scalehandle_class
,
(
t_method
)
canvasgop__motionhook
,
gensym
(
"_motion"
),
A_FLOAT
,
A_FLOAT
,
0
);
}
pd/src/g_mycanvas.c
View file @
ec6f964c
...
...
@@ -13,7 +13,6 @@
#include "g_all_guis.h"
#include <math.h>
static
t_class
*
scalehandle_class
;
extern
int
gfxstub_haveproperties
(
void
*
key
);
void
my_canvas_draw_select
(
t_my_canvas
*
x
,
t_glist
*
glist
);
...
...
@@ -70,11 +69,9 @@ void my_canvas_draw_select(t_my_canvas* x, t_glist* glist)
"$pd_colors(selection)"
:
bcol
);
}
static
void
my_canvas__clickhook
(
t_scalehandle
*
sh
,
t_floatarg
f
,
t_floatarg
xxx
,
t_floatarg
yyy
)
static
void
my_canvas__clickhook
(
t_scalehandle
*
sh
,
int
newstate
)
{
t_my_canvas
*
x
=
(
t_my_canvas
*
)(
sh
->
h_master
);
int
newstate
=
(
int
)
f
;
if
(
sh
->
h_dragon
&&
newstate
==
0
&&
sh
->
h_scale
)
{
canvas_apply_setundo
(
x
->
x_gui
.
x_glist
,
(
t_gobj
*
)
x
);
...
...
@@ -320,8 +317,8 @@ static void *my_canvas_new(t_symbol *s, int argc, t_atom *argv)
x
->
x_at
[
1
].
a_type
=
A_FLOAT
;
iemgui_verify_snd_ne_rcv
(
&
x
->
x_gui
);
x
->
x_gui
.
x_handle
=
scalehandle_new
(
scalehandle_class
,
(
t_object
*
)
x
,
x
->
x_gui
.
x_glist
,
1
);
x
->
x_gui
.
x_lhandle
=
scalehandle_new
(
scalehandle_class
,
(
t_object
*
)
x
,
x
->
x_gui
.
x_glist
,
0
);
x
->
x_gui
.
x_handle
=
scalehandle_new
((
t_object
*
)
x
,
x
->
x_gui
.
x_glist
,
1
,
my_canvas__clickhook
,
my_canvas__motionhook
);
x
->
x_gui
.
x_lhandle
=
scalehandle_new
((
t_object
*
)
x
,
x
->
x_gui
.
x_glist
,
0
,
my_canvas__clickhook
,
my_canvas__motionhook
);
x
->
x_gui
.
x_obj
.
te_iemgui
=
1
;
return
(
x
);
...
...
@@ -353,13 +350,6 @@ void g_mycanvas_setup(void)
class_addmethod
(
my_canvas_class
,
(
t_method
)
my_canvas_get_pos
,
gensym
(
"get_pos"
),
0
);
scalehandle_class
=
class_new
(
gensym
(
"_scalehandle"
),
0
,
0
,
sizeof
(
t_scalehandle
),
CLASS_PD
,
0
);
class_addmethod
(
scalehandle_class
,
(
t_method
)
my_canvas__clickhook
,
gensym
(
"_click"
),
A_FLOAT
,
A_FLOAT
,
A_FLOAT
,
0
);
class_addmethod
(
scalehandle_class
,
(
t_method
)
my_canvas__motionhook
,
gensym
(
"_motion"
),
A_FLOAT
,
A_FLOAT
,
0
);
wb_init
(
&
my_canvas_widgetbehavior
,
my_canvas_getrect
,
0
);
class_setwidget
(
my_canvas_class
,
&
my_canvas_widgetbehavior
);
class_sethelpsymbol
(
my_canvas_class
,
gensym
(
"my_canvas"
));
...
...
pd/src/g_numbox.c
View file @
ec6f964c
...
...
@@ -13,7 +13,6 @@
#include <math.h>
#define IEM_GUI_COLOR_EDITED 0xff0000
static
t_class
*
scalehandle_class
;
extern
int
gfxstub_haveproperties
(
void
*
key
);
static
void
my_numbox_draw_select
(
t_my_numbox
*
x
,
t_glist
*
glist
);
static
void
my_numbox_key
(
void
*
z
,
t_floatarg
fkey
);
...
...
@@ -231,11 +230,9 @@ static void my_numbox_draw_select(t_my_numbox *x, t_glist *glist)
scalehandle_draw_erase2
(
&
x
->
x_gui
);
}
static
void
my_numbox__clickhook
(
t_scalehandle
*
sh
,
t_floatarg
f
,
t_floatarg
xxx
,
t_floatarg
yyy
)
static
void
my_numbox__clickhook
(
t_scalehandle
*
sh
,
int
newstate
)
{
t_my_numbox
*
x
=
(
t_my_numbox
*
)(
sh
->
h_master
);
int
newstate
=
(
int
)
f
;
if
(
sh
->
h_dragon
&&
newstate
==
0
&&
sh
->
h_scale
)
{
canvas_apply_setundo
(
x
->
x_gui
.
x_glist
,
(
t_gobj
*
)
x
);
...
...
@@ -759,8 +756,8 @@ static void *my_numbox_new(t_symbol *s, int argc, t_atom *argv)
x
->
x_gui
.
x_change
=
0
;
outlet_new
(
&
x
->
x_gui
.
x_obj
,
&
s_float
);
x
->
x_gui
.
x_handle
=
scalehandle_new
(
scalehandle_class
,
(
t_object
*
)
x
,
x
->
x_gui
.
x_glist
,
1
);
x
->
x_gui
.
x_lhandle
=
scalehandle_new
(
scalehandle_class
,
(
t_object
*
)
x
,
x
->
x_gui
.
x_glist
,
0
);
x
->
x_gui
.
x_handle
=
scalehandle_new
((
t_object
*
)
x
,
x
->
x_gui
.
x_glist
,
1
,
my_numbox__clickhook
,
my_numbox__motionhook
);
x
->
x_gui
.
x_lhandle
=
scalehandle_new
((
t_object
*
)
x
,
x
->
x_gui
.
x_glist
,
0
,
my_numbox__clickhook
,
my_numbox__motionhook
);
x
->
x_scalewidth
=
0
;
x
->
x_scaleheight
=
0
;
x
->
x_tmpfontsize
=
0
;
...
...
@@ -817,13 +814,6 @@ void g_numbox_setup(void)
class_addmethod
(
my_numbox_class
,
(
t_method
)
my_numbox_hide_frame
,
gensym
(
"hide_frame"
),
A_FLOAT
,
0
);
scalehandle_class
=
class_new
(
gensym
(
"_scalehandle"
),
0
,
0
,
sizeof
(
t_scalehandle
),
CLASS_PD
,
0
);
class_addmethod
(
scalehandle_class
,
(
t_method
)
my_numbox__clickhook
,
gensym
(
"_click"
),
A_FLOAT
,
A_FLOAT
,
A_FLOAT
,
0
);
class_addmethod
(
scalehandle_class
,
(
t_method
)
my_numbox__motionhook
,
gensym
(
"_motion"
),
A_FLOAT
,
A_FLOAT
,
0
);
wb_init
(
&
my_numbox_widgetbehavior
,
my_numbox_getrect
,
my_numbox_newclick
);
class_setwidget
(
my_numbox_class
,
&
my_numbox_widgetbehavior
);
class_sethelpsymbol
(
my_numbox_class
,
gensym
(
"numbox2"
));
...
...
pd/src/g_radio.c
View file @
ec6f964c
...
...
@@ -18,7 +18,6 @@
#define IEM_RADIO_MAX 128
static
t_class
*
scalehandle_class
;
extern
int
gfxstub_haveproperties
(
void
*
key
);
t_widgetbehavior
radio_widgetbehavior
;
t_class
*
hradio_class
,
*
hradio_old_class
;
...
...
@@ -110,10 +109,8 @@ void radio_draw_config(t_radio *x, t_glist *glist)
}
}
static
void
radio__clickhook
(
t_scalehandle
*
sh
,
t_floatarg
f
,
t_floatarg
xxx
,
t_floatarg
yyy
)
static
void
radio__clickhook
(
t_scalehandle
*
sh
,
int
newstate
)
{
int
newstate
=
(
int
)
f
;
if
(
sh
->
h_dragon
&&
newstate
==
0
&&
sh
->
h_scale
)
{
t_radio
*
x
=
(
t_radio
*
)(
sh
->
h_master
);
...
...
@@ -460,8 +457,8 @@ static void *radio_new(t_symbol *s, int argc, t_atom *argv)
iemgui_all_colfromload
(
&
x
->
x_gui
,
bflcol
);
outlet_new
(
&
x
->
x_gui
.
x_obj
,
&
s_list
);
x
->
x_gui
.
x_handle
=
scalehandle_new
(
scalehandle_class
,
(
t_object
*
)
x
,
x
->
x_gui
.
x_glist
,
1
);
x
->
x_gui
.
x_lhandle
=
scalehandle_new
(
scalehandle_class
,
(
t_object
*
)
x
,
x
->
x_gui
.
x_glist
,
0
);
x
->
x_gui
.
x_handle
=
scalehandle_new
((
t_object
*
)
x
,
x
->
x_gui
.
x_glist
,
1
,
radio__clickhook
,
radio__motionhook
);
x
->
x_gui
.
x_lhandle
=
scalehandle_new
((
t_object
*
)
x
,
x
->
x_gui
.
x_glist
,
0
,
radio__clickhook
,
radio__motionhook
);
x
->
x_gui
.
x_obj
.
te_iemgui
=
1
;
return
(
x
);
...
...
@@ -528,12 +525,4 @@ void g_radio_setup(void)
class_sethelpsymbol
(
hradio_old_class
,
gensym
(
"hradio"
));
class_sethelpsymbol
(
vradio_class
,
gensym
(
"vradio"
));
class_sethelpsymbol
(
vradio_old_class
,
gensym
(
"vradio"
));
scalehandle_class
=
class_new
(
gensym
(
"_scalehandle"
),
0
,
0
,
sizeof
(
t_scalehandle
),
CLASS_PD
,
0
);
class_addmethod
(
scalehandle_class
,
(
t_method
)
radio__clickhook
,
gensym
(
"_click"
),
A_FLOAT
,
A_FLOAT
,
A_FLOAT
,
0
);
class_addmethod
(
scalehandle_class
,
(
t_method
)
radio__motionhook
,
gensym
(
"_motion"
),
A_FLOAT
,
A_FLOAT
,
0
);
}
pd/src/g_slider.c
View file @
ec6f964c
...
...
@@ -13,7 +13,6 @@
#include "g_all_guis.h"
#include <math.h>
static
t_class
*
scalehandle_class
;
extern
int
gfxstub_haveproperties
(
void
*
key
);
t_widgetbehavior
slider_widgetbehavior
;
t_class
*
hslider_class
;
...
...
@@ -114,10 +113,8 @@ static void vslider__clickhook2(t_scalehandle *sh, t_slider *x) {
slider_check_minmax
(
x
,
x
->
x_min
,
x
->
x_max
);
}
static
void
slider__clickhook
(
t_scalehandle
*
sh
,
t_floatarg
f
,
t_floatarg
xxx
,
t_floatarg
yyy
)
static
void
slider__clickhook
(
t_scalehandle
*
sh
,
int
newstate
)
{
int
newstate
=
(
int
)
f
;
if
(
sh
->
h_dragon
&&
newstate
==
0
&&
sh
->
h_scale
)
{
t_slider
*
x
=
(
t_slider
*
)(
sh
->
h_master
);
...
...
@@ -533,8 +530,8 @@ static void *slider_new(t_symbol *s, int argc, t_atom *argv)
iemgui_verify_snd_ne_rcv
(
&
x
->
x_gui
);
outlet_new
(
&
x
->
x_gui
.
x_obj
,
&
s_float
);
x
->
x_gui
.
x_handle
=
scalehandle_new
(
scalehandle_class
,
(
t_object
*
)
x
,
x
->
x_gui
.
x_glist
,
1
);
x
->
x_gui
.
x_lhandle
=
scalehandle_new
(
scalehandle_class
,
(
t_object
*
)
x
,
x
->
x_gui
.
x_glist
,
0
);
x
->
x_gui
.
x_handle
=
scalehandle_new
((
t_object
*
)
x
,
x
->
x_gui
.
x_glist
,
1
,
slider__clickhook
,
slider__motionhook
);
x
->
x_gui
.
x_lhandle
=
scalehandle_new
((
t_object
*
)
x
,
x
->
x_gui
.
x_glist
,
0
,
slider__clickhook
,
slider__motionhook
);
x
->
x_gui
.
x_obj
.
te_iemgui
=
1
;
x
->
x_gui
.
x_changed
=
0
;
...
...
@@ -593,11 +590,4 @@ void g_slider_setup(void)
class_sethelpsymbol
(
hslider_class
,
gensym
(
"hslider"
));
class_sethelpsymbol
(
vslider_class
,
gensym
(
"vslider"
));
scalehandle_class
=
class_new
(
gensym
(
"_scalehandle"
),
0
,
0
,
sizeof
(
t_scalehandle
),
CLASS_PD
,
0
);
class_addmethod
(
scalehandle_class
,
(
t_method
)
slider__clickhook
,
gensym
(
"_click"
),
A_FLOAT
,
A_FLOAT
,
A_FLOAT
,
0
);
class_addmethod
(
scalehandle_class
,
(
t_method
)
slider__motionhook
,
gensym
(
"_motion"
),
A_FLOAT
,
A_FLOAT
,
0
);
}
pd/src/g_toggle.c
View file @
ec6f964c
...
...
@@ -13,7 +13,6 @@
#include "g_all_guis.h"
#include <math.h>
static
t_class
*
scalehandle_class
;
extern
int
gfxstub_haveproperties
(
void
*
key
);
t_widgetbehavior
toggle_widgetbehavior
;
static
t_class
*
toggle_class
;
...
...
@@ -78,11 +77,9 @@ void toggle_draw_config(t_toggle* x, t_glist* glist)
canvas
,
x
,
x
,
x
->
x_on
?
x
->
x_gui
.
x_fcol
:
x
->
x_gui
.
x_bcol
);
}
static
void
toggle__clickhook
(
t_scalehandle
*
sh
,
t_floatarg
f
,
t_floatarg
xxx
,
t_floatarg
yyy
)
static
void
toggle__clickhook
(
t_scalehandle
*
sh
,
int
newstate
)
{
t_toggle
*
x
=
(
t_toggle
*
)(
sh
->
h_master
);
int
newstate
=
(
int
)
f
;
if
(
sh
->
h_dragon
&&
newstate
==
0
&&
sh
->
h_scale
)
{
canvas_apply_setundo
(
x
->
x_gui
.
x_glist
,
(
t_gobj
*
)
x
);
...
...
@@ -318,8 +315,8 @@ static void *toggle_new(t_symbol *s, int argc, t_atom *argv)
iemgui_verify_snd_ne_rcv
(
&
x
->
x_gui
);
outlet_new
(
&
x
->
x_gui
.
x_obj
,
&
s_float
);
x
->
x_gui
.
x_handle
=
scalehandle_new
(
scalehandle_class
,
(
t_object
*
)
x
,
x
->
x_gui
.
x_glist
,
1
);
x
->
x_gui
.
x_lhandle
=
scalehandle_new
(
scalehandle_class
,
(
t_object
*
)
x
,
x
->
x_gui
.
x_glist
,
0
);
x
->
x_gui
.
x_handle
=
scalehandle_new
((
t_object
*
)
x
,
x
->
x_gui
.
x_glist
,
1
,
toggle__clickhook
,
toggle__motionhook
);
x
->
x_gui
.
x_lhandle
=
scalehandle_new
((
t_object
*
)
x
,
x
->
x_gui
.
x_glist
,
0
,
toggle__clickhook
,
toggle__motionhook
);
x
->
x_gui
.
x_obj
.
te_iemgui
=
1
;
x
->
x_gui
.
x_changed
=
1
;
...
...
@@ -359,13 +356,6 @@ void g_toggle_setup(void)
class_addmethod
(
toggle_class
,
(
t_method
)
toggle_nonzero
,
gensym
(
"nonzero"
),
A_FLOAT
,
0
);
scalehandle_class
=
class_new
(
gensym
(
"_scalehandle"
),
0
,
0
,
sizeof
(
t_scalehandle
),
CLASS_PD
,
0
);
class_addmethod
(
scalehandle_class
,
(
t_method
)
toggle__clickhook
,
gensym
(
"_click"
),
A_FLOAT
,
A_FLOAT
,
A_FLOAT
,
0
);
class_addmethod
(
scalehandle_class
,
(
t_method
)
toggle__motionhook
,
gensym
(
"_motion"
),
A_FLOAT
,
A_FLOAT
,
0
);
wb_init
(
&
toggle_widgetbehavior
,
toggle_getrect
,
toggle_newclick
);
class_setwidget
(
toggle_class
,
&
toggle_widgetbehavior
);
class_sethelpsymbol
(
toggle_class
,
gensym
(
"toggle"
));
...
...
pd/src/g_vumeter.c
View file @
ec6f964c
...
...
@@ -60,7 +60,6 @@ int iemgui_vu_col[]=
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
14
,
14
,
13
,
13
,
13
,
13
,
13
,
13
,
13
,
13
,
13
,
13
,
13
,
19
,
19
,
19
};
static
t_class
*
scalehandle_class
;
extern
int
gfxstub_haveproperties
(
void
*
key
);
void
vu_check_height
(
t_vu
*
x
,
int
h
);
t_widgetbehavior
vu_widgetbehavior
;
...
...
@@ -233,11 +232,9 @@ static void vu_draw_select(t_vu* x,t_glist* glist)
canvas
,
x
,
issel
?
selection_color
:
lcol
);
}
static
void
vu__clickhook
(
t_scalehandle
*
sh
,
t_floatarg
f
,
t_floatarg
xxx
,
t_floatarg
yyy
)
static
void
vu__clickhook
(
t_scalehandle
*
sh
,
int
newstate
)
{
t_vu
*
x
=
(
t_vu
*
)(
sh
->
h_master
);
int
newstate
=
(
int
)
f
;
if
(
sh
->
h_dragon
&&
newstate
==
0
&&
sh
->
h_scale
)
{
canvas_apply_setundo
(
x
->
x_gui
.
x_glist
,
(
t_gobj
*
)
x
);
...
...
@@ -616,8 +613,8 @@ static void *vu_new(t_symbol *s, int argc, t_atom *argv)
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
);
x
->
x_gui
.
x_handle
=
scalehandle_new
(
scalehandle_class
,
(
t_object
*
)
x
,
x
->
x_gui
.
x_glist
,
1
);
x
->
x_gui
.
x_lhandle
=
scalehandle_new
(
scalehandle_class
,
(
t_object
*
)
x
,
x
->
x_gui
.
x_glist
,
0
);
x
->
x_gui
.
x_handle
=
scalehandle_new
((
t_object
*
)
x
,
x
->
x_gui
.
x_glist
,
1
,
vu__clickhook
,
vu__motionhook
);
x
->
x_gui
.
x_lhandle
=
scalehandle_new
((
t_object
*
)
x
,
x
->
x_gui
.
x_glist
,
0
,
vu__clickhook
,
vu__motionhook
);
x
->
x_gui
.
x_obj
.
te_iemgui
=
1
;
return
(
x
);
...
...
@@ -646,12 +643,6 @@ void g_vumeter_setup(void)
class_addmethod
(
vu_class
,
(
t_method
)
vu_scale
,
gensym
(
"scale"
),
A_DEFFLOAT
,
0
);
iemgui_class_addmethods
(
vu_class
);
scalehandle_class
=
class_new
(
gensym
(
"_scalehandle"
),
0
,
0
,
sizeof
(
t_scalehandle
),
CLASS_PD
,
0
);
class_addmethod
(
scalehandle_class
,
(
t_method
)
vu__clickhook
,
gensym
(
"_click"
),
A_FLOAT
,
A_FLOAT
,
A_FLOAT
,
0
);
class_addmethod
(
scalehandle_class
,
(
t_method
)
vu__motionhook
,
gensym
(
"_motion"
),
A_FLOAT
,
A_FLOAT
,
0
);
wb_init
(
&
vu_widgetbehavior
,
vu_getrect
,
0
);
class_setwidget
(
vu_class
,
&
vu_widgetbehavior
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment