fix a regression in merge_file(0,...) from user provided file being aborted
This commit is contained in:
parent
71b1b52384
commit
132d335757
|
|
@ -1867,7 +1867,7 @@ int rstate; /* (reduced state, without ShiftMask) */
|
||||||
unselect_all(1);
|
unselect_all(1);
|
||||||
}
|
}
|
||||||
/* xschem window *receiving* selected objects selection cleared --> abort */
|
/* xschem window *receiving* selected objects selection cleared --> abort */
|
||||||
else if(!xctx->paste_from && stat(sel_file, &buf) && (xctx->ui_state & STARTMERGE)) {
|
else if(xctx->paste_from == 1 && stat(sel_file, &buf) && (xctx->ui_state & STARTMERGE)) {
|
||||||
abort_operation();
|
abort_operation();
|
||||||
}
|
}
|
||||||
/*xschem window *receiving* selected objects
|
/*xschem window *receiving* selected objects
|
||||||
|
|
|
||||||
|
|
@ -913,6 +913,7 @@ void move_objects(int what, int merge, double dx, double dy)
|
||||||
}
|
}
|
||||||
if(what & ABORT) /* draw objects while moving */
|
if(what & ABORT) /* draw objects while moving */
|
||||||
{
|
{
|
||||||
|
xctx->paste_from = 0;
|
||||||
draw_selection(xctx->gctiled,0);
|
draw_selection(xctx->gctiled,0);
|
||||||
if(xctx->kissing) {
|
if(xctx->kissing) {
|
||||||
pop_undo(0, 0);
|
pop_undo(0, 0);
|
||||||
|
|
|
||||||
10
src/paste.c
10
src/paste.c
|
|
@ -309,6 +309,7 @@ void merge_file(int selection_load, const char ext[])
|
||||||
|
|
||||||
rubber = !(selection_load & 8);
|
rubber = !(selection_load & 8);
|
||||||
selection_load &= 7;
|
selection_load &= 7;
|
||||||
|
xctx->paste_from = 0;
|
||||||
if(selection_load==0)
|
if(selection_load==0)
|
||||||
{
|
{
|
||||||
if(!strcmp(ext,"")) {
|
if(!strcmp(ext,"")) {
|
||||||
|
|
@ -317,6 +318,7 @@ void merge_file(int selection_load, const char ext[])
|
||||||
if(!strcmp(tclresult(),"")) return;
|
if(!strcmp(tclresult(),"")) return;
|
||||||
my_strncpy(filename, (char *)tclresult(), S(filename));
|
my_strncpy(filename, (char *)tclresult(), S(filename));
|
||||||
name = filename;
|
name = filename;
|
||||||
|
xctx->paste_from = 3;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
my_strncpy(filename, ext, S(filename));
|
my_strncpy(filename, ext, S(filename));
|
||||||
|
|
@ -327,11 +329,12 @@ void merge_file(int selection_load, const char ext[])
|
||||||
else if(selection_load==1)
|
else if(selection_load==1)
|
||||||
{
|
{
|
||||||
name = sel_file;
|
name = sel_file;
|
||||||
|
xctx->paste_from = 1;
|
||||||
}
|
}
|
||||||
else /* selection_load==2, clipboard load */
|
else /* selection_load==2, clipboard load */
|
||||||
{
|
{
|
||||||
name = clip_file;
|
name = clip_file;
|
||||||
xctx->paste_from = 1;
|
xctx->paste_from = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_generator(name)) generator = 1;
|
if(is_generator(name)) generator = 1;
|
||||||
|
|
@ -431,14 +434,15 @@ void merge_file(int selection_load, const char ext[])
|
||||||
else fclose(fd);
|
else fclose(fd);
|
||||||
|
|
||||||
xctx->ui_state |= STARTMERGE;
|
xctx->ui_state |= STARTMERGE;
|
||||||
dbg(1, "merge_file(): loaded file:wire=%d inst=%d ui_state=%ld\n",
|
dbg(1, "End merge_file(): loaded file %s: wire=%d inst=%d ui_state=%ld\n",
|
||||||
xctx->wires , xctx->instances, xctx->ui_state);
|
name, xctx->wires , xctx->instances, xctx->ui_state);
|
||||||
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;
|
||||||
if(rubber) 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);
|
||||||
|
xctx->paste_from = 0;
|
||||||
}
|
}
|
||||||
set_modify(1);
|
set_modify(1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -948,7 +948,9 @@ typedef struct {
|
||||||
int simdata_ninst;
|
int simdata_ninst;
|
||||||
int modified;
|
int modified;
|
||||||
int semaphore;
|
int semaphore;
|
||||||
int paste_from; /* set to non zero if paste from clipboard is called */
|
int paste_from; /* set to 1 if paste from clipboard is called ,
|
||||||
|
* 2 if paste from selection
|
||||||
|
* 3 if paste from user provided file */
|
||||||
size_t tok_size;
|
size_t tok_size;
|
||||||
char netlist_name[PATH_MAX];
|
char netlist_name[PATH_MAX];
|
||||||
char current_dirname[PATH_MAX];
|
char current_dirname[PATH_MAX];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue