mirror of
git://projects.qi-hardware.com/fped.git
synced 2025-04-21 12:27:27 +03:00
- previous Makefile change was: tentative fix for compatibility with older
ImageMagick versions (reported by Alvaro Lopes) - we can now also select the frame's origin as a reference - added general frame selection logic - make sure we always use %s when passing names to status_set_name - we can now drag endpoints (in progress) git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5385 99fdad57-331a-0410-800a-d7fa5415bdb3
This commit is contained in:
39
gui_inst.c
39
gui_inst.c
@@ -393,7 +393,8 @@ void gui_draw_meas(struct inst *self, struct draw_ctx *ctx)
|
||||
/* ----- frame ------------------------------------------------------------- */
|
||||
|
||||
|
||||
unit_type gui_dist_frame(struct inst *self, struct coord pos, unit_type scale)
|
||||
unit_type gui_dist_frame_eye(struct inst *self, struct coord pos,
|
||||
unit_type scale)
|
||||
{
|
||||
unit_type d;
|
||||
|
||||
@@ -402,6 +403,40 @@ unit_type gui_dist_frame(struct inst *self, struct coord pos, unit_type scale)
|
||||
}
|
||||
|
||||
|
||||
static unit_type dist_from_corner_line(struct inst *self, struct coord pos,
|
||||
struct coord vec, unit_type scale)
|
||||
{
|
||||
struct coord ref;
|
||||
|
||||
ref.x = self->bbox.min.x;
|
||||
ref.y = self->bbox.max.y;
|
||||
return dist_line(pos, ref, add_vec(ref, vec))/scale;
|
||||
}
|
||||
|
||||
|
||||
unit_type gui_dist_frame(struct inst *self, struct coord pos, unit_type scale)
|
||||
{
|
||||
unit_type d_min, d;
|
||||
struct coord vec;
|
||||
|
||||
d_min = dist_point(pos, self->base)/scale;
|
||||
|
||||
vec.x = FRAME_SHORT_X*scale;
|
||||
vec.y = 0;
|
||||
d = dist_from_corner_line(self, pos, vec, scale);
|
||||
if (d < d_min)
|
||||
d_min = d;
|
||||
|
||||
vec.x = 0;
|
||||
vec.y = FRAME_SHORT_Y*scale;
|
||||
d = dist_from_corner_line(self, pos, vec, scale);
|
||||
if (d < d_min)
|
||||
d_min = d;
|
||||
|
||||
return d_min > SELECT_R ? -1 : d_min;
|
||||
}
|
||||
|
||||
|
||||
void gui_hover_frame(struct inst *self, struct draw_ctx *ctx)
|
||||
{
|
||||
struct coord center = translate(ctx, self->base);
|
||||
@@ -418,7 +453,7 @@ void gui_draw_frame(struct inst *self, struct draw_ctx *ctx)
|
||||
struct coord corner = { self->bbox.min.x, self->bbox.max.y };
|
||||
GdkGC *gc;
|
||||
|
||||
gc = gc_frame[get_mode(self)];
|
||||
gc = self->u.frame.active ? gc_active_frame : gc_frame[get_mode(self)];
|
||||
draw_eye(ctx, gc, center, FRAME_EYE_R1, FRAME_EYE_R2);
|
||||
if (!self->u.frame.ref->name)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user