add "connect by kissing (edit menu)" option, whereas separating with a move operation touching pins creates a net in between
This commit is contained in:
parent
f0d856560f
commit
74ebc3d887
|
|
@ -652,6 +652,71 @@ void enable_layers(void)
|
|||
}
|
||||
}
|
||||
|
||||
void connect_by_kissing(void)
|
||||
{
|
||||
xSymbol *symbol;
|
||||
int npin, i, j;
|
||||
double x0,y0, pinx0, piny0;
|
||||
short flip, rot;
|
||||
xRect *rct;
|
||||
int k,ii, kissing;
|
||||
Wireentry *wptr;
|
||||
Instpinentry *iptr;
|
||||
int sqx, sqy;
|
||||
|
||||
rebuild_selected_array();
|
||||
k = xctx->lastsel;
|
||||
prepare_netlist_structs(0);
|
||||
for(j=0;j<k;j++) if(xctx->sel_array[j].type==ELEMENT) {
|
||||
x0 = xctx->inst[xctx->sel_array[j].n].x0;
|
||||
y0 = xctx->inst[xctx->sel_array[j].n].y0;
|
||||
rot = xctx->inst[xctx->sel_array[j].n].rot;
|
||||
flip = xctx->inst[xctx->sel_array[j].n].flip;
|
||||
symbol = xctx->sym + xctx->inst[xctx->sel_array[j].n].ptr;
|
||||
npin = symbol->rects[PINLAYER];
|
||||
rct=symbol->rect[PINLAYER];
|
||||
for(i=0;i<npin;i++) {
|
||||
pinx0 = (rct[i].x1+rct[i].x2)/2;
|
||||
piny0 = (rct[i].y1+rct[i].y2)/2;
|
||||
ROTATION(rot, flip, 0.0, 0.0, pinx0, piny0, pinx0, piny0);
|
||||
pinx0 += x0;
|
||||
piny0 += y0;
|
||||
get_square(pinx0, piny0, &sqx, &sqy);
|
||||
iptr=xctx->instpin_spatial_table[sqx][sqy];
|
||||
wptr=xctx->wire_spatial_table[sqx][sqy];
|
||||
kissing=0;
|
||||
while(iptr) {
|
||||
ii = iptr->n;
|
||||
if(ii == xctx->sel_array[j].n) {
|
||||
iptr = iptr->next;
|
||||
continue;
|
||||
}
|
||||
if( iptr->x0 == pinx0 && iptr->y0 == piny0 && xctx->inst[ii].sel == 0) {
|
||||
kissing=1;
|
||||
break;
|
||||
}
|
||||
iptr = iptr->next;
|
||||
}
|
||||
while(wptr) {
|
||||
if( touch(xctx->wire[wptr->n].x1, xctx->wire[wptr->n].y1,
|
||||
xctx->wire[wptr->n].x2, xctx->wire[wptr->n].y2, pinx0, piny0) &&
|
||||
xctx->wire[wptr->n].sel) {
|
||||
kissing=0;
|
||||
break;
|
||||
}
|
||||
wptr = wptr->next;
|
||||
}
|
||||
if(kissing) {
|
||||
|
||||
dbg(1, "connect_by_kissing(): adding wire in %g %g, wires before = %d\n", pinx0, piny0, xctx->wires);
|
||||
storeobject(-1, pinx0, piny0, pinx0, piny0, WIRE, 0, SELECTED1, NULL);
|
||||
xctx->need_reb_sel_arr = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
rebuild_selected_array();
|
||||
}
|
||||
|
||||
void attach_labels_to_inst(int interactive) /* offloaded from callback.c 20171005 */
|
||||
{
|
||||
xSymbol *symbol;
|
||||
|
|
@ -782,8 +847,6 @@ void attach_labels_to_inst(int interactive) /* offloaded from callback.c 201710
|
|||
}
|
||||
if(!skip) {
|
||||
my_strdup(9, &prop, "name=p1 lab=");
|
||||
|
||||
|
||||
if(use_label_prefix) {
|
||||
my_strcat(10, &prop, (char *)tclgetvar("custom_label_prefix"));
|
||||
}
|
||||
|
|
@ -823,6 +886,7 @@ void attach_labels_to_inst(int interactive) /* offloaded from callback.c 201710
|
|||
draw();
|
||||
bbox(END , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
}
|
||||
|
||||
void delete_files(void)
|
||||
{
|
||||
char str[PATH_MAX + 100];
|
||||
|
|
|
|||
|
|
@ -1039,6 +1039,7 @@ void move_objects(int what, int merge, double dx, double dy)
|
|||
xctx->rotatelocal=0;
|
||||
xctx->deltax = xctx->deltay = 0.0;
|
||||
rebuild_selected_array();
|
||||
if(tclgetboolvar("connect_by_kissing")) connect_by_kissing();
|
||||
xctx->movelastsel = xctx->lastsel;
|
||||
if(xctx->lastsel==1 && xctx->sel_array[0].type==ARC &&
|
||||
xctx->arc[c=xctx->sel_array[0].col][n=xctx->sel_array[0].n].sel!=SELECTED) {
|
||||
|
|
|
|||
|
|
@ -2779,7 +2779,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
else if(!strcmp(argv[1],"wire"))
|
||||
{
|
||||
double x1,y1,x2,y2;
|
||||
int pos, save;
|
||||
int pos, save, sel = 0;
|
||||
const char *prop;
|
||||
cmd_found = 1;
|
||||
if(argc>=6) {
|
||||
|
|
@ -2789,11 +2789,12 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
y2=atof(argv[5]);
|
||||
ORDER(x1,y1,x2,y2);
|
||||
pos=-1;
|
||||
if(argc >= 7) pos=atol(argv[6]);
|
||||
if(argc == 8) prop = argv[7];
|
||||
if(argc >= 7) pos=atoi(argv[6]);
|
||||
if(argc >= 8) prop = argv[7];
|
||||
if(argc >= 9) sel = atoi(argv[8]);
|
||||
else prop = NULL;
|
||||
xctx->push_undo();
|
||||
storeobject(pos, x1,y1,x2,y2,WIRE,0,0,prop);
|
||||
storeobject(pos, x1,y1,x2,y2,WIRE,0,sel,prop);
|
||||
xctx->prep_hi_structs=0;
|
||||
xctx->prep_net_structs=0;
|
||||
xctx->prep_hash_wires=0;
|
||||
|
|
|
|||
|
|
@ -1179,6 +1179,7 @@ extern int place_symbol(int pos, const char *symbol_name, double x, double y, sh
|
|||
const char *inst_props, int draw_sym, int first_call, int to_push_undo);
|
||||
extern void place_net_label(int type);
|
||||
extern void attach_labels_to_inst(int interactive);
|
||||
extern void connect_by_kissing(void);
|
||||
extern void delete_files(void);
|
||||
extern int sym_vs_sch_pins(void);
|
||||
extern int match_symbol(const char name[]);
|
||||
|
|
|
|||
|
|
@ -3936,7 +3936,7 @@ proc no_open_dialogs {} {
|
|||
set tctx::global_list {
|
||||
auto_hilight autotrim_wires bespice_listen_port big_grid_points bus_replacement_char
|
||||
cadgrid cadlayers cadsnap cairo_font_name
|
||||
change_lw color_ps colors constrained_move copy_cell custom_label_prefix custom_token dark_colors
|
||||
change_lw color_ps colors connect_by_kissing constrained_move copy_cell custom_label_prefix custom_token dark_colors
|
||||
dark_colorscheme dim_bg dim_value disable_unique_names do_all_inst draw_grid draw_window
|
||||
edit_prop_pos edit_prop_size editprop_sympath edit_symbol_prop_new_sel enable_dim_bg enable_stretch
|
||||
en_hilight_conn_inst filetmp
|
||||
|
|
@ -4376,6 +4376,7 @@ proc build_widgets { {topwin {} } } {
|
|||
-value 1 -accelerator H -command {xschem set constrained_move 1}
|
||||
$topwin.menubar.edit.menu add radiobutton -label "Constrained Vertical move" -variable constrained_move \
|
||||
-value 2 -accelerator V -command {xschem set constrained_move 2}
|
||||
$topwin.menubar.edit.menu add checkbutton -label "Add wire when separating pins" -variable connect_by_kissing
|
||||
$topwin.menubar.edit.menu add command -label "Push schematic" -command "xschem descend" -accelerator E
|
||||
toolbar_create EditPushSch "xschem descend" "Push schematic" $topwin
|
||||
$topwin.menubar.edit.menu add command -label "Push symbol" -command "xschem descend_symbol" -accelerator I
|
||||
|
|
@ -4903,6 +4904,7 @@ set_ne draw_window 0
|
|||
set_ne incr_hilight 1
|
||||
set_ne enable_stretch 0
|
||||
set_ne constrained_move 0
|
||||
set_ne connect_by_kissing 0
|
||||
set_ne draw_grid 1
|
||||
set_ne big_grid_points 0
|
||||
set_ne persistent_command 0
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@
|
|||
#### variable controls hierarchical print
|
||||
#### default value: empty
|
||||
# set noprint_libs {}
|
||||
|
||||
###########################################################################
|
||||
#### CHANGE DEFAULT [] WITH SOME OTHER CHARACTERS FOR BUSSED SIGNALS
|
||||
#### IN SPICE NETLISTS (EXAMPLE: DATA[7] --> DATA<7>)
|
||||
|
|
@ -151,6 +152,10 @@
|
|||
#### default: 0
|
||||
# set persistent_command 1
|
||||
|
||||
#### if set to 1 a wire is inserted when separating components that are
|
||||
#### connected by pins. Default: not enabled (0)
|
||||
# set connect_by_kissing 1
|
||||
|
||||
#### if set to 1 automatically join/trim wires while editing
|
||||
#### this may slow down on rally big designs. Can be disabled via menu
|
||||
#### default: 0
|
||||
|
|
@ -331,4 +336,4 @@ set toolbar_visible 1
|
|||
###########################################################################
|
||||
# default: not enabled. Interface can be changed runtime if only one window
|
||||
# or tab is open.
|
||||
# set tabbed_interface 1
|
||||
set tabbed_interface 1
|
||||
|
|
|
|||
Loading…
Reference in New Issue