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
7f7328df
Commit
7f7328df
authored
Aug 05, 2014
by
Mathieu L Bouchard
Browse files
3rd refactor of scalehandle (and bugfix of scalehandle interaction with property dialogues)
parent
6a613a0a
Changes
12
Hide whitespace changes
Inline
Side-by-side
pd/src/g_all_guis.c
View file @
7f7328df
...
...
@@ -908,25 +908,24 @@ void scalehandle_bind(t_scalehandle *h) {
}
// in 18 cases only, because canvas does not fit the pattern below.
// this works only on iemgui, and also, canvas has no label handle and has a motion handle
// 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
)
{
char
tags
[
128
];
// BNG may need up to 100 chars in 64-bit mode, for example
t_
iemgui
*
x
=
(
t_
iemgui
*
)
h
->
h_master
;
t_
text
*
x
=
(
t_
text
*
)
h
->
h_master
;
//if (!nlet_tag) nlet_tag = iem_get_tag(canvas, (t_iemgui *)x);
const
char
*
cursor
=
h
->
h_scale
?
"bottom_right_corner"
:
"crosshair"
;
int
sx
=
h
->
h_scale
?
SCALEHANDLE_WIDTH
:
LABELHANDLE_WIDTH
;
int
sy
=
h
->
h_scale
?
SCALEHANDLE_HEIGHT
:
LABELHANDLE_HEIGHT
;
//int px = h->h_scale ? (x->x_gui.x_w-1) : x->x_gui.x_ldx;
//int py = h->h_scale ? (x->x_gui.x_h-1) : x->x_gui.x_ldy;
//printf("scalehandle_draw_select(x%lx,x%lx,%d,%d,\"%s\",\"%s\")\n",h,canvas,px,py,nlet_tag,class_tag);
if
(
h
->
h_vis
)
scalehandle_draw_erase
(
h
,
canvas
);
sys_vgui
(
"canvas %s -width %d -height %d -bg $pd_colors(selection) -bd 0 "
//
sys_vgui("canvas %s -width %d -height %d -bg #0080ff -bd 0 "
//
sys_vgui("canvas %s -width %d -height %d -bg $pd_colors(selection) -bd 0 "
sys_vgui
(
"canvas %s -width %d -height %d -bg #0080ff -bd 0 "
"-cursor %s
\n
"
,
h
->
h_pathname
,
sx
,
sy
,
cursor
);
// there was a %lxBNG tag (or similar) in every scalehandle,
// but it didn't seem to be used —mathieu
...
...
@@ -935,11 +934,11 @@ const char *nlet_tag, const char *class_tag) {
(
long
)
x
,
class_tag
,(
long
)
x
,
nlet_tag
);
}
else
{
//sprintf(tags,"%lx%s %lxLABEL %lxLABELH iemgui %s", // causes unknown option "-fill"
sprintf
(
tags
,
"%lx%s %lx
LABELH
iemgui %s"
,
(
long
)
x
,
class_tag
,
(
long
)
x
,
nlet_tag
);
sprintf
(
tags
,
"%lx%s %lx
%s
iemgui %s"
,
(
long
)
x
,
class_tag
,
(
long
)
x
,
strcmp
(
class_tag
,
"GOP"
)
?
"LABELH"
:
"MOVE"
,
nlet_tag
);
}
sys_vgui
(
".x%x.c create window %d %d -anchor nw -width %d -height %d "
"-window %s -tags {%s}
\n
"
,
canvas
,
x
->
x_obj
.
te_xpix
+
px
-
sx
,
x
->
x_obj
.
te_ypix
+
py
-
sy
,
"-window %s -tags {%s}
\n
"
,
canvas
,
x
->
te_xpix
+
px
-
sx
,
x
->
te_ypix
+
py
-
sy
,
sx
,
sy
,
h
->
h_pathname
,
tags
);
scalehandle_bind
(
h
);
h
->
h_vis
=
1
;
...
...
@@ -981,3 +980,36 @@ void scalehandle_free(t_scalehandle *h) {
pd_unbind
((
t_pd
*
)
h
,
h
->
h_bindsym
);
pd_free
((
t_pd
*
)
h
);
}
void
properties_set_field_int
(
long
props
,
const
char
*
gui_field
,
int
value
)
{
sys_vgui
(
".gfxstub%lx.%s delete 0 end
\n
"
,
props
,
gui_field
);
sys_vgui
(
".gfxstub%lx.%s insert 0 %d
\n
"
,
props
,
gui_field
,
value
);
};
void
scalehandle_dragon_label
(
t_scalehandle
*
h
,
float
f1
,
float
f2
)
{
if
(
h
->
h_dragon
&&
!
h
->
h_scale
)
{
t_iemgui
*
x
=
(
t_iemgui
*
)(
h
->
h_master
);
int
dx
=
(
int
)
f1
,
dy
=
(
int
)
f2
;
h
->
h_dragx
=
dx
;
h
->
h_dragy
=
dy
;
int
properties
=
gfxstub_haveproperties
((
void
*
)
x
);
if
(
properties
)
{
int
new_x
=
x
->
x_ldx
-
h
->
h_offset_x
+
h
->
h_dragx
;
int
new_y
=
x
->
x_ldy
-
h
->
h_offset_y
+
h
->
h_dragy
;
properties_set_field_int
(
properties
,
"label.xy.x_entry"
,
new_x
);
properties_set_field_int
(
properties
,
"label.xy.y_entry"
,
new_y
);
}
if
(
glist_isvisible
(
x
->
x_glist
))
{
int
xpos
=
text_xpix
(
&
x
->
x_obj
,
x
->
x_glist
);
int
ypos
=
text_ypix
(
&
x
->
x_obj
,
x
->
x_glist
);
t_canvas
*
canvas
=
glist_getcanvas
(
x
->
x_glist
);
sys_vgui
(
".x%lx.c coords %lxLABEL %d %d
\n
"
,
canvas
,
x
,
xpos
+
x
->
x_ldx
+
h
->
h_dragx
-
h
->
h_offset_x
,
ypos
+
x
->
x_ldy
+
h
->
h_dragy
-
h
->
h_offset_y
);
}
}
}
pd/src/g_all_guis.h
View file @
7f7328df
...
...
@@ -410,3 +410,5 @@ EXTERN void scalehandle_draw_erase2(t_iemgui *x, t_glist *canvas);
EXTERN
void
scalehandle_draw_new
(
t_scalehandle
*
x
,
t_glist
*
canvas
);
EXTERN
t_scalehandle
*
scalehandle_new
(
t_class
*
c
,
t_iemgui
*
x
,
int
scale
);
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 @
7f7328df
...
...
@@ -310,12 +310,7 @@ static void bng__clickhook(t_scalehandle *sh, t_floatarg f,
if
(
properties
)
{
sys_vgui
(
".gfxstub%lx.dim.w_ent delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.dim.w_ent insert 0 %d
\n
"
,
properties
,
x
->
x_gui
.
x_w
);
//sys_vgui(".gfxstub%lx.dim.h_ent delete 0 end\n", properties);
//sys_vgui(".gfxstub%lx.dim.h_ent insert 0 %d\n", properties,
// x->x_gui.x_h);
properties_set_field_int
(
properties
,
"dim.w_ent"
,
x
->
x_gui
.
x_w
);
}
if
(
glist_isvisible
(
x
->
x_gui
.
x_glist
))
...
...
@@ -364,12 +359,7 @@ static void bng__clickhook(t_scalehandle *sh, t_floatarg f,
if
(
properties
)
{
sys_vgui
(
".gfxstub%lx.dim.w_ent delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.dim.w_ent insert 0 %d
\n
"
,
properties
,
x
->
x_gui
.
x_w
);
//sys_vgui(".gfxstub%lx.dim.h_ent delete 0 end\n", properties);
//sys_vgui(".gfxstub%lx.dim.h_ent insert 0 %d\n", properties,
// x->x_gui.x_h);
properties_set_field_int
(
properties
,
"dim.w_ent"
,
x
->
x_gui
.
x_w
);
}
if
(
glist_isvisible
(
x
->
x_gui
.
x_glist
))
...
...
@@ -442,46 +432,10 @@ static void bng__motionhook(t_scalehandle *sh,
if
(
properties
)
{
int
new_w
=
x
->
x_gui
.
x_w
-
sh
->
h_offset_x
+
sh
->
h_dragx
;
//int new_h = x->x_gui.x_h - sh->h_offset_y + sh->h_dragy;
sys_vgui
(
".gfxstub%lx.dim.w_ent delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.dim.w_ent insert 0 %d
\n
"
,
properties
,
new_w
);
//sys_vgui(".gfxstub%lx.dim.h_ent delete 0 end\n", properties);
//sys_vgui(".gfxstub%lx.dim.h_ent insert 0 %d\n", properties, new_h);
}
}
if
(
sh
->
h_dragon
&&
!
sh
->
h_scale
)
{
t_bng
*
x
=
(
t_bng
*
)(
sh
->
h_master
);
int
dx
=
(
int
)
f1
,
dy
=
(
int
)
f2
;
sh
->
h_dragx
=
dx
;
sh
->
h_dragy
=
dy
;
int
properties
=
gfxstub_haveproperties
((
void
*
)
x
);
if
(
properties
)
{
int
new_x
=
x
->
x_gui
.
x_ldx
-
sh
->
h_offset_x
+
sh
->
h_dragx
;
int
new_y
=
x
->
x_gui
.
x_ldy
-
sh
->
h_offset_y
+
sh
->
h_dragy
;
sys_vgui
(
".gfxstub%lx.label.xy.x_entry delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.label.xy.x_entry insert 0 %d
\n
"
,
properties
,
new_x
);
sys_vgui
(
".gfxstub%lx.label.xy.y_entry delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.label.xy.y_entry insert 0 %d
\n
"
,
properties
,
new_y
);
}
if
(
glist_isvisible
(
x
->
x_gui
.
x_glist
))
{
int
xpos
=
text_xpix
(
&
x
->
x_gui
.
x_obj
,
x
->
x_gui
.
x_glist
);
int
ypos
=
text_ypix
(
&
x
->
x_gui
.
x_obj
,
x
->
x_gui
.
x_glist
);
t_canvas
*
canvas
=
glist_getcanvas
(
x
->
x_gui
.
x_glist
);
sys_vgui
(
".x%lx.c coords %lxLABEL %d %d
\n
"
,
canvas
,
x
,
xpos
+
x
->
x_gui
.
x_ldx
+
sh
->
h_dragx
-
sh
->
h_offset_x
,
ypos
+
x
->
x_gui
.
x_ldy
+
sh
->
h_dragy
-
sh
->
h_offset_y
);
properties_set_field_int
(
properties
,
"dim.w_ent"
,
new_w
);
}
}
scalehandle_dragon_label
(
sh
,
f1
,
f2
);
}
void
bng_draw
(
t_bng
*
x
,
t_glist
*
glist
,
int
mode
)
...
...
pd/src/g_canvas.c
View file @
7f7328df
...
...
@@ -706,49 +706,21 @@ void canvas_draw_gop_resize_hooks(t_canvas* x)
//fprintf(stderr,"draw_gop_resize_hooks %lx %lx\n",
// (t_int)x, (t_int)glist_getcanvas(x));
sprintf
(
sh
->
h_pathname
,
".x%lx.h%lx"
,
(
t_int
)
x
,
(
t_int
)
sh
);
sys_vgui
(
"destroy %s
\n
"
,
sh
->
h_pathname
);
sys_vgui
(
".x%lx.c delete GOP_resblob
\n
"
,
x
);
// instead should call scalehandle_draw_select(t_scalehandle *h, t_glist *canvas, int px, int py, const char *nlet_tag, const char *class_tag);
// but the tags are different
sys_vgui
(
"canvas %s -width %d -height %d -bg $pd_colors(selection) "
"-bd 0 -cursor bottom_right_corner
\n
"
,
sh
->
h_pathname
,
SCALEHANDLE_WIDTH
,
SCALEHANDLE_HEIGHT
);
sys_vgui
(
".x%x.c create window %d %d -anchor nw "
"-width %d -height %d -window %s "
"-tags {%lxSCALE %lxGOP GOP_resblob}
\n
"
,
x
,
x
->
gl_xmargin
+
x
->
gl_pixwidth
-
SCALEHANDLE_WIDTH
-
1
,
x
->
gl_ymargin
+
3
+
x
->
gl_pixheight
-
SCALEHANDLE_HEIGHT
-
4
,
SCALEHANDLE_WIDTH
,
SCALEHANDLE_HEIGHT
,
sh
->
h_pathname
,
x
,
x
);
scalehandle_bind
(
sh
);
//Drawing and Binding Move_Blob for GOP
sprintf
(
mh
->
h_pathname
,
".x%lx.h%lx"
,
(
t_int
)
x
,
(
t_int
)
mh
);
sys_vgui
(
"destroy %s
\n
"
,
mh
->
h_pathname
);
sys_vgui
(
".x%lx.c delete GOP_movblob
\n
"
,
x
);
sys_vgui
(
"canvas %s -width %d -height %d -bg $pd_colors(selection) "
"-bd 0 -cursor crosshair
\n
"
,
mh
->
h_pathname
,
SCALEHANDLE_WIDTH
,
SCALEHANDLE_HEIGHT
);
sys_vgui
(
".x%x.c create window %d %d -anchor nw -width %d -height %d "
"-window %s -tags {%lxMOVE %lxGOP GOP_movblob}
\n
"
,
x
,
x
->
gl_xmargin
+
2
,
x
->
gl_ymargin
+
2
,
SCALEHANDLE_WIDTH
,
SCALEHANDLE_HEIGHT
,
mh
->
h_pathname
,
x
,
x
);
scalehandle_bind
(
mh
);
// end of part to be replaced by scalehandle_draw_select
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"
);
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"
);
}
else
{
if
(
sh
&&
sh
->
h_pathname
)
sys_vgui
(
"destroy %s
\n
"
,
sh
->
h_pathname
);
if
(
mh
&&
mh
->
h_pathname
)
sys_vgui
(
"destroy %s
\n
"
,
mh
->
h_pathname
);
//delete the GOP_resblob and GOP_movblob
sys_vgui
(
".x%lx.c delete GOP_resblob ; "
".x%lx.c delete GOP_movblob ;
\n
"
,
x
,
x
);
scalehandle_draw_erase
(
sh
,
x
);
scalehandle_draw_erase
(
mh
,
x
);
}
canvas_check_nlet_highlights
(
x
);
}
...
...
@@ -2011,14 +1983,8 @@ void canvasgop__clickhook(t_scalehandle *sh, t_floatarg f, t_floatarg xxx, t_flo
if
(
properties
)
{
sys_vgui
(
".gfxstub%lx.xrange.entry3 delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.xrange.entry3 insert 0 %d
\n
"
,
properties
,
x
->
gl_pixwidth
);
sys_vgui
(
".gfxstub%lx.yrange.entry3 delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.yrange.entry3 insert 0 %d
\n
"
,
properties
,
x
->
gl_pixheight
);
properties_set_field_int
(
properties
,
"n.canvasdialog.x.f2.entry3"
,
x
->
gl_pixwidth
);
properties_set_field_int
(
properties
,
"n.canvasdialog.y.f2.entry3"
,
x
->
gl_pixheight
);
}
if
(
glist_isvisible
(
x
))
...
...
@@ -2044,14 +2010,8 @@ void canvasgop__clickhook(t_scalehandle *sh, t_floatarg f, t_floatarg xxx, t_flo
int
properties
=
gfxstub_haveproperties
((
void
*
)
x
);
if
(
properties
)
{
sys_vgui
(
".gfxstub%lx.xrange.entry4 delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.xrange.entry4 insert 0 %d
\n
"
,
properties
,
x
->
gl_xmargin
);
sys_vgui
(
".gfxstub%lx.yrange.entry4 delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.yrange.entry4 insert 0 %d
\n
"
,
properties
,
x
->
gl_ymargin
);
properties_set_field_int
(
properties
,
"n.canvasdialog.x.f2.entry4"
,
x
->
gl_xmargin
);
properties_set_field_int
(
properties
,
"n.canvasdialog.y.f2.entry4"
,
x
->
gl_ymargin
);
}
if
(
glist_isvisible
(
x
))
...
...
@@ -2080,6 +2040,7 @@ void canvasgop__clickhook(t_scalehandle *sh, t_floatarg f, t_floatarg xxx, t_flo
}
else
//enter if move_gop hook
{
//scalehandle_draw_erase(sh,x);
sys_vgui
(
"lower %s
\n
"
,
sh
->
h_pathname
);
//delete GOP_resblob when moving the whole GOP
sys_vgui
(
".x%lx.c delete GOP_resblob
\n
"
,
x
);
...
...
@@ -2121,14 +2082,8 @@ void canvasgop__motionhook(t_scalehandle *sh,t_floatarg f1, t_floatarg f2)
{
int
new_w
=
x
->
gl_pixwidth
-
sh
->
h_offset_x
+
sh
->
h_dragx
;
int
new_h
=
x
->
gl_pixheight
-
sh
->
h_offset_y
+
sh
->
h_dragy
;
sys_vgui
(
".gfxstub%lx.xrange.entry3 delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.xrange.entry3 insert 0 %d
\n
"
,
properties
,
new_w
);
sys_vgui
(
".gfxstub%lx.yrange.entry3 delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.yrange.entry3 insert 0 %d
\n
"
,
properties
,
new_h
);
properties_set_field_int
(
properties
,
"n.canvasdialog.x.f2.entry3"
,
new_w
);
properties_set_field_int
(
properties
,
"n.canvasdialog.y.f2.entry3"
,
new_h
);
}
}
else
//enter if move_gop hook
...
...
@@ -2139,14 +2094,8 @@ void canvasgop__motionhook(t_scalehandle *sh,t_floatarg f1, t_floatarg f2)
int
properties
=
gfxstub_haveproperties
((
void
*
)
x
);
if
(
properties
)
{
sys_vgui
(
".gfxstub%lx.xrange.entry4 delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.xrange.entry4 insert 0 %d
\n
"
,
properties
,
newx
);
sys_vgui
(
".gfxstub%lx.yrange.entry4 delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.yrange.entry4 insert 0 %d
\n
"
,
properties
,
newy
);
properties_set_field_int
(
properties
,
"n.canvasdialog.x.f2.entry4"
,
newx
);
properties_set_field_int
(
properties
,
"n.canvasdialog.y.f2.entry4"
,
newy
);
}
sys_vgui
(
".x%x.c coords GOP %d %d %d %d %d %d %d %d %d %d
\n
"
,
...
...
@@ -2160,7 +2109,6 @@ void canvasgop__motionhook(t_scalehandle *sh,t_floatarg f1, t_floatarg f2)
}
}
}
/*------------------------------------------------------------------------*/
/* ------------------------------- setup routine ------------------------ */
...
...
pd/src/g_hdial.c
View file @
7f7328df
...
...
@@ -331,11 +331,7 @@ static void hradio__clickhook(t_scalehandle *sh, t_floatarg f, t_floatarg xxx,
if
(
properties
)
{
sys_vgui
(
".gfxstub%lx.dim.w_ent delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.dim.w_ent insert 0 %d
\n
"
,
properties
,
x
->
x_gui
.
x_w
);
//sys_vgui(".gfxstub%lx.dim.h_ent delete 0 end\n", properties);
//sys_vgui(".gfxstub%lx.dim.h_ent insert 0 %d\n", properties, x->x_gui.x_h);
properties_set_field_int
(
properties
,
"dim.w_ent"
,
x
->
x_gui
.
x_w
);
}
if
(
glist_isvisible
(
x
->
x_gui
.
x_glist
))
...
...
@@ -382,15 +378,9 @@ static void hradio__clickhook(t_scalehandle *sh, t_floatarg f, t_floatarg xxx,
}
int
properties
=
gfxstub_haveproperties
((
void
*
)
x
);
if
(
properties
)
{
sys_vgui
(
".gfxstub%lx.dim.w_ent delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.dim.w_ent insert 0 %d
\n
"
,
properties
,
x
->
x_gui
.
x_w
);
//sys_vgui(".gfxstub%lx.dim.h_ent delete 0 end\n", properties);
//sys_vgui(".gfxstub%lx.dim.h_ent insert 0 %d\n",
// properties, x->x_gui.x_h);
properties_set_field_int
(
properties
,
"dim.w_ent"
,
x
->
x_gui
.
x_w
);
}
if
(
glist_isvisible
(
x
->
x_gui
.
x_glist
))
...
...
@@ -455,46 +445,10 @@ static void hradio__motionhook(t_scalehandle *sh,
if
(
properties
)
{
int
new_w
=
x
->
x_gui
.
x_w
-
sh
->
h_offset_x
+
sh
->
h_dragx
;
//int new_h = x->x_gui.x_h - sh->h_offset_y + sh->h_dragy;
sys_vgui
(
".gfxstub%lx.dim.w_ent delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.dim.w_ent insert 0 %d
\n
"
,
properties
,
new_w
);
//sys_vgui(".gfxstub%lx.dim.h_ent delete 0 end\n", properties);
//sys_vgui(".gfxstub%lx.dim.h_ent insert 0 %d\n",
// properties, new_h);
}
}
else
if
(
sh
->
h_dragon
&&
!
sh
->
h_scale
)
{
t_bng
*
x
=
(
t_bng
*
)(
sh
->
h_master
);
int
dx
=
(
int
)
f1
,
dy
=
(
int
)
f2
;
sh
->
h_dragx
=
dx
;
sh
->
h_dragy
=
dy
;
int
properties
=
gfxstub_haveproperties
((
void
*
)
x
);
if
(
properties
)
{
int
new_x
=
x
->
x_gui
.
x_ldx
-
sh
->
h_offset_x
+
sh
->
h_dragx
;
int
new_y
=
x
->
x_gui
.
x_ldy
-
sh
->
h_offset_y
+
sh
->
h_dragy
;
sys_vgui
(
".gfxstub%lx.label.xy.x_entry delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.label.xy.x_entry insert 0 %d
\n
"
,
properties
,
new_x
);
sys_vgui
(
".gfxstub%lx.label.xy.y_entry delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.label.xy.y_entry insert 0 %d
\n
"
,
properties
,
new_y
);
}
if
(
glist_isvisible
(
x
->
x_gui
.
x_glist
))
{
int
xpos
=
text_xpix
(
&
x
->
x_gui
.
x_obj
,
x
->
x_gui
.
x_glist
);
int
ypos
=
text_ypix
(
&
x
->
x_gui
.
x_obj
,
x
->
x_gui
.
x_glist
);
t_canvas
*
canvas
=
glist_getcanvas
(
x
->
x_gui
.
x_glist
);
sys_vgui
(
".x%lx.c coords %lxLABEL %d %d
\n
"
,
canvas
,
x
,
xpos
+
x
->
x_gui
.
x_ldx
+
sh
->
h_dragx
-
sh
->
h_offset_x
,
ypos
+
x
->
x_gui
.
x_ldy
+
sh
->
h_dragy
-
sh
->
h_offset_y
);
properties_set_field_int
(
properties
,
"dim.w_ent"
,
new_w
);
}
}
scalehandle_dragon_label
(
sh
,
f1
,
f2
);
}
void
hradio_draw
(
t_hradio
*
x
,
t_glist
*
glist
,
int
mode
)
...
...
pd/src/g_hslider.c
View file @
7f7328df
...
...
@@ -317,12 +317,8 @@ static void hslider__clickhook(t_scalehandle *sh, t_floatarg f,
if
(
properties
)
{
sys_vgui
(
".gfxstub%lx.dim.w_ent delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.dim.w_ent insert 0 %d
\n
"
,
properties
,
x
->
x_gui
.
x_w
);
sys_vgui
(
".gfxstub%lx.dim.h_ent delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.dim.h_ent insert 0 %d
\n
"
,
properties
,
x
->
x_gui
.
x_h
);
properties_set_field_int
(
properties
,
"dim.w_ent"
,
x
->
x_gui
.
x_w
);
properties_set_field_int
(
properties
,
"dim.h_ent"
,
x
->
x_gui
.
x_h
);
}
hslider_check_width
(
x
,
x
->
x_gui
.
x_w
);
...
...
@@ -376,12 +372,7 @@ static void hslider__clickhook(t_scalehandle *sh, t_floatarg f,
if
(
properties
)
{
sys_vgui
(
".gfxstub%lx.dim.w_ent delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.dim.w_ent insert 0 %d
\n
"
,
properties
,
x
->
x_gui
.
x_w
);
//sys_vgui(".gfxstub%lx.dim.h_ent delete 0 end\n", properties);
//sys_vgui(".gfxstub%lx.dim.h_ent insert 0 %d\n",
// properties, x->x_gui.x_h);
properties_set_field_int
(
properties
,
"dim.w_ent"
,
x
->
x_gui
.
x_w
);
}
if
(
glist_isvisible
(
x
->
x_gui
.
x_glist
))
...
...
@@ -443,44 +434,11 @@ static void hslider__motionhook(t_scalehandle *sh,
{
int
new_w
=
x
->
x_gui
.
x_w
-
sh
->
h_offset_x
+
sh
->
h_dragx
;
int
new_h
=
x
->
x_gui
.
x_h
-
sh
->
h_offset_y
+
sh
->
h_dragy
;
sys_vgui
(
".gfxstub%lx.dim.w_ent delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.dim.w_ent insert 0 %d
\n
"
,
properties
,
new_w
);
sys_vgui
(
".gfxstub%lx.dim.h_ent delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.dim.h_ent insert 0 %d
\n
"
,
properties
,
new_h
);
}
}
if
(
sh
->
h_dragon
&&
!
sh
->
h_scale
)
{
t_bng
*
x
=
(
t_bng
*
)(
sh
->
h_master
);
int
dx
=
(
int
)
f1
,
dy
=
(
int
)
f2
;
sh
->
h_dragx
=
dx
;
sh
->
h_dragy
=
dy
;
int
properties
=
gfxstub_haveproperties
((
void
*
)
x
);
if
(
properties
)
{
int
new_x
=
x
->
x_gui
.
x_ldx
-
sh
->
h_offset_x
+
sh
->
h_dragx
;
int
new_y
=
x
->
x_gui
.
x_ldy
-
sh
->
h_offset_y
+
sh
->
h_dragy
;
sys_vgui
(
".gfxstub%lx.label.xy.x_entry delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.label.xy.x_entry insert 0 %d
\n
"
,
properties
,
new_x
);
sys_vgui
(
".gfxstub%lx.label.xy.y_entry delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.label.xy.y_entry insert 0 %d
\n
"
,
properties
,
new_y
);
}
if
(
glist_isvisible
(
x
->
x_gui
.
x_glist
))
{
int
xpos
=
text_xpix
(
&
x
->
x_gui
.
x_obj
,
x
->
x_gui
.
x_glist
);
int
ypos
=
text_ypix
(
&
x
->
x_gui
.
x_obj
,
x
->
x_gui
.
x_glist
);
t_canvas
*
canvas
=
glist_getcanvas
(
x
->
x_gui
.
x_glist
);
sys_vgui
(
".x%lx.c coords %lxLABEL %d %d
\n
"
,
canvas
,
x
,
xpos
+
x
->
x_gui
.
x_ldx
+
sh
->
h_dragx
-
sh
->
h_offset_x
,
ypos
+
x
->
x_gui
.
x_ldy
+
sh
->
h_dragy
-
sh
->
h_offset_y
);
properties_set_field_int
(
properties
,
"dim.w_ent"
,
new_w
);
properties_set_field_int
(
properties
,
"dim.h_ent"
,
new_h
);
}
}
scalehandle_dragon_label
(
sh
,
f1
,
f2
);
}
...
...
pd/src/g_mycanvas.c
View file @
7f7328df
...
...
@@ -215,12 +215,9 @@ static void my_canvas__clickhook(t_scalehandle *sh, t_floatarg f,
if
(
properties
)
{
sys_vgui
(
".gfxstub%lx.rng.min_ent delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.rng.min_ent insert 0 %d
\n
"
,
properties
,
x
->
x_vis_w
);
sys_vgui
(
".gfxstub%lx.rng.max_ent delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.rng.max_ent insert 0 %d
\n
"
,
properties
,
x
->
x_vis_h
);
sys_vgui
(
".gfxstub%lx.dim.w_ent delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.dim.w_ent insert 0 %d
\n
"
,
properties
,
x
->
x_gui
.
x_w
);
properties_set_field_int
(
properties
,
"rng.min_ent"
,
x
->
x_vis_w
);
properties_set_field_int
(
properties
,
"rng.max_ent"
,
x
->
x_vis_h
);
properties_set_field_int
(
properties
,
"dim.w_ent"
,
x
->
x_gui
.
x_w
);
}
if
(
glist_isvisible
(
x
->
x_gui
.
x_glist
))
...
...
@@ -271,12 +268,8 @@ static void my_canvas__clickhook(t_scalehandle *sh, t_floatarg f,
if
(
properties
)
{
sys_vgui
(
".gfxstub%lx.label.xy.x_entry delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.label.xy.x_entry insert 0 %d
\n
"
,
properties
,
x
->
x_gui
.
x_ldx
);
sys_vgui
(
".gfxstub%lx.label.xy.y_entry delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.label.xy.y_entry insert 0 %d
\n
"
,
properties
,
x
->
x_gui
.
x_ldy
);
properties_set_field_int
(
properties
,
"label.xy.x_entry"
,
x
->
x_gui
.
x_ldx
);
properties_set_field_int
(
properties
,
"label.xy.y_entry"
,
x
->
x_gui
.
x_ldy
);
}
if
(
glist_isvisible
(
x
->
x_gui
.
x_glist
))
...
...
@@ -337,48 +330,17 @@ static void my_canvas__motionhook(t_scalehandle *sh,
{
int
new_w
=
x
->
x_vis_w
-
sh
->
h_offset_x
+
sh
->
h_dragx
;
int
new_h
=
x
->
x_vis_h
-
sh
->
h_offset_y
+
sh
->
h_dragy
;
sys_vgui
(
".gfxstub%lx.rng.min_ent delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.rng.min_ent insert 0 %d
\n
"
,
properties
,
new_w
);
sys_vgui
(
".gfxstub%lx.rng.max_ent delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.rng.max_ent insert 0 %d
\n
"
,
properties
,
new_h
);
properties_set_field_int
(
properties
,
"rng.min_ent"
,
new_w
);
properties_set_field_int
(
properties
,
"rng.max_ent"
,
new_h
);
int
min
=
(
new_w
<
new_h
?
new_w
:
new_h
);
if
(
min
<=
x
->
x_gui
.
x_w
)
{
sys_vgui
(
".gfxstub%lx.dim.w_ent delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.dim.w_ent insert 0 %d
\n
"
,
properties
,
min
);
properties_set_field_int
(
properties
,
"dim.w_ent"
,
min
);
}
}
}
else
if
(
sh
->
h_dragon
&&
!
sh
->
h_scale
)
{
t_my_canvas
*
x
=
(
t_my_canvas
*
)(
sh
->
h_master
);
int
dx
=
(
int
)
f1
,
dy
=
(
int
)
f2
;
sh
->
h_dragx
=
dx
;
sh
->
h_dragy
=
dy
;
int
properties
=
gfxstub_haveproperties
((
void
*
)
x
);
if
(
properties
)
{
int
new_x
=
x
->
x_gui
.
x_ldx
-
sh
->
h_offset_x
+
sh
->
h_dragx
;
int
new_y
=
x
->
x_gui
.
x_ldy
-
sh
->
h_offset_y
+
sh
->
h_dragy
;
sys_vgui
(
".gfxstub%lx.label.xy.x_entry delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.label.xy.x_entry insert 0 %d
\n
"
,
properties
,
new_x
);
sys_vgui
(
".gfxstub%lx.label.xy.y_entry delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.label.xy.y_entry insert 0 %d
\n
"
,
properties
,
new_y
);
}
if
(
glist_isvisible
(
x
->
x_gui
.
x_glist
))
{
int
xpos
=
text_xpix
(
&
x
->
x_gui
.
x_obj
,
x
->
x_gui
.
x_glist
);
int
ypos
=
text_ypix
(
&
x
->
x_gui
.
x_obj
,
x
->
x_gui
.
x_glist
);
t_canvas
*
canvas
=
glist_getcanvas
(
x
->
x_gui
.
x_glist
);
sys_vgui
(
".x%lx.c coords %lxLABEL %d %d
\n
"
,
canvas
,
x
,
xpos
+
x
->
x_gui
.
x_ldx
+
sh
->
h_dragx
-
sh
->
h_offset_x
,
ypos
+
x
->
x_gui
.
x_ldy
+
sh
->
h_dragy
-
sh
->
h_offset_y
);
}
}
scalehandle_dragon_label
(
sh
,
f1
,
f2
);
}
void
my_canvas_draw
(
t_my_canvas
*
x
,
t_glist
*
glist
,
int
mode
)
...
...
pd/src/g_numbox.c
View file @
7f7328df
...
...
@@ -541,19 +541,12 @@ static void my_numbox__clickhook(t_scalehandle *sh, t_floatarg f,
}
int
properties
=
gfxstub_haveproperties
((
void
*
)
x
);
if
(
properties
)
{
sys_vgui
(
".gfxstub%lx.dim.w_ent delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.dim.w_ent insert 0 %d
\n
"
,
properties
,
x
->
x_gui
.
x_w
);
sys_vgui
(
".gfxstub%lx.dim.h_ent delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.dim.h_ent insert 0 %d
\n
"
,
properties
,
x
->
x_gui
.
x_h
);
sys_vgui
(
".gfxstub%lx.label.fontsize_entry delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.label.fontsize_entry insert 0 %d
\n
"
,
properties
,
x
->
x_gui
.
x_fontsize
);
properties_set_field_int
(
properties
,
"dim.w_ent"
,
x
->
x_gui
.
x_w
);
properties_set_field_int
(
properties
,
"dim.h_ent"
,
x
->
x_gui
.
x_h
);
properties_set_field_int
(
properties
,
"dim.fontsize_entry"
,
x
->
x_gui
.
x_fontsize
);
}
if
(
glist_isvisible
(
x
->
x_gui
.
x_glist
))
...
...
@@ -606,15 +599,9 @@ static void my_numbox__clickhook(t_scalehandle *sh, t_floatarg f,
}
int
properties
=
gfxstub_haveproperties
((
void
*
)
x
);
if
(
properties
)
{
sys_vgui
(
".gfxstub%lx.dim.w_ent delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.dim.w_ent insert 0 %d
\n
"
,
properties
,
x
->
x_gui
.
x_w
);
//sys_vgui(".gfxstub%lx.dim.h_ent delete 0 end\n", properties);
//sys_vgui(".gfxstub%lx.dim.h_ent insert 0 %d\n", properties,
// x->x_gui.x_h);
properties_set_field_int
(
properties
,
"dim.w_ent"
,
x
->
x_gui
.
x_w
);
}
if
(
glist_isvisible
(
x
->
x_gui
.
x_glist
))
...
...
@@ -699,50 +686,12 @@ static void my_numbox__motionhook(t_scalehandle *sh,
int
properties
=
gfxstub_haveproperties
((
void
*
)
x
);
if
(
properties
)
{
sys_vgui
(
".gfxstub%lx.dim.w_ent delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.dim.w_ent insert 0 %d
\n
"
,
properties
,
x
->
x_scalewidth
);
sys_vgui
(
".gfxstub%lx.dim.h_ent delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.dim.h_ent insert 0 %d
\n
"
,
properties
,
x
->
x_scaleheight
);
sys_vgui
(
".gfxstub%lx.label.fontsize_entry delete 0 end
\n
"
,
properties
);
sys_vgui
(
".gfxstub%lx.label.fontsize_entry insert 0 %d
\n
"
,
properties
,
x
->
x_tmpfontsize
);