ses_layout_draw()
authoryu.dongliang <18588496441@163.com>
Mon, 30 Oct 2023 04:20:47 +0000 (12:20 +0800)
committeryu.dongliang <18588496441@163.com>
Mon, 30 Oct 2023 04:20:47 +0000 (12:20 +0800)
ses_layout.c

index 83073707ea593e789e3e20dd5c33cd10820e06e4..c52b1344aa719370df39603ef1b2a4484f66efcf 100644 (file)
@@ -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;