ses_layout_draw()
authoryu.dongliang <18588496441@163.com>
Tue, 7 Nov 2023 05:57:11 +0000 (13:57 +0800)
committeryu.dongliang <18588496441@163.com>
Tue, 7 Nov 2023 05:57:11 +0000 (13:57 +0800)
ses_layout.c

index cbe80f16078754909b45e1b89d506bfcbb964d9b..dfd058bc9f3209b4ae378a833022011bf061c7f7 100644 (file)
@@ -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);
                }
        }