Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
purr-data
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
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
nerrons
purr-data
Commits
c68349c4
Commit
c68349c4
authored
10 years ago
by
Ivica Bukvic
Browse files
Options
Downloads
Patches
Plain Diff
*more fixes for g_array.c and its proper drawing
parent
5164643a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pd/src/g_array.c
+27
-10
27 additions, 10 deletions
pd/src/g_array.c
pd/src/g_graph.c
+17
-14
17 additions, 14 deletions
pd/src/g_graph.c
with
44 additions
and
24 deletions
pd/src/g_array.c
+
27
−
10
View file @
c68349c4
...
...
@@ -12,6 +12,7 @@
extern
int
glob_lmclick
;
static
void
garray_select
(
t_gobj
*
z
,
t_glist
*
glist
,
int
state
);
static
void
garray_doredraw
(
t_gobj
*
client
,
t_glist
*
glist
);
/* jsarlo { */
#define ARRAYPAGESIZE 1000
/* this should match the page size in u_main.tk */
...
...
@@ -589,12 +590,18 @@ void glist_arraydialog(t_glist *parent, t_symbol *s, int argc, t_atom *argv)
SETSYMBOL
(
at
+
4
,
fillcolor
);
SETSYMBOL
(
at
+
5
,
outlinecolor
);
a
=
graph_array
(
gl
,
gensym
(
"array"
),
8
,
at
);
canvas_dirty
(
parent
,
1
);
//canvas_redraw(glist_getcanvas(parent));
garray_fittograph
(
a
,
(
int
)
size
,
-
1
);
// we queue gui here because otherwise garray is not drawn properly
// since things are still being created and the object has not yet
// been associated with glist
// sys_queuegui((t_gobj *)gl, glist_getcanvas(gl), graph_redraw);
//fprintf(stderr,"glist_arraydialog done\n");
glist_redraw
(
gl
);
sys_vgui
(
"pdtk_canvas_getscroll .x%lx.c
\n
"
,
(
long
unsigned
int
)
glist_getcanvas
(
parent
));
canvas_dirty
(
parent
,
1
);
}
extern
void
canvas_apply_setundo
(
t_canvas
*
x
,
t_gobj
*
y
);
...
...
@@ -672,21 +679,20 @@ void garray_arraydialog(t_garray *x, t_symbol *s, int argc, t_atom *argv)
x
->
x_realname
=
canvas_realizedollar
(
x
->
x_glist
,
argname
);
pd_bind
(
&
x
->
x_gobj
.
g_pd
,
x
->
x_realname
);
}
/* redraw the whole glist, just so the name change shows up */
if
(
x
->
x_glist
->
gl_havewindow
)
/* redraw the whole glist, just so the name change shows up
there has to be a better way */
/*if (x->x_glist->gl_havewindow)
{
canvas_redraw(glist_getcanvas(x->x_glist));
//fprintf(stderr,"================REDRAW\n");
}
}
*/
size
=
fsize
;
if
(
size
<
1
)
size
=
1
;
if
(
size
!=
a
->
a_n
)
garray_resize
(
x
,
size
);
if
(
style
!=
x
->
x_style
)
{
x
->
x_style
=
style
;
garray_fittograph
(
x
,
size
,
1
);
//
garray_fittograph(x, size, 1);
}
//fprintf(stderr,"style=%d %f\n", style, (t_float)x->x_style);
template_setfloat
(
scalartemplate
,
gensym
(
"style"
),
...
...
@@ -708,8 +714,11 @@ void garray_arraydialog(t_garray *x, t_symbol *s, int argc, t_atom *argv)
x
->
x_fillcolor
=
fill
;
x
->
x_outlinecolor
=
outline
;
x
->
x_style
=
style
;
//fprintf(stderr,"GARRAY_REDRAW\n");
garray_redraw
(
x
);
if
(
size
!=
a
->
a_n
)
garray_resize
(
x
,
size
);
else
garray_redraw
(
x
);
//fprintf(stderr,"garray_arraydialog garray_redraw done\n");
garray_select
((
t_gobj
*
)
x
,
glist_getcanvas
(
x
->
x_glist
),
1
);
canvas_dirty
(
x
->
x_glist
,
1
);
}
...
...
@@ -1513,7 +1522,15 @@ void garray_redraw(t_garray *x)
{
//fprintf(stderr,"garray_redraw\n");
if
(
glist_isvisible
(
x
->
x_glist
))
// enqueueing redraw ensures that the array is drawn after its values
// have been instantiated (instead, we address this in the creating
// dialog by enqueuing redrawing of the graph garray resides in as
// this will fix the lack of the array name and other features
// hence this approach is considered wrong
//sys_queuegui(&x->x_gobj, x->x_glist, garray_doredraw);
// this is useful so that things get redrawn before they are selected
// so that we don't have to fake yet another selection after the fact
garray_doredraw
(
&
x
->
x_gobj
,
x
->
x_glist
);
/* jsarlo { */
/* this happens in garray_vis() when array is visible for
...
...
@@ -1900,7 +1917,7 @@ void garray_resize(t_garray *x, t_floatarg f)
int
n
=
(
f
<
1
?
1
:
f
);
//fprintf(stderr,"garray_resize %d\n", n);
array_resize
(
array
,
n
);
garray_fittograph
(
x
,
n
,
-
1
);
/*template_getfloat(
garray_fittograph
(
x
,
n
,
1
);
/*template_getfloat(
template_findbyname(x->x_scalar->sc_template),
gensym("style"), x->x_scalar->sc_vec, 1));*/
//array_resize_and_redraw(array, x->x_glist, n);
...
...
This diff is collapsed.
Click to expand it.
pd/src/g_graph.c
+
17
−
14
View file @
c68349c4
...
...
@@ -923,24 +923,27 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis)
//REMOVED: -fill $pd_colors(graph)
glist_getcanvas
(
x
->
gl_owner
),
x1
,
y1
,
x2
,
y2
,
tag
);
// -fill $pd_colors(graph)
/* if there's just one "garray" in the graph, write its name
along the top */
/* write garrays' names along the top */
for
(
i
=
(
y1
<
y2
?
y1
:
y2
)
-
1
,
g
=
x
->
gl_list
;
g
;
g
=
g
->
g_next
)
{
//fprintf(stderr,".\n");
//if (g->g_pd == garray_class)
// fprintf(stderr,"garray_getname=%d\n",garray_getname((t_garray *)g, &arrayname));
if
(
g
->
g_pd
==
garray_class
&&
!
garray_getname
((
t_garray
*
)
g
,
&
arrayname
))
{
//i++;
sys_vgui
(
".x%lx.c create text %d %d -text {%s} -anchor nw "
"-font {{%s} -%d %s} -tags {%s label graph} -fill %s
\n
"
,
(
long
)
glist_getcanvas
(
x
),
x1
+
2
,
i
,
arrayname
->
s_name
,
sys_font
,
sys_hostfontsize
(
glist_getfont
(
x
)),
sys_fontweight
,
tag
,
(
glist_isselected
(
x
,
gr
)
?
"$pd_colors(selection)"
:
"$pd_colors(graph_border)"
));
i
+=
sys_fontheight
(
glist_getfont
(
x
));
{
//i++;
sys_vgui
(
".x%lx.c create text %d %d -text {%s} -anchor nw "
"-font {{%s} -%d %s} -tags {%s label graph} -fill %s
\n
"
,
(
long
)
glist_getcanvas
(
x
),
x1
+
2
,
i
,
arrayname
->
s_name
,
sys_font
,
sys_hostfontsize
(
glist_getfont
(
x
)),
sys_fontweight
,
tag
,
(
glist_isselected
(
x
,
gr
)
?
"$pd_colors(selection)"
:
"$pd_colors(graph_border)"
));
i
+=
sys_fontheight
(
glist_getfont
(
x
));
}
}
/* draw ticks on horizontal borders. If lperb field is
zero, this is disabled. */
if
(
x
->
gl_xtick
.
k_lperb
)
...
...
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