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
Jonathan Wilkes
purr-data
Commits
9bf986c8
Commit
9bf986c8
authored
Aug 07, 2014
by
Mathieu L Bouchard
Browse files
refactor of iemgui labels, iemgui inlets/outlets, and some other things
parent
33b24e85
Changes
12
Hide whitespace changes
Inline
Side-by-side
pd/src/g_all_guis.c
View file @
9bf986c8
...
...
@@ -26,6 +26,8 @@
#include <io.h>
#endif
t_symbol
*
s_empty
;
/* #define GGEE_HSLIDER_COMPATIBLE */
/*------------------ global varaibles -------------------------*/
...
...
@@ -861,7 +863,6 @@ void iem_inttofstyle(t_iem_fstyle_flags *fstylep, int n)
{
memset
(
fstylep
,
0
,
sizeof
(
*
fstylep
));
fstylep
->
x_font_style
=
(
n
>>
0
);
fstylep
->
x_shiftdown
=
0
;
fstylep
->
x_selected
=
0
;
fstylep
->
x_finemoved
=
0
;
fstylep
->
x_put_in2out
=
0
;
...
...
@@ -894,7 +895,7 @@ char *iem_get_tag(t_canvas *glist, t_iemgui *iem_obj)
}
//----------------------------------------------------------------
// SCALEHANDLE COMMON CODE
// SCALEHANDLE COMMON CODE
(by Mathieu, refactored from existing code)
extern
int
gfxstub_haveproperties
(
void
*
key
);
...
...
@@ -1102,3 +1103,110 @@ void scalehandle_drag_scale(t_scalehandle *h) {
}
}
//----------------------------------------------------------------
// IEMGUI refactor (by Mathieu)
void
iemgui_tag_selected
(
t_iemgui
*
x
,
t_glist
*
canvas
,
const
char
*
class_tag
)
{
if
(
x
->
x_fsf
.
x_selected
)
sys_vgui
(
".x%lx.c addtag selected withtag %lx%s
\n
"
,
canvas
,
x
,
class_tag
);
else
sys_vgui
(
".x%lx.c dtag %lx%s selected
\n
"
,
canvas
,
x
,
class_tag
);
}
void
iemgui_label_draw_new
(
t_iemgui
*
x
,
t_glist
*
canvas
,
int
xpos
,
int
ypos
,
const
char
*
nlet_tag
,
const
char
*
class_tag
)
{
sys_vgui
(
".x%lx.c create text %d %d -text {%s} -anchor w "
"-font {{%s} -%d %s} -fill #%6.6x "
"-tags {%lxLABEL %lx%s text iemgui %s}
\n
"
,
canvas
,
xpos
+
x
->
x_ldx
,
ypos
+
x
->
x_ldy
,
strcmp
(
x
->
x_lab
->
s_name
,
"empty"
)
?
x
->
x_lab
->
s_name
:
""
,
x
->
x_font
,
x
->
x_fontsize
,
sys_fontweight
,
x
->
x_lcol
,
x
,
x
,
class_tag
,
nlet_tag
);
}
void
iemgui_label_draw_move
(
t_iemgui
*
x
,
t_glist
*
canvas
,
int
xpos
,
int
ypos
)
{
sys_vgui
(
".x%lx.c coords %lxLABEL %d %d
\n
"
,
canvas
,
x
,
xpos
+
x
->
x_ldx
,
ypos
+
x
->
x_ldy
);
}
void
iemgui_label_draw_config
(
t_iemgui
*
x
,
t_glist
*
canvas
)
{
if
(
x
->
x_fsf
.
x_selected
&&
x
->
x_glist
==
canvas
)
sys_vgui
(
".x%lx.c itemconfigure %lxLABEL -font {{%s} -%d %s} "
"-fill $pd_colors(selection) -text {%s}
\n
"
,
canvas
,
x
,
x
->
x_font
,
x
->
x_fontsize
,
sys_fontweight
,
strcmp
(
x
->
x_lab
->
s_name
,
"empty"
)
?
x
->
x_lab
->
s_name
:
""
);
else
sys_vgui
(
".x%lx.c itemconfigure %lxLABEL -font {{%s} -%d %s} "
"-fill #%6.6x -text {%s}
\n
"
,
canvas
,
x
,
x
->
x_font
,
x
->
x_fontsize
,
sys_fontweight
,
x
->
x_lcol
,
strcmp
(
x
->
x_lab
->
s_name
,
"empty"
)
?
x
->
x_lab
->
s_name
:
""
);
}
void
iemgui_label_draw_select
(
t_iemgui
*
x
,
t_glist
*
canvas
)
{
if
(
x
->
x_fsf
.
x_selected
)
sys_vgui
(
".x%lx.c itemconfigure %lxLABEL "
"-fill $pd_colors(selection)
\n
"
,
canvas
,
x
);
else
sys_vgui
(
".x%lx.c itemconfigure %lxLABEL -fill #%6.6x
\n
"
,
canvas
,
x
,
x
->
x_lcol
);
}
void
iemgui_io_draw
(
t_iemgui
*
x
,
t_glist
*
canvas
,
int
old_sr_flags
,
const
char
*
class_tag
)
{
int
a
,
b
;
t_class
*
c
=
pd_class
((
t_pd
*
)
x
);
//printf("--- iemgui_io_draw %s flags=%d\n",c->c_name->s_name,old_sr_flags);
char
*
nlet_tag
=
iem_get_tag
(
/*glist*/
x
->
x_glist
,
(
t_iemgui
*
)
x
);
if
(
!
(
old_sr_flags
&
4
)
&&
(
!
glist_isvisible
(
canvas
)
||
!
(
canvas
==
x
->
x_glist
)))
{
//printf("---/iemgui_io_draw not visible\n");
return
;
}
int
x1
,
y1
,
x2
,
y2
;
c
->
c_wb
->
w_getrectfn
((
t_gobj
*
)
x
,
canvas
,
&
x1
,
&
y1
,
&
x2
,
&
y2
);
a
=
old_sr_flags
&
IEM_GUI_OLD_SND_FLAG
;
//b=x->x_fsf.x_snd_able; // not inited at moment of new
b
=
x
->
x_snd
!=
s_empty
;
//printf("a=%d b=%d snd=%s\n",a,b,x->x_snd->s_name);
if
(
a
&&
!
b
)
//printf("%s create outlet\n",c->c_name->s_name), fflush(stdout),
sys_vgui
(
".x%lx.c create prect %d %d %d %d "
"-stroke $pd_colors(iemgui_nlet) "
"-tags {%lx%s%so%d %so%d %lx%s outlet iemgui %s}
\n
"
,
canvas
,
x1
,
y2
-
1
,
x1
+
IOWIDTH
,
y2
,
x
,
class_tag
,
nlet_tag
,
0
,
nlet_tag
,
0
,
x
,
class_tag
,
nlet_tag
);
if
(
!
a
&&
b
)
//printf("%s delete outlet\n",c->c_name->s_name), fflush(stdout),
sys_vgui
(
".x%lx.c delete %lx%s%so%d
\n
"
,
canvas
,
x
,
class_tag
,
nlet_tag
,
0
);
a
=
old_sr_flags
&
IEM_GUI_OLD_RCV_FLAG
;
//b=x->x_fsf.x_rcv_able; // not inited at moment of new
b
=
x
->
x_rcv
!=
s_empty
;
//printf("a=%d b=%d rcv=%s\n",a,b,x->x_rcv->s_name);
if
(
a
&&
!
b
)
//printf("%s create inlet\n",c->c_name->s_name), fflush(stdout),
sys_vgui
(
".x%lx.c create prect %d %d %d %d "
"-stroke $pd_colors(iemgui_nlet) "
"-tags {%lx%s%si%d %si%d %lx%s inlet iemgui %s}
\n
"
,
canvas
,
x1
,
y1
,
x1
+
IOWIDTH
,
y1
+
1
,
x
,
class_tag
,
nlet_tag
,
0
,
nlet_tag
,
0
,
x
,
class_tag
,
nlet_tag
);
if
(
!
a
&&
b
)
//printf("%s delete inlet\n",c->c_name->s_name), fflush(stdout),
sys_vgui
(
".x%lx.c delete %lx%s%si%d
\n
"
,
canvas
,
x
,
class_tag
,
nlet_tag
,
0
);
//printf("---/iemgui_io_draw\n");
}
void
iemgui_draw_erase
(
t_iemgui
*
x
,
t_glist
*
glist
,
const
char
*
class_tag
)
{
t_canvas
*
canvas
=
glist_getcanvas
(
glist
);
sys_vgui
(
".x%lx.c delete %lx%s
\n
"
,
canvas
,
x
,
class_tag
);
sys_vgui
(
".x%lx.c dtag all %lx%s
\n
"
,
canvas
,
x
,
class_tag
);
scalehandle_draw_erase2
(
x
,
glist
);
}
void
wb_init
(
t_widgetbehavior
*
wb
,
t_getrectfn
gr
,
t_clickfn
cl
)
{
wb
->
w_getrectfn
=
gr
;
wb
->
w_displacefn
=
iemgui_displace
;
wb
->
w_selectfn
=
iemgui_select
;
wb
->
w_activatefn
=
NULL
;
wb
->
w_deletefn
=
iemgui_delete
;
wb
->
w_visfn
=
iemgui_vis
;
wb
->
w_clickfn
=
cl
;
wb
->
w_displacefnwtag
=
iemgui_displace_withtag
;
}
pd/src/g_all_guis.h
View file @
9bf986c8
...
...
@@ -84,7 +84,7 @@
#define IEM_GUI_DRAW_MODE_SELECT 3
#define IEM_GUI_DRAW_MODE_ERASE 4
#define IEM_GUI_DRAW_MODE_CONFIG 5
#define IEM_GUI_DRAW_MODE_IO 6
#define IEM_GUI_DRAW_MODE_IO 6
/* also reserves 7,8,9 by adding old_sr_flags */
#define IS_A_POINTER(atom,index) ((atom+index)->a_type == A_POINTER)
...
...
@@ -102,65 +102,39 @@
#define IEM_GUI_COLOR_EDITED 16711680
#define IEMGUI_MAX_NUM_LEN 32
#define SCALE_BNG_MINWIDTH 8
#define SCALE_BNG_MINHEIGHT 8
#define SCALE_CNV_MINWIDTH 1
#define SCALE_CNV_MINHEIGHT 1
#define SCALE_HRDO_MINWIDTH 8
#define SCALE_HRDO_MINHEIGHT 8
#define SCALE_HSLD_MINWIDTH 2
#define SCALE_HSLD_MINHEIGHT 8
#define SCALE_NUM_MINWIDTH 1
#define SCALE_NUM_MINHEIGHT 8
#define SCALE_TGL_MINWIDTH 8
#define SCALE_TGL_MINHEIGHT 8
#define SCALE_VRDO_MINWIDTH 8
#define SCALE_VRDO_MINHEIGHT 8
#define SCALE_VSLD_MINWIDTH 8
#define SCALE_VSLD_MINHEIGHT 2
#define SCALE_VU_MINWIDTH 8
#define SCALE_VU_MINHEIGHT 80
#define SCALE_GOP_MINWIDTH 12
#define SCALE_GOP_MINHEIGHT 12
#define SCALEHANDLE_WIDTH 5
#define SCALEHANDLE_HEIGHT 5
#define LABELHANDLE_WIDTH 5
#define LABELHANDLE_HEIGHT 5
typedef
struct
_iem_fstyle_flags
{
unsigned
int
x_font_style
:
6
;
unsigned
int
x_rcv_able
:
1
;
unsigned
int
x_snd_able
:
1
;
unsigned
int
x_lab_is_unique
:
1
;
unsigned
int
x_rcv_is_unique
:
1
;
unsigned
int
x_snd_is_unique
:
1
;
unsigned
int
x_lab_arg_tail_len
:
6
;
unsigned
int
x_lab_is_arg_num
:
6
;
unsigned
int
x_shiftdown
:
1
;
unsigned
int
x_selected
:
1
;
unsigned
int
x_finemoved
:
1
;
unsigned
int
x_put_in2out
:
1
;
unsigned
int
x_change
:
1
;
unsigned
int
x_thick
:
1
;
unsigned
int
x_lin0_log1
:
1
;
unsigned
int
x_steady
:
1
;
typedef
struct
_iem_fstyle_flags
// (15 used of 32)
{
// grep -w "$1" *.[ch]|wc -l (after refactor#5)
unsigned
int
x_font_style
:
6
;
// 56 matches
unsigned
int
x_rcv_able
:
1
;
// 59 matches
unsigned
int
x_snd_able
:
1
;
// 65 matches
unsigned
int
unused
:
16
;
unsigned
int
x_selected
:
1
;
// 38 matches
unsigned
int
x_finemoved
:
1
;
// 11 matches
unsigned
int
x_put_in2out
:
1
;
// 17 matches
unsigned
int
x_change
:
1
;
// 37 matches
unsigned
int
x_thick
:
1
;
// 14 matches
unsigned
int
x_lin0_log1
:
1
;
// 38 matches
unsigned
int
x_steady
:
1
;
// 18 matches
unsigned
int
dummy
:
1
;
}
t_iem_fstyle_flags
;
typedef
struct
_iem_init_symargs
typedef
struct
_iem_init_symargs
// (5 used of 32)
{
unsigned
int
x_loadinit
:
1
;
unsigned
int
x_rcv_arg_tail_len
:
6
;
unsigned
int
x_snd_arg_tail_len
:
6
;
unsigned
int
x_rcv_is_arg_num
:
6
;
unsigned
int
x_snd_is_arg_num
:
6
;
unsigned
int
x_scale
:
1
;
unsigned
int
x_flashed
:
1
;
unsigned
int
x_locked
:
1
;
unsigned
int
x_reverse
:
1
;
/* bugfix */
unsigned
int
x_loadinit
:
1
;
// 33 matches
unsigned
int
unused
:
24
;
unsigned
int
x_scale
:
1
;
// 22 matches
unsigned
int
x_flashed
:
1
;
// 16 matches
unsigned
int
x_locked
:
1
;
// 8 matches
unsigned
int
x_reverse
:
1
;
/* bugfix */
// 8 matches
unsigned
int
dummy
:
3
;
}
t_iem_init_symargs
;
...
...
@@ -422,3 +396,15 @@ EXTERN void scalehandle_drag_scale(t_scalehandle *h);
EXTERN
int
mini
(
int
a
,
int
b
);
EXTERN
int
maxi
(
int
a
,
int
b
);
// other refactor by Mathieu
EXTERN
void
iemgui_tag_selected
(
t_iemgui
*
x
,
t_glist
*
canvas
,
const
char
*
class_tag
);
EXTERN
void
iemgui_label_draw_new
(
t_iemgui
*
x
,
t_glist
*
canvas
,
int
xpos
,
int
ypos
,
const
char
*
nlet_tag
,
const
char
*
class_tag
);
EXTERN
void
iemgui_label_draw_move
(
t_iemgui
*
x
,
t_glist
*
canvas
,
int
xpos
,
int
ypos
);
EXTERN
void
iemgui_label_draw_config
(
t_iemgui
*
x
,
t_glist
*
canvas
);
EXTERN
void
iemgui_label_draw_select
(
t_iemgui
*
x
,
t_glist
*
canvas
);
EXTERN
void
iemgui_io_draw
(
t_iemgui
*
x
,
t_glist
*
canvas
,
int
old_sr_flags
,
const
char
*
class_tag
);
EXTERN
void
iemgui_draw_erase
(
t_iemgui
*
x
,
t_glist
*
glist
,
const
char
*
class_tag
);
EXTERN
void
wb_init
(
t_widgetbehavior
*
wb
,
t_getrectfn
gr
,
t_clickfn
cl
);
extern
t_symbol
*
s_empty
;
pd/src/g_bang.c
View file @
9bf986c8
...
...
@@ -45,11 +45,15 @@ void bng_draw_update(t_gobj *xgobj, t_glist *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
);
//vcanvas_itemconf(glist,x,"BUT","-fill",x->x_flashed?x->x_gui.x_fcol:x->x_gui.x_bcol);
}
x
->
x_gui
.
x_changed
=
x
->
x_flashed
;
}
}
void
bng_draw_io
(
t_bng
*
x
,
t_glist
*
glist
,
int
old_snd_rcv_flags
)
{
t_canvas
*
canvas
=
glist_getcanvas
(
glist
);
iemgui_io_draw
(
&
x
->
x_gui
,
canvas
,
old_snd_rcv_flags
,
"BNG"
);
}
void
bng_draw_new
(
t_bng
*
x
,
t_glist
*
glist
)
{
...
...
@@ -60,8 +64,6 @@ void bng_draw_new(t_bng *x, t_glist *glist)
scalehandle_draw_new
(
x
->
x_gui
.
x_handle
,
canvas
);
scalehandle_draw_new
(
x
->
x_gui
.
x_lhandle
,
canvas
);
//if (glist_isvisible(canvas)) {
char
*
nlet_tag
=
iem_get_tag
(
glist
,
(
t_iemgui
*
)
x
);
sys_vgui
(
".x%lx.c create prect %d %d %d %d "
...
...
@@ -77,32 +79,8 @@ void bng_draw_new(t_bng *x, t_glist *glist)
"-tags {%lxBUT %lxBNG text iemgui border %s}
\n
"
,
canvas
,
cx
,
cy
,
cr
,
x
->
x_flashed
?
x
->
x_gui
.
x_fcol
:
x
->
x_gui
.
x_bcol
,
x
,
x
,
nlet_tag
);
sys_vgui
(
".x%lx.c create text %d %d -text {%s} -anchor w "
"-font {{%s} -%d %s} -fill #%6.6x "
"-tags {%lxLABEL %lxBNG text iemgui %s}
\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
,
x
,
nlet_tag
);
if
(
!
x
->
x_gui
.
x_fsf
.
x_snd_able
&&
canvas
==
x
->
x_gui
.
x_glist
)
{
sys_vgui
(
".x%lx.c create prect %d %d %d %d "
"-stroke $pd_colors(iemgui_nlet) "
"-tags {%lxBNG%so%d %so%d %lxBNG outlet iemgui %s}
\n
"
,
canvas
,
xpos
,
ypos
+
x
->
x_gui
.
x_h
-
1
,
xpos
+
IOWIDTH
,
ypos
+
x
->
x_gui
.
x_h
,
x
,
nlet_tag
,
0
,
nlet_tag
,
0
,
x
,
nlet_tag
);
}
if
(
!
x
->
x_gui
.
x_fsf
.
x_rcv_able
&&
canvas
==
x
->
x_gui
.
x_glist
)
{
sys_vgui
(
".x%lx.c create prect %d %d %d %d "
"-stroke $pd_colors(iemgui_nlet) "
"-tags {%lxBNG%si%d %si%d %lxBNG inlet iemgui %s}
\n
"
,
canvas
,
xpos
,
ypos
,
xpos
+
IOWIDTH
,
ypos
+
1
,
x
,
nlet_tag
,
0
,
nlet_tag
,
0
,
x
,
nlet_tag
);
}
//}
iemgui_label_draw_new
(
&
x
->
x_gui
,
canvas
,
xpos
,
ypos
,
nlet_tag
,
"BNG"
);
bng_draw_io
(
x
,
glist
,
7
);
}
void
bng_draw_move
(
t_bng
*
x
,
t_glist
*
glist
)
...
...
@@ -132,8 +110,7 @@ void bng_draw_move(t_bng *x, t_glist *glist)
canvas
,
x
,
cx
,
cy
);
sys_vgui
(
".x%lx.c itemconfigure %lxBUT -fill #%6.6x -r %f
\n
"
,
canvas
,
x
,
x
->
x_flashed
?
x
->
x_gui
.
x_fcol
:
x
->
x_gui
.
x_bcol
,
cr
);
sys_vgui
(
".x%lx.c coords %lxLABEL %d %d
\n
"
,
canvas
,
x
,
xpos
+
x
->
x_gui
.
x_ldx
,
ypos
+
x
->
x_gui
.
x_ldy
);
iemgui_label_draw_move
(
&
x
->
x_gui
,
canvas
,
xpos
,
ypos
);
if
(
!
x
->
x_gui
.
x_fsf
.
x_snd_able
&&
canvas
==
x
->
x_gui
.
x_glist
)
sys_vgui
(
".x%lx.c coords %lxBNG%so%d %d %d %d %d
\n
"
,
canvas
,
x
,
nlet_tag
,
0
,
xpos
,
...
...
@@ -149,37 +126,10 @@ void bng_draw_move(t_bng *x, t_glist *glist)
}
}
void
bng_draw_erase
(
t_bng
*
x
,
t_glist
*
glist
)
{
t_canvas
*
canvas
=
glist_getcanvas
(
glist
);
sys_vgui
(
".x%lx.c delete %lxBNG
\n
"
,
canvas
,
x
);
sys_vgui
(
".x%lx.c dtag all %lxBNG
\n
"
,
canvas
,
x
);
scalehandle_draw_erase2
(
&
x
->
x_gui
,
glist
);
}
void
bng_draw_config
(
t_bng
*
x
,
t_glist
*
glist
)
{
t_canvas
*
canvas
=
glist_getcanvas
(
glist
);
/*
char color[64];
if (x->x_gui.x_fsf.x_selected)
sprintf(color, "$pd_colors(selection)");
else
sprintf(color, "#%6.6x", x->x_gui.x_lcol);
*/
if
(
x
->
x_gui
.
x_fsf
.
x_selected
&&
x
->
x_gui
.
x_glist
==
canvas
)
sys_vgui
(
".x%lx.c itemconfigure %lxLABEL -font {{%s} -%d %s} "
"-fill $pd_colors(selection) -text {%s}
\n
"
,
canvas
,
x
,
x
->
x_gui
.
x_font
,
x
->
x_gui
.
x_fontsize
,
sys_fontweight
,
strcmp
(
x
->
x_gui
.
x_lab
->
s_name
,
"empty"
)
?
x
->
x_gui
.
x_lab
->
s_name
:
""
);
else
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
:
""
);
iemgui_label_draw_config
(
&
x
->
x_gui
,
canvas
);
sys_vgui
(
".x%lx.c itemconfigure %lxBASE -fill #%6.6x
\n
"
".x%lx.c itemconfigure %lxBUT -fill #%6.6x
\n
"
,
canvas
,
x
,
x
->
x_gui
.
x_bcol
,
canvas
,
x
,
...
...
@@ -188,72 +138,29 @@ void bng_draw_config(t_bng* x, t_glist* glist)
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
(
glist_isvisible
(
canvas
)
&&
canvas
==
x
->
x_gui
.
x_glist
)
{
char
*
nlet_tag
=
iem_get_tag
(
glist
,
(
t_iemgui
*
)
x
);
if
((
old_snd_rcv_flags
&
IEM_GUI_OLD_SND_FLAG
)
&&
!
x
->
x_gui
.
x_fsf
.
x_snd_able
)
sys_vgui
(
".x%lx.c create prect %d %d %d %d "
"-stroke $pd_colors(iemgui_nlet) "
"-tags {%lxBNG%so%d %so%d %lxBNG outlet iemgui %s}
\n
"
,
canvas
,
xpos
,
ypos
+
x
->
x_gui
.
x_h
-
1
,
xpos
+
IOWIDTH
,
ypos
+
x
->
x_gui
.
x_h
,
x
,
nlet_tag
,
0
,
nlet_tag
,
0
,
x
,
nlet_tag
);
if
(
!
(
old_snd_rcv_flags
&
IEM_GUI_OLD_SND_FLAG
)
&&
x
->
x_gui
.
x_fsf
.
x_snd_able
)
sys_vgui
(
".x%lx.c delete %lxBNG%so%d
\n
"
,
canvas
,
x
,
nlet_tag
,
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 prect %d %d %d %d "
"-stroke $pd_colors(iemgui_nlet) "
"-tags {%lxBNG%si%d %si%d %lxBNG inlet iemgui %s}
\n
"
,
canvas
,
xpos
,
ypos
,
xpos
+
IOWIDTH
,
ypos
+
1
,
x
,
nlet_tag
,
0
,
nlet_tag
,
0
,
x
,
nlet_tag
);
if
(
!
(
old_snd_rcv_flags
&
IEM_GUI_OLD_RCV_FLAG
)
&&
x
->
x_gui
.
x_fsf
.
x_rcv_able
)
sys_vgui
(
".x%lx.c delete %lxBNG%si%d
\n
"
,
canvas
,
x
,
nlet_tag
,
0
);
}
}
void
bng_draw_select
(
t_bng
*
x
,
t_glist
*
glist
)
{
t_canvas
*
canvas
=
glist_getcanvas
(
glist
);
//if (glist_isvisible(canvas)) {
if
(
x
->
x_gui
.
x_fsf
.
x_selected
)
{
/* check if we are drawing inside a gop abstraction visible
on parent canvas -- if so, disable highlighting */
if
(
x
->
x_gui
.
x_glist
==
glist_getcanvas
(
glist
))
{
sys_vgui
(
".x%lx.c itemconfigure %lxBASE "
"-stroke $pd_colors(selection)
\n
"
,
canvas
,
x
);
sys_vgui
(
".x%lx.c itemconfigure %lxBUT "
"-stroke $pd_colors(selection)
\n
"
,
canvas
,
x
);
sys_vgui
(
".x%lx.c itemconfigure %lxLABEL "
"-fill $pd_colors(selection)
\n
"
,
canvas
,
x
);
sys_vgui
(
".x%lx.c itemconfigure {%lxBASE||%lxBUT} "
"-stroke $pd_colors(selection)
\n
"
,
canvas
,
x
,
x
);
scalehandle_draw_select2
(
&
x
->
x_gui
,
glist
,
"BNG"
,
x
->
x_gui
.
x_w
-
1
,
x
->
x_gui
.
x_h
-
1
);
}
sys_vgui
(
".x%lx.c addtag selected withtag %lxBNG
\n
"
,
canvas
,
x
);
}
else
{
sys_vgui
(
".x%lx.c itemconfigure %lxBASE -stroke %s
\n
"
,
canvas
,
x
,
IEM_GUI_COLOR_NORMAL
);
sys_vgui
(
".x%lx.c itemconfigure %lxBUT -stroke %s
\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
);
sys_vgui
(
".x%lx.c dtag %lxBNG selected
\n
"
,
canvas
,
x
);
sys_vgui
(
".x%lx.c itemconfigure {%lxBASE||%lxBUT} -stroke %s
\n
"
,
canvas
,
x
,
x
,
IEM_GUI_COLOR_NORMAL
);
scalehandle_draw_erase2
(
&
x
->
x_gui
,
glist
);
}
//}
iemgui_label_draw_select
(
&
x
->
x_gui
,
canvas
);
iemgui_tag_selected
(
&
x
->
x_gui
,
canvas
,
"BNG"
);
}
static
void
bng__clickhook
(
t_scalehandle
*
sh
,
t_floatarg
f
,
...
...
@@ -328,7 +235,7 @@ void bng_draw(t_bng *x, t_glist *glist, int mode)
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
);
iemgui
_draw_erase
(
&
x
->
x_gui
,
glist
,
"BNG"
);
else
if
(
mode
==
IEM_GUI_DRAW_MODE_CONFIG
)
bng_draw_config
(
x
,
glist
);
else
if
(
mode
>=
IEM_GUI_DRAW_MODE_IO
)
...
...
@@ -743,16 +650,11 @@ void g_bang_setup(void)
class_addmethod
(
scalehandle_class
,
(
t_method
)
bng__motionhook
,
gensym
(
"_motion"
),
A_FLOAT
,
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
;
bng_widgetbehavior
.
w_displacefnwtag
=
iemgui_displace_withtag
;
wb_init
(
&
bng_widgetbehavior
,
bng_getrect
,
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
);
s_empty
=
gensym
(
"empty"
);
}
pd/src/g_graph.c
View file @
9bf986c8
...
...
@@ -402,13 +402,13 @@ void glist_cleanup(t_glist *x)
freebytes
(
x
->
gl_ylabel
,
x
->
gl_nylabels
*
sizeof
(
*
(
x
->
gl_ylabel
)));
if
(
x
->
x_handle
)
{
pd_unbind
(
x
->
x_handle
,
((
t_scalehandle
*
)
x
->
x_handle
)
->
h_bindsym
);
pd_free
(
x
->
x_handle
);
pd_unbind
(
(
t_pd
*
)
x
->
x_handle
,
((
t_scalehandle
*
)
x
->
x_handle
)
->
h_bindsym
);
pd_free
(
(
t_pd
*
)
x
->
x_handle
);
}
if
(
x
->
x_mhandle
)
{
pd_unbind
(
x
->
x_mhandle
,
((
t_scalehandle
*
)
x
->
x_mhandle
)
->
h_bindsym
);
pd_free
(
x
->
x_mhandle
);
pd_unbind
(
(
t_pd
*
)
x
->
x_mhandle
,
((
t_scalehandle
*
)
x
->
x_mhandle
)
->
h_bindsym
);
pd_free
(
(
t_pd
*
)
x
->
x_mhandle
);
}
gstub_cutoff
(
x
->
gl_stub
);
}
...
...
pd/src/g_hdial.c
View file @
9bf986c8
...
...
@@ -54,7 +54,11 @@ void hradio_draw_update(t_gobj *client, t_glist *glist)
x
->
x_drawn
=
x
->
x_on
;
}
}
void
hradio_draw_io
(
t_hradio
*
x
,
t_glist
*
glist
,
int
old_snd_rcv_flags
)
{
t_canvas
*
canvas
=
glist_getcanvas
(
glist
);
iemgui_io_draw
(
&
x
->
x_gui
,
canvas
,
old_snd_rcv_flags
,
"HRDO"
);
}
void
hradio_draw_new
(
t_hradio
*
x
,
t_glist
*
glist
)
{
t_canvas
*
canvas
=
glist_getcanvas
(
glist
);
...
...
@@ -67,17 +71,15 @@ void hradio_draw_new(t_hradio *x, t_glist *glist)
scalehandle_draw_new
(
x
->
x_gui
.
x_handle
,
canvas
);
scalehandle_draw_new
(
x
->
x_gui
.
x_lhandle
,
canvas
);
//if (glist_isvisible(canvas)) {
char
*
nlet_tag
=
iem_get_tag
(
glist
,
(
t_iemgui
*
)
x
);
for
(
i
=
0
;
i
<
n
;
i
++
)
{
sys_vgui
(
".x%lx.c create prect %d %d %d %d "
"-stroke $pd_colors(iemgui_border) -fill #%6.6x "
"-tags {%lxBASE%d %lxHRDO %s text iemgui border}
\n
"
,
"-tags {%lxBASE%d
%lxBASE
%lxHRDO %s text iemgui border}
\n
"
,
canvas
,
xx11
,
yy11
,
xx11
+
dx
,
yy12
,
x
->
x_gui
.
x_bcol
,
x
,
i
,
x
,
nlet_tag
);
x
->
x_gui
.
x_bcol
,
x
,
i
,
x
,
x
,
nlet_tag
);
sys_vgui
(
".x%lx.c create prect %d %d %d %d -fill #%6.6x "
"-stroke #%6.6x -tags {%lxBUT%d %lxHRDO %s text iemgui}
\n
"
,
canvas
,
xx21
,
yy21
,
xx22
,
yy22
,
...
...
@@ -89,26 +91,8 @@ void hradio_draw_new(t_hradio *x, t_glist *glist)
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 %lxHRDO %s text iemgui}
\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
,
x
,
nlet_tag
);
if
(
!
x
->
x_gui
.
x_fsf
.
x_snd_able
&&
canvas
==
x
->
x_gui
.
x_glist
)
sys_vgui
(
".x%lx.c create prect %d %d %d %d "
"-stroke $pd_colors(iemgui_nlet) "
"-tags {%lxHRDO%so%d %so%d %lxHRDO %s outlet iemgui}
\n
"
,
canvas
,
xx11b
,
yy12
-
1
,
xx11b
+
IOWIDTH
,
yy12
,
x
,
nlet_tag
,
0
,
nlet_tag
,
0
,
x
,
nlet_tag
);
if
(
!
x
->
x_gui
.
x_fsf
.
x_rcv_able
&&
canvas
==
x
->
x_gui
.
x_glist
)
sys_vgui
(
".x%lx.c create prect %d %d %d %d "
"-stroke $pd_colors(iemgui_nlet) "
"-tags {%lxHRDO%si%d %si%d %lxHRDO %s inlet iemgui}
\n
"
,
canvas
,
xx11b
,
yy11
,
xx11b
+
IOWIDTH
,
yy11
+
1
,
x
,
nlet_tag
,
0
,
nlet_tag
,
0
,
x
,
nlet_tag
);
//}
iemgui_label_draw_new
(
&
x
->
x_gui
,
canvas
,
xx11b
,
yy11
,
nlet_tag
,
"HRDO"
);
hradio_draw_io
(
x
,
glist
,
7
);
}
void
hradio_draw_move
(
t_hradio
*
x
,
t_glist
*
glist
)
...
...
@@ -138,8 +122,7 @@ void hradio_draw_move(t_hradio *x, t_glist *glist)
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
);
iemgui_label_draw_move
(
&
x
->
x_gui
,
canvas
,
xx11b
,
yy11
);
if
(
!
x
->
x_gui
.
x_fsf
.
x_snd_able
&&
canvas
==
x
->
x_gui
.
x_glist
)
sys_vgui
(
".x%lx.c coords %lxHRDO%so%d %d %d %d %d
\n
"
,
canvas
,
x
,
nlet_tag
,
0
,
xx11b
,
yy12
-
1
,
xx11b
+
IOWIDTH
,
yy12
);
...
...
@@ -152,39 +135,11 @@ void hradio_draw_move(t_hradio *x, t_glist *glist)
}
}
void
hradio_draw_erase
(
t_hradio
*
x
,
t_glist
*
glist
)
{
t_canvas
*
canvas
=
glist_getcanvas
(
glist
);
sys_vgui
(
".x%lx.c delete %lxHRDO
\n
"
,
canvas
,
x
);
sys_vgui
(
".x%lx.c dtag all %lxHRDO
\n
"
,
canvas
,
x
);
scalehandle_draw_erase2
(
&
x
->
x_gui
,
glist
);
}
void
hradio_draw_config
(
t_hradio
*
x
,
t_glist
*
glist
)
{
t_canvas
*
canvas
=
glist_getcanvas
(
glist
);
int
n
=
x
->
x_number
,
i
;
/*
char color[64];
if (x->x_gui.x_fsf.x_selected)
sprintf(color, "$pd_colors(selection)");
else
sprintf(color, "#%6.6x", x->x_gui.x_lcol);
*/
if
(
x
->
x_gui
.
x_fsf
.
x_selected
&&
x
->
x_gui
.
x_glist
==
canvas
)
sys_vgui
(
".x%lx.c itemconfigure %lxLABEL -font {{%s} -%d %s} "
"-fill $pd_colors(selection) -text {%s}
\n
"
,
canvas
,
x
,
x
->
x_gui
.
x_font
,
x
->
x_gui
.
x_fontsize
,
sys_fontweight
,
strcmp
(
x
->
x_gui
.
x_lab
->
s_name
,
"empty"
)
?
x
->
x_gui
.
x_lab
->
s_name
:
""
);
else
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
:
""
);
iemgui_label_draw_config
(
&
x
->
x_gui
,
canvas
);
for
(
i
=
0
;
i
<
n
;
i
++
)
{
sys_vgui
(
".x%lx.c itemconfigure %lxBASE%d "
...
...
@@ -200,81 +155,29 @@ void hradio_draw_config(t_hradio* x, t_glist* glist)
}
}
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
(
glist_isvisible
(
canvas
)
&&
canvas
==
x
->
x_gui
.
x_glist
)
{
char
*
nlet_tag
=
iem_get_tag
(
glist
,
(
t_iemgui
*
)
x
);