mirror of
git://projects.qi-hardware.com/fped.git
synced 2024-11-29 10:55:55 +02:00
In the GUI, pad names were always centered on the pad. In the case of
through-hole pads, this could easily make them disappear into the hole. We now draw them outside the hole. - gui_inst.c: when showing through-hole pads, gui_draw_pad_text now places the pad name into the largest area of the pad outside the hole - test/frame_ref: removed redundant "with" in all titles git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5946 99fdad57-331a-0410-800a-d7fa5415bdb3
This commit is contained in:
parent
82a12023cd
commit
dc1e644da1
66
gui_inst.c
66
gui_inst.c
@ -234,20 +234,18 @@ unit_type gui_dist_pad(struct inst *self, struct coord pos, unit_type scale)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void gui_draw_pad_text(struct inst *self)
|
static void pad_text_in_rect(struct inst *self,
|
||||||
|
struct coord min, struct coord max)
|
||||||
{
|
{
|
||||||
struct coord min = translate(self->base);
|
|
||||||
struct coord max = translate(self->u.pad.other);
|
|
||||||
GdkGC *gc;
|
GdkGC *gc;
|
||||||
struct coord c;
|
struct coord c;
|
||||||
unit_type h, w;
|
unit_type h, w;
|
||||||
int rot;
|
int rot;
|
||||||
|
|
||||||
w = self->bbox.max.x-self->bbox.min.x;
|
w = max.x-min.x;
|
||||||
h = self->bbox.max.y-self->bbox.min.y;
|
h = max.y-min.y;
|
||||||
rot = w/1.1 < h;
|
rot = w/1.1 < h;
|
||||||
gc = gc_ptext[get_mode(self)];
|
gc = gc_ptext[get_mode(self)];
|
||||||
sort_coord(&min, &max);
|
|
||||||
c = add_vec(min, max);
|
c = add_vec(min, max);
|
||||||
h = max.y-min.y;
|
h = max.y-min.y;
|
||||||
w = max.x-min.x;
|
w = max.x-min.x;
|
||||||
@ -257,6 +255,62 @@ static void gui_draw_pad_text(struct inst *self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void maximize_box(struct coord *min_box, struct coord *max_box,
|
||||||
|
unit_type x_min, unit_type y_min, unit_type x_max, unit_type y_max)
|
||||||
|
{
|
||||||
|
unit_type d_box, d_new, d;
|
||||||
|
|
||||||
|
d_box = max_box->x-min_box->x;
|
||||||
|
d = max_box->y-min_box->y;
|
||||||
|
if (d < d_box)
|
||||||
|
d_box = d;
|
||||||
|
|
||||||
|
d_new = x_max-x_min;
|
||||||
|
d = y_max-y_min;
|
||||||
|
if (d < d_new)
|
||||||
|
d_new = d;
|
||||||
|
|
||||||
|
if (d_new < d_box)
|
||||||
|
return;
|
||||||
|
|
||||||
|
min_box->x = x_min;
|
||||||
|
min_box->y = y_min;
|
||||||
|
max_box->x = x_max;
|
||||||
|
max_box->y = y_max;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void gui_draw_pad_text(struct inst *self)
|
||||||
|
{
|
||||||
|
struct coord pad_min = translate(self->base);
|
||||||
|
struct coord pad_max = translate(self->u.pad.other);
|
||||||
|
struct coord hole_min, hole_max;
|
||||||
|
struct coord box_min, box_max;
|
||||||
|
|
||||||
|
sort_coord(&pad_min, &pad_max);
|
||||||
|
if (!self->u.pad.hole) {
|
||||||
|
pad_text_in_rect(self, pad_min, pad_max);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
hole_min = translate(self->u.pad.hole->base);
|
||||||
|
hole_max = translate(self->u.pad.hole->u.hole.other);
|
||||||
|
sort_coord(&hole_min, &hole_max);
|
||||||
|
|
||||||
|
box_min.x = box_min.y = box_max.x = box_max.y;
|
||||||
|
maximize_box(&box_min, &box_max,
|
||||||
|
pad_min.x, pad_min.y, pad_max.x, hole_min.y); /* top */
|
||||||
|
maximize_box(&box_min, &box_max,
|
||||||
|
pad_min.x, hole_max.y, pad_max.x, pad_max.y); /* bottom */
|
||||||
|
maximize_box(&box_min, &box_max,
|
||||||
|
pad_min.x, pad_min.y, hole_min.x, pad_max.y); /* left */
|
||||||
|
maximize_box(&box_min, &box_max,
|
||||||
|
hole_max.x, pad_min.y, pad_max.x, pad_max.y); /* right */
|
||||||
|
|
||||||
|
pad_text_in_rect(self, box_min, box_max);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static GdkGC *pad_gc(const struct inst *inst, int *fill)
|
static GdkGC *pad_gc(const struct inst *inst, int *fill)
|
||||||
{
|
{
|
||||||
*fill = TRUE;
|
*fill = TRUE;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
fped_dump "frame reference: with \"frame\" (origin)" <<EOF
|
fped_dump "frame reference: \"frame\" (origin)" <<EOF
|
||||||
frame f {}
|
frame f {}
|
||||||
frame f @
|
frame f @
|
||||||
EOF
|
EOF
|
||||||
@ -20,7 +20,7 @@ EOF
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
fped_dump "frame reference: with \"%frame\" (current frame origin)" <<EOF
|
fped_dump "frame reference: \"%frame\" (current frame origin)" <<EOF
|
||||||
frame f {}
|
frame f {}
|
||||||
%frame f @
|
%frame f @
|
||||||
EOF
|
EOF
|
||||||
@ -37,7 +37,7 @@ EOF
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
fped_dump "frame reference: with \"%frame\" (current frame vector)" <<EOF
|
fped_dump "frame reference: \"%frame\" (current frame vector)" <<EOF
|
||||||
frame f {}
|
frame f {}
|
||||||
v: vec @(0mm, 0mm)
|
v: vec @(0mm, 0mm)
|
||||||
%frame f v
|
%frame f v
|
||||||
@ -56,7 +56,7 @@ EOF
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
fped_dump "frame reference: with \"%frame\" (other frame origin)" <<EOF
|
fped_dump "frame reference: \"%frame\" (other frame origin)" <<EOF
|
||||||
frame f {}
|
frame f {}
|
||||||
frame g {}
|
frame g {}
|
||||||
%frame f g.@
|
%frame f g.@
|
||||||
@ -77,7 +77,7 @@ EOF
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
fped_dump "frame reference: with \"%frame\" (other frame base)" <<EOF
|
fped_dump "frame reference: \"%frame\" (other frame base)" <<EOF
|
||||||
frame f {}
|
frame f {}
|
||||||
frame g {
|
frame g {
|
||||||
v: vec @(0mm, 0mm)
|
v: vec @(0mm, 0mm)
|
||||||
@ -101,7 +101,7 @@ EOF
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
fped_fail "frame reference: with \"%frame\" (cycle)" <<EOF
|
fped_fail "frame reference: \"%frame\" (cycle)" <<EOF
|
||||||
frame f {
|
frame f {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ EOF
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
fped_dump "frame reference: with \"%frame\" (out-of-order)" <<EOF
|
fped_dump "frame reference: \"%frame\" (out-of-order)" <<EOF
|
||||||
frame f {
|
frame f {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user