Skip to content
GitLab
Projects
Groups
Snippets
/
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
1435e5d4
Commit
1435e5d4
authored
Aug 10, 2014
by
Mathieu L Bouchard
Browse files
big refactoring #7 : iemgui : simplified draw_new, draw_move, draw_update, ...
parent
087ffd6c
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
pd/src/g_all_guis.c
View file @
1435e5d4
...
...
@@ -709,17 +709,13 @@ int iemgui_dialog(t_iemgui *iemgui, t_symbol **srl, int argc, t_atom *argv)
void
iem_inttosymargs
(
t_iemgui
*
x
,
int
n
)
{
x
->
x_loadinit
=
(
n
>>
0
);
x
->
x_scale
=
(
n
>>
20
);
x
->
x_flashed
=
0
;
x
->
x_locked
=
0
;
x
->
x_reverse
=
0
;
}
int
iem_symargstoint
(
t_iemgui
*
x
)
{
return
(
(((
x
->
x_loadinit
&
1
)
<<
0
)
|
((
x
->
x_scale
&
1
)
<<
20
)));
return
((
x
->
x_loadinit
&
1
)
<<
0
);
}
void
iem_inttofstyle
(
t_iemgui
*
x
,
int
n
)
...
...
@@ -729,9 +725,6 @@ void iem_inttofstyle(t_iemgui *x, int n)
x
->
x_finemoved
=
0
;
x
->
x_put_in2out
=
0
;
x
->
x_change
=
0
;
x
->
x_thick
=
0
;
x
->
x_lin0_log1
=
0
;
x
->
x_steady
=
0
;
}
int
iem_fstyletoint
(
t_iemgui
*
x
)
...
...
@@ -779,7 +772,7 @@ void scalehandle_bind(t_scalehandle *h) {
// canvas has no label handle and has a motion handle
// but in the case of canvas, the "iemgui" tag is added (it wasn't the case originally)
void
scalehandle_draw_select
(
t_scalehandle
*
h
,
t_glist
*
canvas
,
int
px
,
int
py
,
const
char
*
nlet_tag
,
const
char
*
class_tag
)
{
const
char
*
nlet_tag
)
{
char
tags
[
128
];
// BNG may need up to 100 chars in 64-bit mode, for example
t_text
*
x
=
(
t_text
*
)
h
->
h_master
;
//if (!nlet_tag) nlet_tag = iem_get_tag(canvas, (t_iemgui *)x);
...
...
@@ -788,7 +781,7 @@ const char *nlet_tag, const char *class_tag) {
int
sx
=
h
->
h_scale
?
SCALEHANDLE_WIDTH
:
LABELHANDLE_WIDTH
;
int
sy
=
h
->
h_scale
?
SCALEHANDLE_HEIGHT
:
LABELHANDLE_HEIGHT
;
//printf("scalehandle_draw_select(x%lx,x%lx,%d,%d,\"%s\",\"%s\")\n",h,canvas,px,py,nlet_tag
,class_tag
);
//printf("scalehandle_draw_select(x%lx,x%lx,%d,%d,\"%s\",\"%s\")\n",h,canvas,px,py,nlet_tag);
if
(
h
->
h_vis
)
scalehandle_draw_erase
(
h
,
canvas
);
...
...
@@ -798,12 +791,12 @@ const char *nlet_tag, const char *class_tag) {
// there was a %lxBNG tag (or similar) in every scalehandle,
// but it didn't seem to be used —mathieu
if
(
h
->
h_scale
)
{
sprintf
(
tags
,
"%lx
%s
%lxSCALE iemgui %s"
,
(
long
)
x
,
class_tag
,
(
long
)
x
,
nlet_tag
);
sprintf
(
tags
,
"%lx
OBJ
%lxSCALE iemgui %s"
,
(
long
)
x
,(
long
)
x
,
nlet_tag
);
}
else
{
//sprintf(tags,"%lx%s %lxLABEL %lxLABELH iemgui %s", // causes unknown option "-fill"
sprintf
(
tags
,
"%lx
%s
%lx%s iemgui %s"
,
(
long
)
x
,
class_tag
,
(
long
)
x
,
strcmp
(
class_tag
,
"GOP"
)
?
"LABELH"
:
"MOVE
"
,
nlet_tag
);
sprintf
(
tags
,
"%lx
OBJ
%lx%s iemgui %s"
,
(
long
)
x
,
(
long
)
x
,
pd_class
((
t_pd
*
)
x
)
==
canvas_class
?
"MOVE"
:
"LABELH
"
,
nlet_tag
);
}
sys_vgui
(
".x%x.c create window %d %d -anchor nw -width %d -height %d "
"-window %s -tags {%s}
\n
"
,
canvas
,
x
->
te_xpix
+
px
-
sx
,
x
->
te_ypix
+
py
-
sy
,
...
...
@@ -812,12 +805,12 @@ const char *nlet_tag, const char *class_tag) {
h
->
h_vis
=
1
;
}
void
scalehandle_draw_select2
(
t_iemgui
*
x
,
t_glist
*
canvas
,
const
char
*
class_tag
,
int
sx
,
int
sy
)
{
void
scalehandle_draw_select2
(
t_iemgui
*
x
,
t_glist
*
canvas
,
int
sx
,
int
sy
)
{
char
*
nlet_tag
=
iem_get_tag
(
canvas
,
(
t_iemgui
*
)
x
);
scalehandle_draw_select
(
x
->
x_handle
,
canvas
,
sx
,
sy
,
nlet_tag
,
class_tag
);
scalehandle_draw_select
(
x
->
x_handle
,
canvas
,
sx
,
sy
,
nlet_tag
);
if
(
x
->
x_lab
!=
s_empty
)
{
scalehandle_draw_select
(
x
->
x_lhandle
,
canvas
,
x
->
x_ldx
,
x
->
x_ldy
,
nlet_tag
,
class_tag
);
scalehandle_draw_select
(
x
->
x_lhandle
,
canvas
,
x
->
x_ldx
,
x
->
x_ldy
,
nlet_tag
);
}
}
...
...
@@ -967,21 +960,21 @@ 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
)
{
void
iemgui_tag_selected
(
t_iemgui
*
x
,
t_glist
*
canvas
)
{
if
(
x
->
x_selected
)
sys_vgui
(
".x%lx.c addtag selected withtag %lx
%s
\n
"
,
canvas
,
x
,
class_tag
);
sys_vgui
(
".x%lx.c addtag selected withtag %lx
OBJ
\n
"
,
canvas
,
x
);
else
sys_vgui
(
".x%lx.c dtag %lx
%s
selected
\n
"
,
canvas
,
x
,
class_tag
);
sys_vgui
(
".x%lx.c dtag %lx
OBJ
selected
\n
"
,
canvas
,
x
);
}
void
iemgui_label_draw_new
(
t_iemgui
*
x
,
t_glist
*
canvas
,
int
xpos
,
int
ypos
,
const
char
*
nlet_tag
,
const
char
*
class_tag
)
{
void
iemgui_label_draw_new
(
t_iemgui
*
x
,
t_glist
*
canvas
,
int
xpos
,
int
ypos
,
const
char
*
nlet_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
"
,
"-tags {%lxLABEL %lx
OBJ
text iemgui %s}
\n
"
,
canvas
,
xpos
+
x
->
x_ldx
,
ypos
+
x
->
x_ldy
,
x
->
x_lab
!=
s_empty
?
x
->
x_lab
->
s_name
:
""
,
iemgui_font
(
x
),
x
->
x_fontsize
,
sys_fontweight
,
x
->
x_lcol
,
x
,
x
,
class_tag
,
nlet_tag
);
x
->
x_lcol
,
x
,
x
,
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
"
,
...
...
@@ -1008,7 +1001,9 @@ void iemgui_label_draw_select(t_iemgui *x, t_glist *canvas) {
canvas
,
x
,
x
->
x_lcol
);
}
void
iemgui_io_draw
(
t_iemgui
*
x
,
t_glist
*
canvas
,
int
old_sr_flags
,
const
char
*
class_tag
)
{
extern
t_class
*
vu_class
;
void
iemgui_io_draw
(
t_iemgui
*
x
,
t_glist
*
canvas
,
int
old_sr_flags
)
{
if
(
x
->
x_glist
!=
canvas
)
return
;
// is gop
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);
...
...
@@ -1022,45 +1017,85 @@ void iemgui_io_draw(t_iemgui *x, t_glist *canvas, int old_sr_flags, const char *
int
x1
,
y1
,
x2
,
y2
;
c
->
c_wb
->
w_getrectfn
((
t_gobj
*
)
x
,
canvas
,
&
x1
,
&
y1
,
&
x2
,
&
y2
);
int
i
,
n
=
c
==
vu_class
?
2
:
1
,
k
=
(
x2
-
x1
)
-
IOWIDTH
;
a
=
old_sr_flags
&
IEM_GUI_OLD_SND_FLAG
;
//b=iemgui_has_snd(x); // 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),
if
(
a
&&
!
b
)
for
(
i
=
0
;
i
<
n
;
i
++
)
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
);
"-tags {%lxOBJ%so%d %so%d %lxOBJ outlet iemgui %s}
\n
"
,
canvas
,
x1
+
i
*
k
,
y2
-
1
,
x1
+
i
*
k
+
IOWIDTH
,
y2
,
x
,
nlet_tag
,
i
,
nlet_tag
,
i
,
x
,
nlet_tag
);
if
(
!
a
&&
b
)
for
(
i
=
0
;
i
<
n
;
i
++
)
sys_vgui
(
".x%lx.c delete %lxOBJ%so%d
\n
"
,
canvas
,
x
,
nlet_tag
,
0
);
a
=
old_sr_flags
&
IEM_GUI_OLD_RCV_FLAG
;
//b=iemgui_has_rcv(x); // 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),
if
(
a
&&
!
b
)
for
(
i
=
0
;
i
<
n
;
i
++
)
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
);
"-tags {%lxOBJ%si%d %si%d %lxOBJ inlet iemgui %s}
\n
"
,
canvas
,
x1
+
i
*
k
,
y1
,
x1
+
i
*
k
+
IOWIDTH
,
y1
+
1
,
x
,
nlet_tag
,
i
,
nlet_tag
,
i
,
x
,
nlet_tag
);
if
(
!
a
&&
b
)
for
(
i
=
0
;
i
<
n
;
i
++
)
sys_vgui
(
".x%lx.c delete %lxOBJ%si%d
\n
"
,
canvas
,
x
,
nlet_tag
,
0
);
//printf("---/iemgui_io_draw\n");
}
void
iemgui_draw_erase
(
t_iemgui
*
x
,
t_glist
*
glist
,
const
char
*
class_tag
)
{
void
iemgui_io_draw_move
(
t_iemgui
*
x
,
t_glist
*
canvas
,
const
char
*
nlet_tag
)
{
t_class
*
c
=
pd_class
((
t_pd
*
)
x
);
int
x1
,
y1
,
x2
,
y2
;
c
->
c_wb
->
w_getrectfn
((
t_gobj
*
)
x
,
canvas
,
&
x1
,
&
y1
,
&
x2
,
&
y2
);
int
i
,
n
=
c
==
vu_class
?
2
:
1
,
k
=
(
x2
-
x1
)
-
IOWIDTH
;
if
(
!
iemgui_has_snd
(
x
)
&&
canvas
==
x
->
x_glist
)
for
(
i
=
0
;
i
<
n
;
i
++
)
sys_vgui
(
".x%lx.c coords %lxOBJ%so%d %d %d %d %d
\n
"
,
canvas
,
x
,
nlet_tag
,
i
,
x1
+
i
*
k
,
y2
-
1
,
x1
+
i
*
k
+
IOWIDTH
,
y2
);
if
(
!
iemgui_has_rcv
(
x
)
&&
canvas
==
x
->
x_glist
)
for
(
i
=
0
;
i
<
n
;
i
++
)
sys_vgui
(
".x%lx.c coords %lxOBJ%si%d %d %d %d %d
\n
"
,
canvas
,
x
,
nlet_tag
,
i
,
x1
+
i
*
k
,
y1
,
x1
+
i
*
k
+
IOWIDTH
,
y1
+
1
);
}
void
iemgui_base_draw_new
(
t_iemgui
*
x
,
t_glist
*
canvas
,
const
char
*
nlet_tag
)
{
t_class
*
c
=
pd_class
((
t_pd
*
)
x
);
int
x1
,
y1
,
x2
,
y2
;
c
->
c_wb
->
w_getrectfn
((
t_gobj
*
)
x
,
x
->
x_glist
,
&
x1
,
&
y1
,
&
x2
,
&
y2
);
sys_vgui
(
".x%lx.c create prect %d %d %d %d "
"-stroke $pd_colors(iemgui_border) -fill #%6.6x "
"-tags {%lxBASE %lxOBJ text iemgui border %s}
\n
"
,
canvas
,
x1
,
y1
,
x2
,
y2
,
x
->
x_bcol
,
x
,
x
,
nlet_tag
);
}
void
iemgui_base_draw_move
(
t_iemgui
*
x
,
t_glist
*
canvas
,
const
char
*
nlet_tag
)
{
t_class
*
c
=
pd_class
((
t_pd
*
)
x
);
int
x1
,
y1
,
x2
,
y2
;
c
->
c_wb
->
w_getrectfn
((
t_gobj
*
)
x
,
x
->
x_glist
,
&
x1
,
&
y1
,
&
x2
,
&
y2
);
sys_vgui
(
".x%lx.c coords %lxBASE %d %d %d %d
\n
"
,
canvas
,
x
,
x1
,
y1
,
x2
,
y2
);
}
void
iemgui_base_draw_config
(
t_iemgui
*
x
,
t_glist
*
canvas
)
{
char
fcol
[
8
];
sprintf
(
fcol
,
"#%6.6x"
,
x
->
x_fcol
);
sys_vgui
(
".x%lx.c itemconfigure %lxBASE -fill #%6.6x
\n
"
,
canvas
,
x
,
x
->
x_bcol
);
sys_vgui
(
".x%lx.c itemconfigure {%lxBASE||%lxBASEL} -stroke %s
\n
"
,
canvas
,
x
,
x
,
x
->
x_selected
&&
x
->
x_glist
==
canvas
?
selection_color
:
fcol
);
}
void
iemgui_draw_erase
(
t_iemgui
*
x
,
t_glist
*
glist
)
{
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
);
sys_vgui
(
".x%lx.c delete %lx
OBJ
\n
"
,
canvas
,
x
);
sys_vgui
(
".x%lx.c dtag all %lx
OBJ
\n
"
,
canvas
,
x
);
scalehandle_draw_erase2
(
x
,
glist
);
}
void
scrollbar_update
(
t_glist
*
glist
)
{
//ico@bukvic.net 100518 update scrollbars when object potentially
//exceeds window size
t_canvas
*
canvas
=
(
t_canvas
*
)
glist_getcanvas
(
glist
);
sys_vgui
(
"pdtk_canvas_getscroll .x%lx.c
\n
"
,
(
long
unsigned
int
)
canvas
);
}
void
wb_init
(
t_widgetbehavior
*
wb
,
t_getrectfn
gr
,
t_clickfn
cl
)
{
wb
->
w_getrectfn
=
gr
;
wb
->
w_displacefn
=
iemgui_displace
;
...
...
@@ -1102,3 +1137,6 @@ void iemgui_class_addmethods(t_class *c) {
void
g_iemgui_setup
(
void
)
{
s_empty
=
gensym
(
"empty"
);
}
const
char
*
selection_color
=
"$pd_colors(selection)"
;
pd/src/g_all_guis.h
View file @
1435e5d4
...
...
@@ -153,18 +153,15 @@ typedef struct _iemgui
// from t_iem_fstyle_flags
unsigned
int
x_font_style
:
6
;
// 39 matches
unsigned
int
x_selected
:
1
;
// 38 matches
unsigned
int
x_finemoved
:
1
;
// 11 matches
unsigned
int
x_finemoved
:
1
;
// 11 matches
(sliders and [nbx] only)
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
x_change
:
1
;
// 37 matches // what's this and why is there also a x_changed ?
unsigned
int
dummy2
:
3
;
// from t_iem_init_symargs
unsigned
int
x_loadinit
:
1
;
// 33 matches
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
dummy3
:
2
;
unsigned
int
x_locked
:
1
;
// 8 matches ([bng] only)
unsigned
int
x_reverse
:
1
;
// 8 matches (sliders only)
unsigned
int
dummy
:
14
;
}
t_iemgui
;
...
...
@@ -184,7 +181,7 @@ typedef struct _hslider
t_iemgui
x_gui
;
int
x_pos
;
int
x_val
;
int
x_center
;
int
x_center
;
// is this necessary ?
int
x_thick
;
int
x_lin0_log1
;
int
x_steady
;
...
...
@@ -324,8 +321,8 @@ EXTERN void canvas_apply_setundo(t_canvas *x, t_gobj *y);
// scalehandle code, as refactored by Mathieu
EXTERN
void
scalehandle_bind
(
t_scalehandle
*
h
);
EXTERN
void
scalehandle_draw_select
(
t_scalehandle
*
h
,
t_glist
*
canvas
,
int
px
,
int
py
,
const
char
*
nlet_tag
,
const
char
*
class_tag
);
EXTERN
void
scalehandle_draw_select2
(
t_iemgui
*
x
,
t_glist
*
canvas
,
const
char
*
class_tag
,
int
sx
,
int
sy
);
EXTERN
void
scalehandle_draw_select
(
t_scalehandle
*
h
,
t_glist
*
canvas
,
int
px
,
int
py
,
const
char
*
nlet_tag
);
EXTERN
void
scalehandle_draw_select2
(
t_iemgui
*
x
,
t_glist
*
canvas
,
int
sx
,
int
sy
);
EXTERN
void
scalehandle_draw_erase
(
t_scalehandle
*
h
,
t_glist
*
canvas
);
EXTERN
void
scalehandle_draw_erase2
(
t_iemgui
*
x
,
t_glist
*
canvas
);
EXTERN
void
scalehandle_draw_new
(
t_scalehandle
*
x
,
t_glist
*
canvas
);
...
...
@@ -343,17 +340,22 @@ 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_tag_selected
(
t_iemgui
*
x
,
t_glist
*
canvas
);
EXTERN
void
iemgui_label_draw_new
(
t_iemgui
*
x
,
t_glist
*
canvas
,
int
xpos
,
int
ypos
,
const
char
*
nlet_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
iemgui_io_draw
(
t_iemgui
*
x
,
t_glist
*
canvas
,
int
old_sr_flags
);
EXTERN
void
iemgui_io_draw_move
(
t_iemgui
*
x
,
t_glist
*
canvas
,
const
char
*
nlet_tag
);
EXTERN
void
iemgui_base_draw_new
(
t_iemgui
*
x
,
t_glist
*
canvas
,
const
char
*
nlet_tag
);
EXTERN
void
iemgui_base_draw_move
(
t_iemgui
*
x
,
t_glist
*
canvas
,
const
char
*
nlet_tag
);
EXTERN
void
iemgui_base_draw_config
(
t_iemgui
*
x
,
t_glist
*
canvas
);
EXTERN
void
wb_init
(
t_widgetbehavior
*
wb
,
t_getrectfn
gr
,
t_clickfn
cl
);
EXTERN
void
iemgui_draw_erase
(
t_iemgui
*
x
,
t_glist
*
glist
);
EXTERN
void
wb_init
(
t_widgetbehavior
*
wb
,
t_getrectfn
gr
,
t_clickfn
cl
);
// rename this to iemgui_wb_init
extern
t_symbol
*
s_empty
;
EXTERN
const
char
*
selection_color
;
//static inline int iemgui_has_snd (t_iemgui *x) {return x->x_snd_unexpanded!=s_empty;}
//static inline int iemgui_has_rcv (t_iemgui *x) {return x->x_rcv_unexpanded!=s_empty;}
...
...
@@ -362,4 +364,7 @@ static inline int iemgui_has_rcv (t_iemgui *x) {return x->x_rcv!=s_empty;}
EXTERN
const
char
*
iemgui_font
(
t_iemgui
*
x
);
EXTERN
void
iemgui_class_addmethods
(
t_class
*
c
);
EXTERN
void
scrollbar_update
(
t_glist
*
glist
);
pd/src/g_bang.c
View file @
1435e5d4
...
...
@@ -38,21 +38,19 @@ static t_class *bng_class;
void
bng_draw_update
(
t_gobj
*
xgobj
,
t_glist
*
glist
)
{
t_bng
*
x
=
(
t_bng
*
)
xgobj
;
if
(
x
->
x_gui
.
x_changed
!=
x
->
x_flashed
)
if
(
x
->
x_gui
.
x_changed
!=
x
->
x_flashed
&&
glist_isvisible
(
glist
))
{
if
(
glist_isvisible
(
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
);
}
x
->
x_gui
.
x_changed
=
x
->
x_flashed
;
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
);
}
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"
);
iemgui_io_draw
(
&
x
->
x_gui
,
canvas
,
old_snd_rcv_flags
);
}
void
bng_draw_new
(
t_bng
*
x
,
t_glist
*
glist
)
...
...
@@ -66,101 +64,72 @@ void bng_draw_new(t_bng *x, t_glist *glist)
char
*
nlet_tag
=
iem_get_tag
(
glist
,
(
t_iemgui
*
)
x
);
sys_vgui
(
".x%lx.c create prect %d %d %d %d "
"-stroke $pd_colors(iemgui_border) -fill #%6.6x "
"-tags {%lxBASE %lxBNG text iemgui border %s}
\n
"
,
canvas
,
xpos
,
ypos
,
xpos
+
x
->
x_gui
.
x_w
,
ypos
+
x
->
x_gui
.
x_h
,
x
->
x_gui
.
x_bcol
,
x
,
x
,
nlet_tag
);
iemgui_base_draw_new
(
&
x
->
x_gui
,
canvas
,
nlet_tag
);
t_float
cr
=
(
x
->
x_gui
.
x_w
-
2
)
/
2
.
0
;
t_float
cx
=
xpos
+
cr
+
1
.
5
;
t_float
cy
=
ypos
+
cr
+
1
.
5
;
sys_vgui
(
".x%lx.c create circle %f %f -r %f "
"-stroke $pd_colors(iemgui_border) -fill #%6.6x "
"-tags {%lxBUT %lx
BNG
text iemgui border %s}
\n
"
,
"-tags {%lxBUT %lx
OBJ
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
);
iemgui_label_draw_new
(
&
x
->
x_gui
,
canvas
,
xpos
,
ypos
,
nlet_tag
,
"BNG"
);
iemgui_label_draw_new
(
&
x
->
x_gui
,
canvas
,
xpos
,
ypos
,
nlet_tag
);
bng_draw_io
(
x
,
glist
,
7
);
}
void
bng_draw_move
(
t_bng
*
x
,
t_glist
*
glist
)
{
t_canvas
*
canvas
=
glist_getcanvas
(
glist
);
if
(
!
glist_isvisible
(
canvas
))
return
;
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
))
{
char
*
nlet_tag
=
iem_get_tag
(
glist
,
(
t_iemgui
*
)
x
);
sys_vgui
(
".x%lx.c coords %lxBASE %d %d %d %d
\n
"
,
canvas
,
x
,
xpos
,
ypos
,
xpos
+
x
->
x_gui
.
x_w
,
ypos
+
x
->
x_gui
.
x_h
);
t_float
cr
=
(
x
->
x_gui
.
x_w
-
2
)
/
2
.
0
;
t_float
cx
=
xpos
+
cr
+
1
.
5
;
t_float
cy
=
ypos
+
cr
+
1
.
5
;
/*sys_vgui(".x%lx.c create circle %d %d -r %d "
"-stroke #%6.6x "
"-tags {%lxBUT %lxBNG %lx text iemgui}\n",
canvas, cx, cy, cr,*/
sys_vgui
(
".x%lx.c coords %lxBUT %f %f
\n
"
,
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
);
iemgui_label_draw_move
(
&
x
->
x_gui
,
canvas
,
xpos
,
ypos
);
if
(
!
iemgui_has_snd
(
&
x
->
x_gui
)
&&
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
,
ypos
+
x
->
x_gui
.
x_h
-
1
,
xpos
+
IOWIDTH
,
ypos
+
x
->
x_gui
.
x_h
);
if
(
!
iemgui_has_rcv
(
&
x
->
x_gui
)
&&
canvas
==
x
->
x_gui
.
x_glist
)
sys_vgui
(
".x%lx.c coords %lxBNG%si%d %d %d %d %d
\n
"
,
canvas
,
x
,
nlet_tag
,
0
,
xpos
,
ypos
,
xpos
+
IOWIDTH
,
ypos
+
1
);
/* redraw scale handle rectangle if selected */
if
(
x
->
x_gui
.
x_selected
)
bng_draw_select
(
x
,
x
->
x_gui
.
x_glist
);
}
char
*
nlet_tag
=
iem_get_tag
(
glist
,
(
t_iemgui
*
)
x
);
iemgui_base_draw_move
(
&
x
->
x_gui
,
canvas
,
nlet_tag
);
t_float
cr
=
(
x
->
x_gui
.
x_w
-
2
)
/
2
.
0
;
t_float
cx
=
xpos
+
cr
+
1
.
5
;
t_float
cy
=
ypos
+
cr
+
1
.
5
;
sys_vgui
(
".x%lx.c coords %lxBUT %f %f
\n
"
,
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
);
iemgui_label_draw_move
(
&
x
->
x_gui
,
canvas
,
xpos
,
ypos
);
iemgui_io_draw_move
(
&
x
->
x_gui
,
canvas
,
nlet_tag
);
if
(
x
->
x_gui
.
x_selected
)
bng_draw_select
(
x
,
x
->
x_gui
.
x_glist
);
}
void
bng_draw_config
(
t_bng
*
x
,
t_glist
*
glist
)
{
t_canvas
*
canvas
=
glist_getcanvas
(
glist
);
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
,
x
->
x_flashed
?
x
->
x_gui
.
x_fcol
:
x
->
x_gui
.
x_bcol
);
/*sys_vgui(".x%lx.c itemconfigure %lxBUT -fill #%6.6x\n", canvas, x,
x->x_flashed?x->x_gui.x_fcol:x->x_gui.x_bcol);*/
iemgui_base_draw_config
(
&
x
->
x_gui
,
canvas
);
sys_vgui
(
".x%lx.c itemconfigure %lxBUT -fill #%6.6x
\n
"
,
canvas
,
x
,
x
->
x_flashed
?
x
->
x_gui
.
x_fcol
:
x
->
x_gui
.
x_bcol
);
}
void
bng_draw_select
(
t_bng
*
x
,
t_glist
*
glist
)
{
t_canvas
*
canvas
=
glist_getcanvas
(
glist
);
iemgui_base_draw_config
(
&
x
->
x_gui
,
canvas
);
if
(
x
->
x_gui
.
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||
%lxBUT
}
"
"-stroke $pd_colors(selection)
\n
"
,
canvas
,
x
,
x
);
scalehandle_draw_select2
(
&
x
->
x_gui
,
glist
,
"BNG"
,
sys_vgui
(
".x%lx.c itemconfigure %lxBUT "
"-stroke $pd_colors(selection)
\n
"
,
canvas
,
x
);
scalehandle_draw_select2
(
&
x
->
x_gui
,
glist
,
x
->
x_gui
.
x_w
-
1
,
x
->
x_gui
.
x_h
-
1
);
}
}
else
{
sys_vgui
(
".x%lx.c itemconfigure
{%lxBASE||
%lxBUT
}
-stroke %s
\n
"
,
canvas
,
x
,
x
,
IEM_GUI_COLOR_NORMAL
);
sys_vgui
(
".x%lx.c itemconfigure %lxBUT -stroke %s
\n
"
,
canvas
,
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"
);
iemgui_tag_selected
(
&
x
->
x_gui
,
canvas
);
}
static
void
bng__clickhook
(
t_scalehandle
*
sh
,
t_floatarg
f
,
...
...
@@ -235,7 +204,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
)
iemgui_draw_erase
(
&
x
->
x_gui
,
glist
,
"BNG"
);
iemgui_draw_erase
(
&
x
->
x_gui
,
glist
);
else
if
(
mode
==
IEM_GUI_DRAW_MODE_CONFIG
)
bng_draw_config
(
x
,
glist
);
else
if
(
mode
>=
IEM_GUI_DRAW_MODE_IO
)
...
...
@@ -404,11 +373,7 @@ static void bng_dialog(t_bng *x, t_symbol *s, int argc, t_atom *argv)
{
bng_draw_select
(
x
,
x
->
x_gui
.
x_glist
);
}
//ico@bukvic.net 100518 update scrollbars when object potentially
//exceeds window size
t_canvas
*
canvas
=
(
t_canvas
*
)
glist_getcanvas
(
x
->
x_gui
.
x_glist
);
sys_vgui
(
"pdtk_canvas_getscroll .x%lx.c
\n
"
,
(
long
unsigned
int
)
canvas
);
scrollbar_update
(
x
->
x_gui
.
x_glist
);
}
static
void
bng_click
(
t_bng
*
x
,
t_floatarg
xpos
,
t_floatarg
ypos
,
...
...
pd/src/g_canvas.c
View file @
1435e5d4
...
...
@@ -537,7 +537,7 @@ t_glist *glist_addglist(t_glist *g, t_symbol *sym,
if
(
!
menu
)
pd_pushsym
(
&
x
->
gl_pd
);
glist_add
(
g
,
&
x
->
gl_gobj
);
if
(
!
do_not_redraw
)
s
ys_vgui
(
"pdtk_canvas_getscroll .x%lx.c
\n
"
,
(
long
unsigned
int
)
glist_getcanvas
(
g
));
if
(
!
do_not_redraw
)
s
crollbar_update
(
glist_getcanvas
(
g
));
//fprintf(stderr," ... %f %f\n", x->gl_x1, x->gl_x2);
return
(
x
);
}
...
...
@@ -711,11 +711,11 @@ void canvas_draw_gop_resize_hooks(t_canvas* x)
scalehandle_draw_select
(
sh
,
x
,
-
1
-
x
->
gl_obj
.
te_xpix
+
x
->
gl_xmargin
+
x
->
gl_pixwidth
,
-
1
-
x
->
gl_obj
.
te_ypix
+
x
->
gl_ymargin
+
x
->
gl_pixheight
,
"GOP_resblob"
,
"GOP"
);
"GOP_resblob"
);
scalehandle_draw_select
(
mh
,
x
,
2
+
SCALEHANDLE_WIDTH
-
x
->
gl_obj
.
te_xpix
+
x
->
gl_xmargin
,
2
+
SCALEHANDLE_HEIGHT
-
x
->
gl_obj
.
te_ypix
+
x
->
gl_ymargin
,
"GOP_movblob"
,
"GOP"
);
"GOP_movblob"
);
}
else
{
...
...
@@ -773,7 +773,7 @@ void canvas_map(t_canvas *x, t_floatarg f)
canvas_drawlines
(
x
);
if
(
x
->
gl_isgraph
&&
x
->
gl_goprect
)
canvas_drawredrect
(
x
,
1
);
s
ys_vgui
(
"pdtk_canvas_getscroll .x%lx.c
\n
"
,
x
);
s
crollbar_update
(
x
);
//}
}
else
...
...
@@ -1907,9 +1907,9 @@ void canvasgop_draw_move(t_canvas *x, int doit)
canvas
=
canvas
->
gl_owner
;
//canvas_redraw(canvas);
}
s
ys_vgui
(
"pdtk_canvas_getscroll .x%lx.c
\n
"
,
(
t_int
)
x
);
s
crollbar_update
(
x
);
if
(
x
->
gl_owner
&&
glist_isvisible
(
x
->
gl_owner
))
s
ys_vgui
(
"pdtk_canvas_getscroll .x%lx.c
\n
"
,
(
t_int
)
x
->
gl_owner
);
s
crollbar_update
(
x
->
gl_owner
);
}
extern
int
gfxstub_haveproperties
(
void
*
key
);
...
...
@@ -1968,7 +1968,7 @@ void canvasgop__clickhook(t_scalehandle *sh, t_floatarg f, t_floatarg xxx, t_flo
sys_vgui
(
".x%x.c delete %s
\n
"
,
x
,
sh
->
h_outlinetag
);
canvasgop_draw_move
(
x
,
1
);
canvas_fixlinesfor
(
x
,
(
t_text
*
)
x
);
s
ys_vgui
(
"pdtk_canvas_getscroll .x%lx.c
\n
"
,
x
);
s
crollbar_update
(
x
);
}
}
else
//enter if move_gop hook
...
...
@@ -1984,7 +1984,7 @@ void canvasgop__clickhook(t_scalehandle *sh, t_floatarg f, t_floatarg xxx, t_flo
{
canvasgop_draw_move
(
x
,
1
);
canvas_fixlinesfor
(
x
,
(
t_text
*
)
x
);
s
ys_vgui
(
"pdtk_canvas_getscroll .x%lx.c
\n
"
,
x
);
s
crollbar_update
(
x
);
}
}
}
...
...
pd/src/g_editor.c
View file @
1435e5d4
...
...
@@ -785,7 +785,7 @@ static void canvas_undo(t_canvas *x)
if
(
glist_isvisible
(
x
)
&&
glist_istoplevel
(
x
))
sys_vgui
(
"pdtk_undomenu .x%lx no %s
\n
"
,
x
,
canvas_undo_name
);
canvas_undo_whatnext
=
UNDO_REDO
;
s
ys_vgui
(
"pdtk_canvas_getscroll .x%lx.c
\n
"
,
x
);
s
crollbar_update
(
x
);
}
}
...
...
@@ -804,7 +804,7 @@ static void canvas_redo(t_canvas *x)
if
(
glist_isvisible
(
x
)
&&
glist_istoplevel
(
x
))
sys_vgui
(
"pdtk_undomenu .x%lx %s no
\n
"
,
x
,
canvas_undo_name
);
canvas_undo_whatnext
=
UNDO_UNDO
;
s
ys_vgui
(
"pdtk_canvas_getscroll .x%lx.c
\n
"
,
x
);
s
crollbar_update
(
x
);
}
}
...
...
@@ -1893,9 +1893,8 @@ void canvas_undo_canvas_apply(t_canvas *x, void *z, int action)
properties, x->gl_ymargin);
}*/
sys_vgui
(
"pdtk_canvas_getscroll .x%lx.c
\n
"
,
(
t_int
)
x
);
if
(
canvas
!=
x
)
sys_vgui
(
"pdtk_canvas_getscroll .x%lx.c
\n
"
,
(
t_int
)
canvas
);
scrollbar_update
(
x
);
if
(
canvas
!=
x
)
scrollbar_update
(
canvas
);
}
else
if
(
action
==
UNDO_FREE
)
...
...
@@ -2425,7 +2424,7 @@ void canvas_vis(t_canvas *x, t_floatarg f)
//if (g && (pd_class(&g->g_pd) == garray_class)
// sys_vgui("pdtk_canvas_set_scrollless .x%lx\n", x);
//else
s
ys_vgui
(
"pdtk_canvas_getscroll .x%lx.c
\n
"
,
x
);
s
crollbar_update
(
x
);
/*
//newly opened arrays created prior to pd-l2ork require fittograph
...
...
@@ -2496,7 +2495,7 @@ void canvas_vis(t_canvas *x, t_floatarg f)
canvas_destroy_editor
(
x
);
return
;
}
s
ys_vgui
(
"pdtk_canvas_getscroll .x%lx.c
\n
"
,
x
);
s
crollbar_update
(
x
);
glist_noselect
(
x
);
if
(
glist_isvisible
(
x
))