示例#1
0
void collabclient_performLocalRedo( CharViewBase *cv )
{
#ifdef BUILD_COLLAB

    cloneclient_t* cc = cv->fv->collabClient;
    if( !cc )
	return;

    printf("collabclient_performLocalRedo() cv:%p\n", cv );
    printf("collabclient_performLocalRedo() dm:%d\n", cv->drawmode );
    printf("collabclient_performLocalRedo() preserveUndo:%p\n", cc->preserveUndo );
    Undoes *undo = cv->layerheads[cv->drawmode]->redoes;
    printf("collabclient_performLocalRedo() undo:%p\n", undo );

    if( undo )
    {
	cv->layerheads[cv->drawmode]->redoes = undo->next;
	undo->next = 0;
	collabclient_sendRedo_Internal_CV( cv, undo, 0 );
	undo->next = 0;
	UndoesFree( undo );
    }
    cc->preserveUndo = 0;

#endif
}
示例#2
0
void collabclient_performLocalUndo( CharViewBase *cv )
{
#ifdef BUILD_COLLAB

    Undoes *undo = cv->layerheads[cv->drawmode]->undoes;
    if( undo )
    {
	printf("undo:%p\n", undo );
	cv->layerheads[cv->drawmode]->undoes = undo->next;
	undo->next = 0;
	collabclient_sendRedo_Internal_CV( cv, undo, 1 );
	UndoesFree( undo );
    }
    cloneclient_t* cc = cv->fv->collabClient;
    cc->preserveUndo = 0;

#endif
}
示例#3
0
int SVAttachFV(FontView *fv,int ask_if_difficult) {
    int i, doit, pos, any=0, gid;
    RefChar *r, *rnext, *rprev;

    if ( searcher==NULL )
return( false );

    if ( searcher->sd.fv==(FontViewBase *) fv )
return( true );
    if ( searcher->sd.fv!=NULL && searcher->sd.fv->sf==fv->b.sf ) {
	((FontView *) searcher->sd.fv)->sv = NULL;
	fv->sv = searcher;
	searcher->sd.fv = (FontViewBase *) fv;
	SVSetTitle(searcher);
	searcher->sd.curchar = NULL;
return( true );
    }

    if ( searcher->dummy_sf.layers[ly_fore].order2 != fv->b.sf->layers[ly_fore].order2 ) {
	SCClearContents(&searcher->sd.sc_srch,ly_fore);
	SCClearContents(&searcher->sd.sc_rpl,ly_fore);
	for ( i=0; i<searcher->sd.sc_srch.layer_cnt; ++i )
	    UndoesFree(searcher->sd.sc_srch.layers[i].undoes);
	for ( i=0; i<searcher->sd.sc_rpl.layer_cnt; ++i )
	    UndoesFree(searcher->sd.sc_rpl.layers[i].undoes);
    }

    for ( doit=!ask_if_difficult; doit<=1; ++doit ) {
	for ( i=0; i<2; ++i ) {
	    rprev = NULL;
	    for ( r = searcher->chars[i]->layers[ly_fore].refs; r!=NULL; r=rnext ) {
		rnext = r->next;
		pos = SFFindSlot(fv->b.sf,fv->b.map,r->sc->unicodeenc,r->sc->name);
		gid = -1;
		if ( pos!=-1 )
		    gid = fv->b.map->map[pos];
		if ( (gid==-1 || fv->b.sf->glyphs[gid]!=NULL) && !doit ) {
		    char *buttons[3];
		    buttons[0] = _("Yes");
		    buttons[1] = _("Cancel");
		    buttons[2] = NULL;
		    if ( ask_if_difficult==2 && !searcher->isvisible )
return( false );
		    if ( gwwv_ask(_("Bad Reference"),(const char **) buttons,1,1,
			    _("The %1$s in the search dialog contains a reference to %2$.20hs which does not exist in the new font.\nShould I remove the reference?"),
				i==0?_("Search Pattern"):_("Replace Pattern"),
			        r->sc->name)==1 )
return( false );
		} else if ( !doit )
		    /* Do Nothing */;
		else if ( gid==-1 || fv->b.sf->glyphs[gid]!=NULL ) {
		    if ( rprev==NULL )
			searcher->chars[i]->layers[ly_fore].refs = rnext;
		    else
			rprev->next = rnext;
		    RefCharFree(r);
		    any = true;
		} else {
		    /*SplinePointListsFree(r->layers[0].splines); r->layers[0].splines = NULL;*/
		    r->sc = fv->b.sf->glyphs[gid];
		    r->orig_pos = gid;
		    SCReinstanciateRefChar(searcher->chars[i],r,fv->b.active_layer);
		    any = true;
		    rprev = r;
		}
	    }
	}
    }
    fv->sv = searcher;
    searcher->sd.fv = (FontViewBase *) fv;
    searcher->sd.curchar = NULL;
    if ( any ) {
	GDrawRequestExpose(searcher->cv_srch.v,NULL,false);
	GDrawRequestExpose(searcher->cv_rpl.v,NULL,false);
    }
    SVSetTitle(searcher);
return( true );
}
示例#4
0
void collabclient_sendRedo_SC( SplineChar *sc, int layer )
{
#ifdef BUILD_COLLAB

    if( layer == UNDO_LAYER_UNKNOWN )
    {
	layer = ly_fore;
    }
    

    FontViewBase* fv = sc->parent->fv;
    cloneclient_t* cc = fv->collabClient;
    if( !cc )
	return;

    printf("collabclient_sendRedo(SC) fv:%p layer:%d\n", fv, layer );
    printf("collabclient_sendRedo() preserveUndo:%p\n", cc->preserveUndo );
    if( !cc->preserveUndo )
	return;

    if( DEBUG_SHOW_SFD_CHUNKS )
	dumpUndoChain( "start of collabclient_sendRedo()", sc, sc->layers[layer].undoes );
    if( true )
    {
	Undoes* undo = sc->layers[layer].undoes;
	while( undo && undo->undotype == ut_statehint )
	{
	    undo = undo->next;
	    // FIXME: throwing away the statehints for now.
	}
	sc->layers[layer].undoes = undo;
    }

#if 0    
    // This is a special case for testing metricsview
    // for undo chains 3,1,7: ut_statehint, ut_state, ut_width
    {
	Undoes* undo = sc->layers[layer].undoes;
	if( undo && undo->next && undo->undotype == ut_state && undo->next->undotype == ut_width )
	    undo = undo->next;
	// FIXME: throwing away info here, should do better.
	sc->layers[layer].undoes = undo;
    }
#endif
    if( DEBUG_SHOW_SFD_CHUNKS )
	dumpUndoChain( "start of collabclient_sendRedo(2)", sc, sc->layers[layer].undoes );

    
    SCDoUndo( sc, layer );
//    CVDoUndo( cv );
    Undoes *undo = sc->layers[layer].redoes;
    printf("collabclient_sendRedo() undo:%p\n", undo );

    if( undo )
    {
	sc->layers[layer].redoes = undo->next;
	collabclient_sendRedo_Internal( fv, sc, undo, 0 );
	undo->next = 0;
	UndoesFree( undo );
    }
    cc->preserveUndo = 0;

#endif
}