avoid doing a move_objects(RUBBER,...) if doing an "xschem paste xoffs yoffs" from script, to avoid graphical artifacts
This commit is contained in:
parent
c5420f4f07
commit
55fcf5d28e
22
src/paste.c
22
src/paste.c
|
|
@ -282,12 +282,16 @@ static void merge_inst(int k,FILE *fd)
|
||||||
xctx->instances++;
|
xctx->instances++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* merge selection if selection_load=1, otherwise ask for filename */
|
/* merge selection if selection_load=1, otherwise ask for filename
|
||||||
/* selection_load: */
|
* selection_load:
|
||||||
/* 0: ask filename to merge */
|
* 0: ask filename to merge
|
||||||
/* if ext=="" else use ext as name ... 20071215 */
|
* if ext=="" else use ext as name
|
||||||
/* 1: merge selection */
|
* 1: merge selection
|
||||||
/* 2: merge clipboard */
|
* 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[])
|
void merge_file(int selection_load, const char ext[])
|
||||||
{
|
{
|
||||||
FILE *fd;
|
FILE *fd;
|
||||||
|
|
@ -298,8 +302,10 @@ void merge_file(int selection_load, const char ext[])
|
||||||
char tmp[256]; /* 20161122 overflow safe */
|
char tmp[256]; /* 20161122 overflow safe */
|
||||||
char *aux_ptr=NULL;
|
char *aux_ptr=NULL;
|
||||||
int got_mouse, generator = 0;
|
int got_mouse, generator = 0;
|
||||||
|
int rubber = 1;
|
||||||
|
|
||||||
|
rubber = !(selection_load & 8);
|
||||||
|
selection_load &= 7;
|
||||||
if(selection_load==0)
|
if(selection_load==0)
|
||||||
{
|
{
|
||||||
if(!strcmp(ext,"")) {
|
if(!strcmp(ext,"")) {
|
||||||
|
|
@ -425,7 +431,7 @@ void merge_file(int selection_load, const char ext[])
|
||||||
move_objects(START,0,0,0);
|
move_objects(START,0,0,0);
|
||||||
xctx->mousex_snap = xctx->mx_double_save;
|
xctx->mousex_snap = xctx->mx_double_save;
|
||||||
xctx->mousey_snap = xctx->my_double_save;
|
xctx->mousey_snap = xctx->my_double_save;
|
||||||
move_objects(RUBBER,0,0,0);
|
if(rubber) move_objects(RUBBER,0,0,0);
|
||||||
} else {
|
} else {
|
||||||
dbg(0, "merge_file(): can not open %s\n", name);
|
dbg(0, "merge_file(): can not open %s\n", name);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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 */
|
* Paste clipboard. If 'x y' not given user should complete placement in the GUI */
|
||||||
else if(!strcmp(argv[1], "paste"))
|
else if(!strcmp(argv[1], "paste"))
|
||||||
{
|
{
|
||||||
merge_file(2, ".sch");
|
|
||||||
if(argc > 3) {
|
if(argc > 3) {
|
||||||
|
merge_file(10, ".sch"); /* set bit 3 to avoid doing move_objects(RUBBER,...) */
|
||||||
xctx->deltax = atof(argv[2]);
|
xctx->deltax = atof(argv[2]);
|
||||||
xctx->deltay = atof(argv[3]);
|
xctx->deltay = atof(argv[3]);
|
||||||
move_objects(END, 0, 0.0, 0.0);
|
move_objects(END, 0, 0.0, 0.0);
|
||||||
|
} else {
|
||||||
|
merge_file(2, ".sch");
|
||||||
}
|
}
|
||||||
Tcl_ResetResult(interp);
|
Tcl_ResetResult(interp);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue