copy between windows: allow to navigate between more than 2 windows

This commit is contained in:
stefan schippers 2023-11-28 18:41:38 +01:00
parent e467c5641d
commit 83c692caa9
5 changed files with 15 additions and 16 deletions

View File

@ -115,7 +115,6 @@ void abort_operation(void)
xctx->ui_state &= ~PLACE_SYMBOL;
xctx->ui_state &= ~PLACE_TEXT;
}
return;
}
if(xctx->ui_state & STARTCOPY)
{
@ -1202,25 +1201,25 @@ int rstate; /* (reduced state, without ShiftMask) */
tclvareval(xctx->top_path, ".drw configure -cursor none" , NULL);
else
tclvareval(xctx->top_path, ".drw configure -cursor {}" , NULL);
if(!xctx->sel_or_clip[0]) my_snprintf(xctx->sel_or_clip, S(xctx->sel_or_clip), "%s/%s",
user_conf_dir, ".selection.sch");
/* xschem window *sending* selected objects
when the pointer comes back in abort copy operation since it has been done
in another xschem xctx->window; STARTCOPY set and selection file does not exist any more */
if( stat(xctx->sel_or_clip, &buf) && (xctx->ui_state & STARTCOPY) )
if( stat(sel_or_clip, &buf) && (xctx->ui_state & STARTCOPY) )
{
copy_objects(ABORT); /* also unlinks sel_or_flip file */
unselect_all(1);
}
/* xschem window *receiving* selected objects */
/* no selected objects and selection file exists */
if(xctx->lastsel == 0 && !stat(xctx->sel_or_clip, &buf)) {
/* xschem window *receiving* selected objects selection cleared --> abort */
if(stat(sel_or_clip, &buf) && (xctx->ui_state & STARTMERGE)) {
abort_operation();
}
/*xschem window *receiving* selected objects
* no selected objects and selection file exists --> start merge */
if(xctx->lastsel == 0 && !stat(sel_or_clip, &buf)) {
dbg(2, "callback(): Enter event\n");
xctx->mousex_snap = 490;
xctx->mousey_snap = -340;
merge_file(1, ".sch");
xunlink(xctx->sel_or_clip);
}
break;

View File

@ -174,6 +174,7 @@ int help=0; /* help option set to global scope, printing help is deferred */
FILE *errfp = NULL;
char home_dir[PATH_MAX]; /* home dir obtained via getpwuid */
char user_conf_dir[PATH_MAX];
char sel_or_clip[PATH_MAX]="";
char pwd_dir[PATH_MAX]; /* obtained via getcwd() */
int tcp_port = 0;
int text_svg=1; /* use <text> svg element for text instead of xschem's internal vector font */

View File

@ -512,7 +512,6 @@ void copy_objects(int what)
}
if(what & ABORT) /* draw objects while moving */
{
char *str = NULL; /* 20161122 overflow safe */
draw_selection(xctx->gctiled,0);
if(xctx->kissing) {
@ -523,11 +522,7 @@ void copy_objects(int what)
xctx->move_rot = xctx->move_flip = 0;
xctx->deltax = xctx->deltay = 0.;
xctx->ui_state&=~STARTCOPY;
my_strdup(_ALLOC_ID_, &str, user_conf_dir);
my_strcat(_ALLOC_ID_, &str, "/.selection.sch");
xunlink(str);
update_symbol_bboxes(0, 0);
my_free(_ALLOC_ID_, &str);
}
if(what & RUBBER) /* draw objects while moving */
{
@ -553,6 +548,7 @@ void copy_objects(int what)
{
int l, firstw, firsti;
xunlink(sel_or_clip);
set_first_sel(0, -1, 0); /* reset first selected object */
if(xctx->connect_by_kissing == 2) xctx->connect_by_kissing = 0;

View File

@ -498,7 +498,6 @@ static void alloc_xschem_data(const char *top_path, const char *win_path)
xctx->modified = 0;
xctx->semaphore = 0;
xctx->current_name[0] = '\0';
xctx->sel_or_clip[0] = '\0';
xctx->sch_to_compare[0] = '\0';
xctx->tok_size = 0;
xctx->netlist_name[0] = '\0';
@ -2425,6 +2424,10 @@ int Tcl_AppInit(Tcl_Interp *inter)
}
/* END SOURCING xschemrc */
if(!sel_or_clip[0]) {
my_snprintf(sel_or_clip, S(sel_or_clip), "%s/%s", user_conf_dir, ".selection.sch");
}
if(rainbow_colors) tclsetvar("rainbow_colors","1");
/* */

View File

@ -987,7 +987,6 @@ typedef struct {
/* callback.c */
int already_selected; /* when clicking on an object that is already selected this will be 1 */
int mx_save, my_save, last_command;
char sel_or_clip[PATH_MAX];
int onetime;
/* move.c */
double rx1, rx2, ry1, ry2;
@ -1168,6 +1167,7 @@ extern char *cad_icon[];
extern FILE *errfp;
extern char home_dir[PATH_MAX]; /* home dir obtained via getpwuid */
extern char user_conf_dir[PATH_MAX]; /* usually ~/.xschem */
extern char sel_or_clip[PATH_MAX];
extern char pwd_dir[PATH_MAX]; /* obtained via getcwd() */
extern int tcp_port;
extern int text_svg;