Skip to content

Commit

Permalink
avoid doing a move_objects(RUBBER,...) if doing an "xschem paste xoff…
Browse files Browse the repository at this point in the history
…s yoffs" from script, to avoid graphical artifacts
  • Loading branch information
StefanSchippers committed Sep 12, 2023
1 parent c5420f4 commit 55fcf5d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
22 changes: 14 additions & 8 deletions src/paste.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,16 @@ static void merge_inst(int k,FILE *fd)
xctx->instances++;
}

/* merge selection if selection_load=1, otherwise ask for filename */
/* selection_load: */
/* 0: ask filename to merge */
/* if ext=="" else use ext as name ... 20071215 */
/* 1: merge selection */
/* 2: merge clipboard */
/* merge selection if selection_load=1, otherwise ask for filename
* selection_load:
* 0: ask filename to merge
* if ext=="" else use ext as name
* 1: merge selection
* 2: merge clipboard
* if bit 3 is set do not start a move_objects(RUBBER,0,0,0)
* to avoid graphical artifacts if doing a xschem paste with x and y offsets
* from script
*/
void merge_file(int selection_load, const char ext[])
{
FILE *fd;
Expand All @@ -298,8 +302,10 @@ void merge_file(int selection_load, const char ext[])
char tmp[256]; /* 20161122 overflow safe */
char *aux_ptr=NULL;
int got_mouse, generator = 0;
int rubber = 1;


rubber = !(selection_load & 8);
selection_load &= 7;
if(selection_load==0)
{
if(!strcmp(ext,"")) {
Expand Down Expand Up @@ -425,7 +431,7 @@ void merge_file(int selection_load, const char ext[])
move_objects(START,0,0,0);
xctx->mousex_snap = xctx->mx_double_save;
xctx->mousey_snap = xctx->my_double_save;
move_objects(RUBBER,0,0,0);
if(rubber) move_objects(RUBBER,0,0,0);
} else {
dbg(0, "merge_file(): can not open %s\n", name);
}
Expand Down
4 changes: 3 additions & 1 deletion src/scheduler.c
Original file line number Diff line number Diff line change
Expand Up @@ -2464,11 +2464,13 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
* Paste clipboard. If 'x y' not given user should complete placement in the GUI */
else if(!strcmp(argv[1], "paste"))
{
merge_file(2, ".sch");
if(argc > 3) {
merge_file(10, ".sch"); /* set bit 3 to avoid doing move_objects(RUBBER,...) */
xctx->deltax = atof(argv[2]);
xctx->deltay = atof(argv[3]);
move_objects(END, 0, 0.0, 0.0);
} else {
merge_file(2, ".sch");
}
Tcl_ResetResult(interp);
}
Expand Down

0 comments on commit 55fcf5d

Please sign in to comment.