From 02d01ba898c4448180ed8226c8c446b3bfadc746 Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Mon, 30 Oct 2023 12:20:47 +0800 Subject: [PATCH] ses_layout_draw() --- ses_layout.c | 62 +++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 47 insertions(+), 15 deletions(-) diff --git a/ses_layout.c b/ses_layout.c index 8307370..c52b134 100644 --- a/ses_layout.c +++ b/ses_layout.c @@ -1193,25 +1193,57 @@ int ses_layout_draw(ScfEboard* b, uint32_t bx, uint32_t by, uint32_t bw, uint32_ cairo_line_to (cr, c->x - dx3, c->y - dy3); cairo_rel_move_to(cr, dx0, dy0); cairo_rel_line_to(cr, -dx0 * 2, -dy0 * 2); + cairo_stroke(cr); - cairo_move_to(cr, c->x - dx3, c->y - dy3); - cairo_line_to(cr, c->x + dx3 + dx0, c->y + dy3 + dy0); - cairo_line_to(cr, pe->x, pe->y); + if ((c->x + dx3 + dx0 > c->x + dx3 - dx0 && pe->x > pc->x) + || (c->x + dx3 + dx0 < c->x + dx3 - dx0 && pe->x < pc->x)) { - vertical(&dx1, &dy1, dx3 * 2 + dx0, dy3 * 2 + dy0, 3); - forward (&dx4, &dy4, dx3 * 2 + dx0, dy3 * 2 + dy0, 8); + cairo_set_source_rgb(cr, 0.6, 0.6, 0.0); + cairo_set_line_width(cr, 2); - cairo_move_to(cr, c->x - dx3 + dx4 + dx1, c->y - dy3 + dy4 + dy1); - cairo_line_to(cr, c->x + dx3 + dx0, c->y + dy3 + dy0); - cairo_line_to(cr, c->x - dx3 + dx4 - dx1, c->y - dy3 + dy4 - dy1); - cairo_stroke(cr); + cairo_move_to(cr, c->x - dx3, c->y - dy3); + cairo_line_to(cr, c->x + dx3 + dx0, c->y + dy3 + dy0); + cairo_line_to(cr, pe->x, pe->y); - cairo_set_source_rgb(cr, 0.0, 0.6, 0.0); - cairo_set_line_width(cr, 2.5); - cairo_move_to(cr, c->x - dx3, c->y - dy3); - cairo_line_to(cr, c->x + dx3 - dx0, c->y + dy3 - dy0); - cairo_line_to(cr, pc->x, pc->y); - cairo_stroke(cr); + vertical(&dx1, &dy1, dx3 * 2 + dx0, dy3 * 2 + dy0, 3); + forward (&dx4, &dy4, dx3 * 2 + dx0, dy3 * 2 + dy0, 8); + + cairo_move_to(cr, c->x - dx3 + dx4 + dx1, c->y - dy3 + dy4 + dy1); + cairo_line_to(cr, c->x + dx3 + dx0, c->y + dy3 + dy0); + cairo_line_to(cr, c->x - dx3 + dx4 - dx1, c->y - dy3 + dy4 - dy1); + cairo_stroke(cr); + + cairo_set_source_rgb(cr, 0.0, 0.6, 0.0); + cairo_set_line_width(cr, 2.5); + cairo_move_to(cr, c->x - dx3, c->y - dy3); + cairo_line_to(cr, c->x + dx3 - dx0, c->y + dy3 - dy0); + cairo_line_to(cr, pc->x, pc->y); + cairo_stroke(cr); + + } else { + cairo_set_source_rgb(cr, 0.0, 0.6, 0.0); + cairo_set_line_width(cr, 2.5); + cairo_move_to(cr, c->x - dx3, c->y - dy3); + cairo_line_to(cr, c->x + dx3 + dx0, c->y + dy3 + dy0); + cairo_line_to(cr, pc->x, pc->y); + cairo_stroke(cr); + + cairo_set_source_rgb(cr, 0.6, 0.6, 0.0); + cairo_set_line_width(cr, 2); + + cairo_move_to(cr, c->x - dx3, c->y - dy3); + cairo_line_to(cr, c->x + dx3 - dx0, c->y + dy3 - dy0); + cairo_line_to(cr, pe->x, pe->y); + + vertical(&dx1, &dy1, dx3 * 2 - dx0, dy3 * 2 - dy0, 3); + forward (&dx4, &dy4, dx3 * 2 - dx0, dy3 * 2 - dy0, 8); + + cairo_move_to(cr, c->x - dx3 + dx4 + dx1, c->y - dy3 + dy4 + dy1); + cairo_line_to(cr, c->x + dx3 - dx0, c->y + dy3 - dy0); + cairo_line_to(cr, c->x - dx3 + dx4 - dx1, c->y - dy3 + dy4 - dy1); + + cairo_stroke(cr); + } break; default: break; -- 2.25.1