code refactoring (update_conn_cues())

This commit is contained in:
Stefan Frederik 2022-11-07 14:23:57 +01:00
parent 8f055ebb5f
commit ca8ffafe8a
10 changed files with 15 additions and 18 deletions

View File

@ -1900,7 +1900,7 @@ void new_wire(int what, double mx_snap, double my_snap)
}
draw();
if(!big) bbox(END , 0.0 , 0.0 , 0.0 , 0.0);
} else update_conn_cues(1,1);
} else update_conn_cues(WIRELAYER, 1,1);
/* draw_hilight_net(1);*/ /* for updating connection bubbles on hilight nets */
}
if(! (what &END)) {

View File

@ -43,7 +43,7 @@ static int check_breaks(double x1, double y1, double x2, double y2, double x, do
return 0;
}
void update_conn_cues(int draw_cues, int dr_win)
void update_conn_cues(int layer, int draw_cues, int dr_win)
{
int k, i, l, sqx, sqy, save_draw;
Wireentry *wptr;
@ -98,7 +98,6 @@ void update_conn_cues(int draw_cues, int dr_win)
}
dbg(3, "update_conn_cues(): check3\n");
if(draw_cues) {
int cc = xctx->only_probes ? GRIDLAYER : WIRELAYER;
save_draw = xctx->draw_window; xctx->draw_window = dr_win;
for(init_wire_iterator(&ctx, x1, y1, x2, y2); ( wireptr = wire_iterator_next(&ctx) ) ;) {
i = wireptr->n;
@ -106,13 +105,13 @@ void update_conn_cues(int draw_cues, int dr_win)
if(LINE_OUTSIDE(wire[i].x1, wire[i].y1,
wire[i].x2, wire[i].y2, x1, y1, x2, y2)) continue;
if( wire[i].end1 >1 ) {
filledarc(cc, ADD, wire[i].x1, wire[i].y1, cadhalfdotsize, 0, 360);
filledarc(layer, ADD, wire[i].x1, wire[i].y1, cadhalfdotsize, 0, 360);
}
if( wire[i].end2 >1 ) {
filledarc(cc, ADD, wire[i].x2, wire[i].y2, cadhalfdotsize, 0, 360);
filledarc(layer, ADD, wire[i].x2, wire[i].y2, cadhalfdotsize, 0, 360);
}
}
filledarc(cc, END, 0.0, 0.0, 0.0, 0.0, 0.0);
filledarc(layer, END, 0.0, 0.0, 0.0, 0.0, 0.0);
xctx->draw_window = save_draw;
}
}
@ -376,7 +375,7 @@ void trim_wires(void)
} while(changed);
dbg(1, "trim_wires(): doloops=%d changed=%d\n", doloops, changed);
my_free(115, &wireflag);
update_conn_cues(0, 0);
update_conn_cues(WIRELAYER, 0, 0);
}
void break_wires_at_pins(void)
@ -490,6 +489,6 @@ void break_wires_at_pins(void)
xctx->prep_net_structs=0;
xctx->prep_hi_structs=0;
xctx->prep_hash_wires=0;
/*update_conn_cues(0, 0); */
/*update_conn_cues(WIRELAYER, 0, 0); */
}

View File

@ -3405,7 +3405,7 @@ void draw(void)
drawline(cc, ADD, xctx->wire[i].x1,xctx->wire[i].y1,
xctx->wire[i].x2,xctx->wire[i].y2, 0, NULL);
}
update_conn_cues(1, xctx->draw_window);
update_conn_cues(cc, 1, xctx->draw_window);
filledrect(cc, END, 0.0, 0.0, 0.0, 0.0);
drawline(cc, END, 0.0, 0.0, 0.0, 0.0, 0, NULL);
}

View File

@ -686,5 +686,5 @@ void mem_pop_undo(int redo, int set_modify_status)
xctx->prep_hash_wires = 0;
xctx->prep_net_structs = 0;
xctx->prep_hi_structs = 0;
update_conn_cues(0, 0);
update_conn_cues(WIRELAYER, 0, 0);
}

View File

@ -1013,7 +1013,6 @@ void copy_objects(int what)
find_inst_to_be_redrawn(16); /* clear data */
check_collapsing_objects();
if(tclgetboolvar("autotrim_wires")) trim_wires();
/* update_conn_cues(1, 1); */
if(xctx->hilight_nets) {
propagate_hilights(1, 1, XINSERT_NOREPLACE);
}
@ -1522,7 +1521,6 @@ void move_objects(int what, int merge, double dx, double dy)
find_inst_to_be_redrawn(16); /* clear data */
check_collapsing_objects();
if(tclgetboolvar("autotrim_wires")) trim_wires();
/* update_conn_cues(1, 1); */
if(xctx->hilight_nets) {
propagate_hilights(1, 1, XINSERT_NOREPLACE);

View File

@ -891,7 +891,7 @@ void create_ps(char **psfile, int what)
Wireentry *wireptr;
int i;
Iterator_ctx ctx;
update_conn_cues(0, 0);
update_conn_cues(WIRELAYER, 0, 0);
/* draw connecting dots */
x1 = X_TO_XSCHEM(xctx->areax1);
y1 = Y_TO_XSCHEM(xctx->areay1);

View File

@ -2233,7 +2233,7 @@ void load_schematic(int load_symbols, const char *filename, int reset_undo) /* 2
}
check_collapsing_objects();
if(tclgetboolvar("autotrim_wires")) trim_wires();
update_conn_cues(0, 0);
update_conn_cues(WIRELAYER, 0, 0);
if(xctx->hilight_nets && load_symbols) {
propagate_hilights(1, 1, XINSERT_NOREPLACE);
}
@ -2453,7 +2453,7 @@ void pop_undo(int redo, int set_modify_status)
xctx->prep_net_structs=0;
xctx->prep_hi_structs=0;
link_symbols_to_instances(-1);
update_conn_cues(0, 0);
update_conn_cues(WIRELAYER, 0, 0);
if(xctx->hilight_nets) {
propagate_hilights(1, 1, XINSERT_NOREPLACE);
}

View File

@ -444,7 +444,7 @@ void delete(int to_push_undo)
}
if(tclgetboolvar("autotrim_wires")) trim_wires();
del_rect_line_arc_poly();
update_conn_cues(0, 0);
update_conn_cues(WIRELAYER, 0, 0);
if(xctx->hilight_nets) {
propagate_hilights(1, 1, XINSERT_NOREPLACE);
}

View File

@ -853,7 +853,7 @@ void svg_draw(void)
Wireentry *wireptr;
int i;
Iterator_ctx ctx;
update_conn_cues(0, 0);
update_conn_cues(WIRELAYER, 0, 0);
/* draw connecting dots */
x1 = X_TO_XSCHEM(xctx->areax1);
y1 = Y_TO_XSCHEM(xctx->areay1);

View File

@ -1207,7 +1207,7 @@ extern int touch(double,double,double,double,double,double);
extern int rectclip(int,int,int,int,
double*,double*,double*,double*);
extern void trim_wires(void);
extern void update_conn_cues(int draw_cues, int dr_win);
extern void update_conn_cues(int layer, int draw_cues, int dr_win);
extern void break_wires_at_pins(void);
extern void check_touch(int i, int j,