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
6904cefa
Commit
6904cefa
authored
Oct 25, 2011
by
Ivica Ico Bukvic
Committed by
Hans-Christoph Steiner
Nov 02, 2011
Browse files
code clean-up
parent
f4c515a7
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/g_canvas.c
View file @
6904cefa
...
...
@@ -713,52 +713,28 @@ void canvas_map(t_canvas *x, t_floatarg f)
//if (!glist_isvisible(x))
//{
//fprintf(stderr,"canvas_map 1 isvisible\n");
t_selection
*
sel
;
if
(
!
x
->
gl_havewindow
)
{
bug
(
"canvas_map"
);
canvas_vis
(
x
,
1
);
}
//else if (x->gl_mapped == 0)
// canvas_vis(x, 1);
/* if parent has editor enabled and we're a sub-patch,
(but not an abstraction) match its edit mode to that
of its parent patch. */
/*t_glist *parentx;
if (!canvas_isabstraction(x)) {
if (x->gl_owner) {
parentx = x->gl_owner;
while (parentx->gl_owner)
parentx = parentx->gl_owner;
if (parentx->gl_edit)
canvas_editmode(x, 1);
else if (x->gl_edit)
canvas_editmode(x, 0);
}
}*/
/* for parent windows, let's make sure the cursor is updated
as soon as the window is open (if in edit mode) */
//else if (x->gl_edit) {
//canvas_setcursor(x, CURSOR_EDITMODE_NOTHING);
//}
if
(
!
x
->
gl_list
)
{
//if there are no objects on the canvas
//fprintf(stderr,"window is empty\n");
canvas_create_editor
(
x
);
}
else
for
(
y
=
x
->
gl_list
;
y
;
y
=
y
->
g_next
)
{
gobj_vis
(
y
,
x
,
1
);
if
(
x
->
gl_editor
&&
x
->
gl_editor
->
e_selection
)
for
(
sel
=
x
->
gl_editor
->
e_selection
;
sel
;
sel
=
sel
->
sel_next
)
gobj_select
(
sel
->
sel_what
,
x
,
1
);
}
x
->
gl_mapped
=
1
;
canvas_drawlines
(
x
);
if
(
x
->
gl_isgraph
&&
x
->
gl_goprect
)
canvas_drawredrect
(
x
,
1
);
sys_vgui
(
"pdtk_canvas_getscroll .x%lx.c
\n
"
,
x
);
t_selection
*
sel
;
if
(
!
x
->
gl_havewindow
)
{
bug
(
"canvas_map"
);
canvas_vis
(
x
,
1
);
}
if
(
!
x
->
gl_list
)
{
//if there are no objects on the canvas
canvas_create_editor
(
x
);
}
else
for
(
y
=
x
->
gl_list
;
y
;
y
=
y
->
g_next
)
{
gobj_vis
(
y
,
x
,
1
);
if
(
x
->
gl_editor
&&
x
->
gl_editor
->
e_selection
)
for
(
sel
=
x
->
gl_editor
->
e_selection
;
sel
;
sel
=
sel
->
sel_next
)
gobj_select
(
sel
->
sel_what
,
x
,
1
);
}
x
->
gl_mapped
=
1
;
canvas_drawlines
(
x
);
if
(
x
->
gl_isgraph
&&
x
->
gl_goprect
)
canvas_drawredrect
(
x
,
1
);
sys_vgui
(
"pdtk_canvas_getscroll .x%lx.c
\n
"
,
x
);
//}
}
else
...
...
@@ -840,13 +816,9 @@ void canvas_free(t_canvas *x)
{
t_gobj
*
y
;
int
dspstate
=
canvas_suspend_dsp
();
// jsarlo
if
(
x
->
gl_magic_glass
)
magicGlass_free
(
x
->
gl_magic_glass
);
// end jsarlo
//delete clock for gl_destroy
//if (x->gl_destroy) clock_free(x->gl_destroy);
canvas_noundo
(
x
);
if
(
canvas_editing
==
x
)
...
...
src/g_editor.c
View file @
6904cefa
...
...
@@ -1164,55 +1164,29 @@ typedef struct _undo_canvas_properties
unsigned
int
gl_hidetext
:
1
;
/* hide object-name + args when doing graph on parent */
}
t_undo_canvas_properties
;
t_undo_canvas_properties
global_buf
;
/* we need this to avoid redundant undo creation when pressing apply and then ok in the canvas properties menu */
t_undo_canvas_properties
global_buf
;
static
void
*
canvas_undo_set_canvas
(
t_canvas
*
x
)
{
//t_undo_canvas_properties *buf;
/* enable editor (in case it is disabled) and select the object we are working on */
if
(
!
x
->
gl_edit
)
canvas_editmode
(
x
,
1
);
//if (global_buf == NULL) {
// global_buf = (t_undo_canvas_properties *)getbytes(sizeof(*global_buf));
//fprintf(stderr,"creating a new buffer for canvas properties\n");
//}
/*if (
global_buf->gl_pixwidth != x->gl_pixwidth ||
global_buf->gl_pixheight != x->gl_pixheight ||
global_buf->gl_x1 != x->gl_x1 ||
global_buf->gl_y1 != x->gl_y1 ||
global_buf->gl_x2 != x->gl_x2 ||
global_buf->gl_y2 != x->gl_y2 ||
global_buf->gl_screenx1 != x->gl_screenx1 ||
global_buf->gl_screeny1 != x->gl_screeny1 ||
global_buf->gl_screenx2 != x->gl_screenx2 ||
global_buf->gl_screeny2 != x->gl_screeny2 ||
global_buf->gl_xmargin != x->gl_xmargin ||
global_buf->gl_ymargin != x->gl_ymargin ||
global_buf->gl_goprect != x->gl_goprect ||
global_buf->gl_isgraph != x->gl_isgraph ||
global_buf->gl_hidetext != x->gl_hidetext)
{*/
//fprintf(stderr,"changing values\n");
global_buf
.
gl_pixwidth
=
x
->
gl_pixwidth
;
global_buf
.
gl_pixheight
=
x
->
gl_pixheight
;
global_buf
.
gl_x1
=
x
->
gl_x1
;
global_buf
.
gl_y1
=
x
->
gl_y1
;
global_buf
.
gl_x2
=
x
->
gl_x2
;
global_buf
.
gl_y2
=
x
->
gl_y2
;
global_buf
.
gl_screenx1
=
x
->
gl_screenx1
;
global_buf
.
gl_screeny1
=
x
->
gl_screeny1
;
global_buf
.
gl_screenx2
=
x
->
gl_screenx2
;
global_buf
.
gl_screeny2
=
x
->
gl_screeny2
;
global_buf
.
gl_xmargin
=
x
->
gl_xmargin
;
global_buf
.
gl_ymargin
=
x
->
gl_ymargin
;
global_buf
.
gl_goprect
=
x
->
gl_goprect
;
global_buf
.
gl_isgraph
=
x
->
gl_isgraph
;
global_buf
.
gl_hidetext
=
x
->
gl_hidetext
;
//}
global_buf
.
gl_pixwidth
=
x
->
gl_pixwidth
;
global_buf
.
gl_pixheight
=
x
->
gl_pixheight
;
global_buf
.
gl_x1
=
x
->
gl_x1
;
global_buf
.
gl_y1
=
x
->
gl_y1
;
global_buf
.
gl_x2
=
x
->
gl_x2
;
global_buf
.
gl_y2
=
x
->
gl_y2
;
global_buf
.
gl_screenx1
=
x
->
gl_screenx1
;
global_buf
.
gl_screeny1
=
x
->
gl_screeny1
;
global_buf
.
gl_screenx2
=
x
->
gl_screenx2
;
global_buf
.
gl_screeny2
=
x
->
gl_screeny2
;
global_buf
.
gl_xmargin
=
x
->
gl_xmargin
;
global_buf
.
gl_ymargin
=
x
->
gl_ymargin
;
global_buf
.
gl_goprect
=
x
->
gl_goprect
;
global_buf
.
gl_isgraph
=
x
->
gl_isgraph
;
global_buf
.
gl_hidetext
=
x
->
gl_hidetext
;
return
(
&
global_buf
);
}
...
...
@@ -1232,13 +1206,9 @@ static void canvas_undo_canvas_apply(t_canvas *x, void *z, int action)
//close properties window first
t_int
properties
=
gfxstub_haveproperties
((
void
*
)
x
);
if
(
properties
)
{
//fprintf(stderr,"have it\n");
sys_vgui
(
"destroy .gfxstub%lx
\n
"
,
properties
);
}
//create a temporary data holder
//tmp = (t_undo_canvas_properties *)getbytes(sizeof(*tmp));
//store current canvas values into temporary data holder
tmp
.
gl_pixwidth
=
x
->
gl_pixwidth
;
tmp
.
gl_pixheight
=
x
->
gl_pixheight
;
...
...
@@ -1290,9 +1260,6 @@ static void canvas_undo_canvas_apply(t_canvas *x, void *z, int action)
buf
->
gl_isgraph
=
tmp
.
gl_isgraph
;
buf
->
gl_hidetext
=
tmp
.
gl_hidetext
;
//delete temporary data holder
//t_freebytes(tmp, sizeof(*tmp));
//redraw
canvas_setgraph
(
x
,
x
->
gl_isgraph
,
0
);
canvas_dirty
(
x
,
1
);
...
...
@@ -1320,8 +1287,7 @@ static void canvas_undo_canvas_apply(t_canvas *x, void *z, int action)
else
if
(
action
==
UNDO_FREE
)
{
//fprintf(stderr,"free...\n");
//if (buf != NULL) t_freebytes(buf, sizeof(*buf));
//do nothing since undo apply uses a global_buf struct rather than a pointer
}
}
...
...
@@ -1354,7 +1320,6 @@ void *canvas_undo_set_create(t_canvas *x)
for
(
y
=
x
->
gl_list
;
y
;
y
=
y
->
g_next
)
{
if
(
glist_isselected
(
x
,
y
))
{
//fprintf(stderr,"saving object\n");
gobj_save
(
y
,
buf
->
u_objectbuf
);
}
}
...
...
src/g_graph.c
View file @
6904cefa
...
...
@@ -141,12 +141,14 @@ void glist_delete(t_glist *x, t_gobj *y)
x
->
gl_list
=
NULL
;
}
else
for
(
g
=
x
->
gl_list
;
g
;
g
=
g
->
g_next
)
if
(
g
->
g_next
==
y
)
{
if
(
y
->
g_next
)
g
->
g_next
=
y
->
g_next
;
else
g
->
g_next
=
NULL
;
break
;
if
(
g
->
g_next
==
y
)
{
if
(
y
->
g_next
)
g
->
g_next
=
y
->
g_next
;
else
g
->
g_next
=
NULL
;
break
;
}
}
gobj_delete
(
y
,
x
);
pd_free
(
&
y
->
g_pd
);
...
...
src/m_binbuf.c
View file @
6904cefa
...
...
@@ -60,7 +60,7 @@ void binbuf_clear(t_binbuf *x)
/* convert text to a binbuf */
void
binbuf_text
(
t_binbuf
*
x
,
char
*
text
,
size_t
size
)
{
//fprintf(stderr, "current text: %s ||
| %c
%c %d %d\n", text, text[size-1],
text[size],
strlen(text), (int)size);
//fprintf(stderr, "current text: %s || %c %d %d\n", text, text[size-1], strlen(text), (int)size);
char
buf
[
MAXPDSTRING
+
1
],
*
bufp
,
*
ebuf
=
buf
+
MAXPDSTRING
;
const
char
*
textp
=
text
,
*
etext
=
text
+
size
;
t_atom
*
ap
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment