void canvas_undo_redo(t_canvas *x) { int dspwas; t_undo *udo = canvas_undo_get(x); if (!udo) return; dspwas = canvas_suspend_dsp(); if (udo->u_queue && udo->u_last->next) { char *undo_action, *redo_action; udo->u_doing = 1; udo->u_last = udo->u_last->next; canvas_editmode(x, 1); glist_noselect(x); canvas_undo_set_name(udo->u_last->name); if(UNDO_SEQUENCE_START == udo->u_last->type) { int sequence_depth = 1; while(udo->u_last->next && (udo->u_last = udo->u_last->next)) { DEBUG_UNDO(post("%s:sequence[%d] %d", __FUNCTION__, sequence_depth, udo->u_last->type)); switch(udo->u_last->type) { case UNDO_SEQUENCE_END: sequence_depth--; break; case UNDO_SEQUENCE_START: sequence_depth++; break; default: canvas_undo_doit(x, udo->u_last, UNDO_REDO, __FUNCTION__); } if (sequence_depth < 1) break; } if (sequence_depth < 0) bug("undo sequence end without start"); else if (sequence_depth > 0) bug("undo sequence start without end"); } canvas_undo_doit(x, udo->u_last, UNDO_REDO, __FUNCTION__); undo_action = udo->u_last->name; redo_action = (udo->u_last->next ? udo->u_last->next->name : "no"); udo->u_doing = 0; /* here we call updating of all unpaired hubs and nodes since their regular call will fail in case their position needed to be updated by undo/redo first to reflect the old one */ if (glist_isvisible(x) && glist_istoplevel(x)) { if (glist_isvisible(x) && glist_istoplevel(x)) sys_vgui("pdtk_undomenu .x%lx %s %s\n", x, undo_action, redo_action); } canvas_dirty(x, canvas_undo_isdirty(x)); } canvas_resume_dsp(dspwas); }
int iemgui_dialog(t_iemgui *x, int argc, t_atom *argv) { t_symbol *srl[3]; x->x_loadinit = !!atom_getintarg(5, argc, argv); srl[0] = iemgui_getfloatsymarg(7,argc,argv); srl[1] = iemgui_getfloatsymarg(8,argc,argv); srl[2] = iemgui_getfloatsymarg(9,argc,argv); x->x_ldx = atom_getintarg(10, argc, argv); x->x_ldy = atom_getintarg(11, argc, argv); int f = atom_getintarg(12, argc, argv); x->x_fontsize = maxi(atom_getintarg(13, argc, argv),4); x->x_bcol = atom_getintarg(14, argc, argv) & 0xffffff; x->x_fcol = atom_getintarg(15, argc, argv) & 0xffffff; x->x_lcol = atom_getintarg(16, argc, argv) & 0xffffff; int oldsndrcvable=0; if(iemgui_has_rcv(x)) oldsndrcvable |= IEM_GUI_OLD_RCV_FLAG; if(iemgui_has_snd(x)) oldsndrcvable |= IEM_GUI_OLD_SND_FLAG; iemgui_all_raute2dollar(srl); // replace ascii code 11 (\v or vertical tab) with spaces // we do this so that the string with spaces can survive argc,argv // conversion when coming from dialog side of things where it is parsed char *c; for(c = srl[2]->s_name; c != NULL && *c != '\0'; c++) { if(*c == '\v') { *c = ' '; } } x->x_snd_unexpanded=srl[0]; srl[0]=canvas_realizedollar(x->x_glist, srl[0]); x->x_rcv_unexpanded=srl[1]; srl[1]=canvas_realizedollar(x->x_glist, srl[1]); x->x_lab_unexpanded=srl[2]; srl[2]=canvas_realizedollar(x->x_glist, srl[2]); if(srl[1]!=x->x_rcv) { if(iemgui_has_rcv(x)) pd_unbind((t_pd *)x, x->x_rcv); x->x_rcv = srl[1]; pd_bind((t_pd *)x, x->x_rcv); } x->x_snd = srl[0]; x->x_lab = srl[2]; if(f<0 || f>2) f=0; x->x_font_style = f; iemgui_verify_snd_ne_rcv(x); canvas_dirty(x->x_glist, 1); return oldsndrcvable; }
static void collcommon_modified(t_collcommon *cc, int relinked) { if (cc->c_increation) return; if (relinked) { cc->c_volatile = 1; } if (cc->c_embedflag) { t_coll *x; for (x = cc->c_refs; x; x = x->x_next) if (x->x_canvas && glist_isvisible(x->x_canvas)) canvas_dirty(x->x_canvas, 1); } }