From: yu.dongliang <18588496441@163.com> Date: Tue, 7 Nov 2023 05:57:11 +0000 (+0800) Subject: ses_layout_draw() X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=8751f71e38a7353e3709eaa44fd482088ad8476e;p=ses.git ses_layout_draw() --- diff --git a/ses_layout.c b/ses_layout.c index cbe80f1..dfd058b 100644 --- a/ses_layout.c +++ b/ses_layout.c @@ -1432,8 +1432,6 @@ int ses_layout_draw(ScfEboard* b, uint32_t bx, uint32_t by, uint32_t bw, uint32_ for (j = 0; j < f->n_elines; j++) { el = f->elines[j]; - cairo_set_line_width(cr, 4); - if (SCF_EDA_PIN_POS & el->flags) cairo_set_source_rgb(cr, 1, 0, 0); @@ -1446,18 +1444,17 @@ int ses_layout_draw(ScfEboard* b, uint32_t bx, uint32_t by, uint32_t bw, uint32_ else if (SCF_EDA_PIN_OUT & el->flags) cairo_set_source_rgb(cr, 1, 0, 1); - else if (SCF_EDA_PIN_CF & el->flags) { + else if (SCF_EDA_PIN_CF & el->flags) cairo_set_source_rgb(cr, 1, 0.1, 0.8); - cairo_set_line_width(cr, 2.5); - } else { + else cairo_set_source_rgb(cr, 1, 0.5, 0.1); - cairo_set_line_width(cr, 2); - } uint8_t text[64]; cairo_select_font_face(cr, "Georgia", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD); - cairo_set_font_size (cr, 24); + cairo_set_font_size (cr, 28); + + ScfLine* prev = NULL; for (k = 0; k < el->n_lines; k++) { l = el->lines[k]; @@ -1465,15 +1462,28 @@ int ses_layout_draw(ScfEboard* b, uint32_t bx, uint32_t by, uint32_t bw, uint32_ if (l->x0 > l->x1) continue; - snprintf(text, sizeof(text) - 1, "%ld_%ld", el->id, k); + if (!prev) { + snprintf(text, sizeof(text) - 1, "%ld", el->id); - cairo_move_to (cr, l->x0 - 30, l->y0 - 5); - cairo_show_text(cr, text); + cairo_move_to (cr, l->x0 - 30, l->y0 + 5); + cairo_show_text(cr, text); + } + cairo_set_line_width(cr, 4); cairo_move_to(cr, l->x0, l->y0); cairo_line_to(cr, l->x1, l->y1); - } + cairo_stroke(cr); + if (prev) { + cairo_set_line_width(cr, 1); + + cairo_move_to(cr, prev->x0, prev->y0); + cairo_line_to(cr, l->x0, l->y0); + cairo_stroke(cr); + } + + prev = l; + } cairo_stroke(cr); } }