Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
purr-data
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jonathan Wilkes
purr-data
Commits
aa00d258
Commit
aa00d258
authored
9 years ago
by
Jonathan Wilkes
Browse files
Options
Downloads
Patches
Plain Diff
first attempt to get pddplink to work with the new GUI
parent
a48a451a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
externals/pddp/pddplink.c
+62
-14
62 additions, 14 deletions
externals/pddp/pddplink.c
with
62 additions
and
14 deletions
externals/pddp/pddplink.c
+
62
−
14
View file @
aa00d258
...
@@ -98,18 +98,23 @@ static void pddplink_select(t_gobj *z, t_glist *glist, int state)
...
@@ -98,18 +98,23 @@ static void pddplink_select(t_gobj *z, t_glist *glist, int state)
rtext_select
(
y
,
state
);
rtext_select
(
y
,
state
);
if
(
glist_isvisible
(
glist
)
&&
glist
->
gl_havewindow
)
if
(
glist_isvisible
(
glist
)
&&
glist
->
gl_havewindow
)
{
{
if
(
state
)
{
if
(
state
)
{
sys_vgui
(
".x%lx.c itemconfigure %s -fill $::pd_colors(selection)
\n
"
,
sys_vgui
(
".x%lx.c itemconfigure %s -fill $::pd_colors(selection)
\n
"
,
glist
,
rtext_gettag
(
y
));
glist
,
rtext_gettag
(
y
));
sys_vgui
(
".x%lx.c addtag selected withtag %s
\n
"
,
sys_vgui
(
".x%lx.c addtag selected withtag %s
\n
"
,
glist
,
rtext_gettag
(
y
));
glist
,
rtext_gettag
(
y
));
}
gui_vmess
(
"gui_gobj_select"
,
"xs"
,
else
{
glist
,
rtext_gettag
(
y
));
sys_vgui
(
".x%lx.c itemconfigure %s -text {%s} -fill #0000dd -activefill #e70000
\n
"
,
}
glist
,
rtext_gettag
(
y
),
x
->
x_vistext
);
else
sys_vgui
(
"pdtk_canvas_getscroll .x%lx.c
\n
"
,
(
t_int
)
glist_getcanvas
(
glist
));
{
sys_vgui
(
".x%lx.c dtag %s selected
\n
"
,
glist
,
rtext_gettag
(
y
));
sys_vgui
(
".x%lx.c itemconfigure %s -text {%s} -fill #0000dd -activefill #e70000
\n
"
,
}
glist
,
rtext_gettag
(
y
),
x
->
x_vistext
);
sys_vgui
(
"pdtk_canvas_getscroll .x%lx.c
\n
"
,
(
t_int
)
glist_getcanvas
(
glist
));
sys_vgui
(
".x%lx.c dtag %s selected
\n
"
,
glist
,
rtext_gettag
(
y
));
gui_vmess
(
"gui_gobj_deselect"
,
"xs"
,
glist
,
rtext_gettag
(
y
));
}
}
}
}
}
...
@@ -119,6 +124,31 @@ static void pddplink_activate(t_gobj *z, t_glist *glist, int state)
...
@@ -119,6 +124,31 @@ static void pddplink_activate(t_gobj *z, t_glist *glist, int state)
t_rtext
*
y
=
glist_findrtext
(
glist
,
(
t_text
*
)
x
);
t_rtext
*
y
=
glist_findrtext
(
glist
,
(
t_text
*
)
x
);
rtext_activate
(
y
,
state
);
rtext_activate
(
y
,
state
);
x
->
x_rtextactive
=
state
;
x
->
x_rtextactive
=
state
;
if
(
!
state
)
{
/* Big workaround for pddplink without the -box option...
After this call, Pd calls text_setto to see if it needs to
instantiate the object. For nearly all t_text objects, the
object doesn't get rebuilt if the text inside the box remains
the same. Instead, it just calls rtext_senditup which (eventually)
sends a message to the GUI to simply supply new text for the
current object. (It shouldn't do this if the text hasn't actually
changed, but that's another story...).
Anyway, since pddplink has this weird widget behavior, the text
displayed is different than the text we typed in the box-- hence
the x->x_vistext member here. So if we happened to edit the box
without changing the text, rtext_senditup would update the link
to be "pddplink foo" instead of just "foo".
To prevent this, we just zero out the object's te_binbuf to ensure
that text_setto re-instantiates. That ensures the correct text is
printed for the link */
t_binbuf
*
b
=
binbuf_new
();
t_binbuf
*
old
=
x
->
x_ob
.
te_binbuf
;
x
->
x_ob
.
te_binbuf
=
b
;
binbuf_free
(
old
);
}
}
}
static
void
pddplink_vis
(
t_gobj
*
z
,
t_glist
*
glist
,
int
vis
)
static
void
pddplink_vis
(
t_gobj
*
z
,
t_glist
*
glist
,
int
vis
)
...
@@ -130,15 +160,31 @@ static void pddplink_vis(t_gobj *z, t_glist *glist, int vis)
...
@@ -130,15 +160,31 @@ static void pddplink_vis(t_gobj *z, t_glist *glist, int vis)
if
((
glist
->
gl_havewindow
||
x
->
x_isgopvisible
)
if
((
glist
->
gl_havewindow
||
x
->
x_isgopvisible
)
&&
(
y
=
glist_findrtext
(
glist
,
(
t_text
*
)
x
)))
&&
(
y
=
glist_findrtext
(
glist
,
(
t_text
*
)
x
)))
{
{
rtext_draw
(
y
);
sys_vgui
(
".x%lx.c itemconfigure %s -text {%s} -fill #0000dd -activefill #e70000
\n
"
,
glist_getcanvas
(
glist
),
rtext_gettag
(
y
),
x
->
x_vistext
);
sys_vgui
(
".x%lx.c itemconfigure %s -text {%s} -fill #0000dd -activefill #e70000
\n
"
,
glist_getcanvas
(
glist
),
rtext_gettag
(
y
),
x
->
x_vistext
);
gui_vmess
(
"gui_text_create_gobj"
,
"xssiii"
,
glist_getcanvas
(
glist
),
rtext_gettag
(
y
),
"link"
,
text_xpix
(
&
x
->
x_ob
,
glist_getcanvas
(
glist
)),
text_ypix
(
&
x
->
x_ob
,
glist_getcanvas
(
glist
)),
glist_istoplevel
(
glist
));
rtext_draw
(
y
);
gui_vmess
(
"gui_text_set"
,
"xss"
,
glist_getcanvas
(
glist
),
rtext_gettag
(
y
),
x
->
x_vistext
);
}
}
}
}
else
else
{
{
if
((
glist
->
gl_havewindow
||
x
->
x_isgopvisible
)
if
((
glist
->
gl_havewindow
||
x
->
x_isgopvisible
)
&&
(
y
=
glist_findrtext
(
glist
,
(
t_text
*
)
x
)))
&&
(
y
=
glist_findrtext
(
glist
,
(
t_text
*
)
x
)))
rtext_erase
(
y
);
{
//rtext_erase(y);
gui_vmess
(
"gui_gobj_erase"
,
"xs"
,
glist_getcanvas
(
glist
),
rtext_gettag
(
y
));
}
}
}
}
}
...
@@ -294,12 +340,14 @@ static char *pddplink_optext(int *sizep, int ac, t_atom *av)
...
@@ -294,12 +340,14 @@ static char *pddplink_optext(int *sizep, int ac, t_atom *av)
static
void
pddplink_free
(
t_pddplink
*
x
)
static
void
pddplink_free
(
t_pddplink
*
x
)
{
{
post
(
"freeing the thing..."
);
if
(
x
->
x_vistext
)
if
(
x
->
x_vistext
)
freebytes
(
x
->
x_vistext
,
x
->
x_vissize
);
freebytes
(
x
->
x_vistext
,
x
->
x_vissize
);
}
}
static
void
*
pddplink_new
(
t_symbol
*
s
,
int
ac
,
t_atom
*
av
)
static
void
*
pddplink_new
(
t_symbol
*
s
,
int
ac
,
t_atom
*
av
)
{
{
post
(
"creating a new link"
);
t_pddplink
xgen
,
*
x
;
t_pddplink
xgen
,
*
x
;
int
skip
;
int
skip
;
xgen
.
x_isboxed
=
0
;
xgen
.
x_isboxed
=
0
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment