in intuitive_interface allow to trigger laucher() by ctrl-click (if no mouse is moved), do not clear set_first_sel() data in intuitive_interface when clicking (without moving) multiple objects, better recognize .subckr or .model name in device_model attributes

This commit is contained in:
stefan schippers 2024-04-18 11:40:51 +02:00
parent 83f62bfdf9
commit 69ecb82750
4 changed files with 17 additions and 4 deletions

View File

@ -3712,7 +3712,10 @@ int rstate; /* (reduced state, without ShiftMask) */
!xctx->shape_point_selected && (xctx->ui_state & STARTMOVE) &&
xctx->deltax == 0 && xctx->deltay == 0) {
int savesem = xctx->semaphore;
move_objects(ABORT,0,0,0);
move_objects(ABORT, 0, 0.0, 0.0);
unselect_all(1);
select_object(xctx->mousex, xctx->mousey, SELECTED, 0, NULL);
rebuild_selected_array();
xctx->semaphore = 0;
launcher(); /* works only if lastsel == 1 */
xctx->semaphore = savesem;

View File

@ -580,7 +580,7 @@ void copy_objects(int what)
dbg(1, "end copy: unlink sel_file\n");
xunlink(sel_file);
set_first_sel(0, -1, 0); /* reset first selected object */
if(xctx->deltax != 0 || xctx->deltay != 0) set_first_sel(0, -1, 0); /* reset first selected object */
if(xctx->connect_by_kissing == 2) xctx->connect_by_kissing = 0;
newpropcnt=0;

View File

@ -756,16 +756,19 @@ int set_first_sel(unsigned short type, int n, unsigned int col)
}
}
}
dbg(1, "set_first_sel(): j=%d, i=%d\n", j, xctx->sel_array[j].n);
if(j >= xctx->lastsel) j = 0;
return j;
} else if(n == -1) { /* reset first_sel */
xctx->first_sel.type = 0;
xctx->first_sel.n = -1;
xctx->first_sel.col = 0;
dbg(1, "set_first_sel(): clearing\n");
} else if(xctx->first_sel.n == -1) {
xctx->first_sel.type = type;
xctx->first_sel.n = n;
xctx->first_sel.col = col;
dbg(1, "set_first_sel(): storing %d\n", n);
}
return 0;
}
@ -779,7 +782,7 @@ void unselect_all(int dr)
#endif
set_first_sel(0, -1, 0);
if((xctx->ui_state & SELECTION) || xctx->lastsel) {
dbg(1, "unselect_all(1): start\n");
dbg(1, "unselect_all(%d): start\n", dr);
xctx->ui_state = 0;
xctx->lastsel = 0;
for(i=0;i<xctx->wires; ++i)

View File

@ -144,13 +144,20 @@ static char *model_name(const char *m)
{
char *m_lower = NULL;
char *modelname = NULL;
char *ptr;
int n;
size_t l = strlen(m) + 1;
my_strdup(_ALLOC_ID_, &m_lower, m);
strtolower(m_lower);
my_realloc(_ALLOC_ID_, &modelname, l);
my_realloc(_ALLOC_ID_, &model_name_result, l);
n = sscanf(m_lower, " %s %s", model_name_result, modelname);
if((ptr = strstr(m_lower, ".subckt"))) {
n = sscanf(ptr, ".subckt %s %s", model_name_result, modelname);
} else if((ptr = strstr(m_lower, ".model"))) {
n = sscanf(ptr, ".model %s %s", model_name_result, modelname);
} else {
n = sscanf(m_lower, " %s %s", model_name_result, modelname);
}
if(n<2) my_strncpy(model_name_result, m_lower, l);
else {
/* build a hash key value with no spaces to make device_model attributes with different spaces equivalent*/