mirror of
git://projects.qi-hardware.com/fped.git
synced 2024-11-25 16:12:28 +02:00
Various bugfixes.
- also dump the part name - if given a zero-length vector, draw_arrow now draws a vertical arrow instead of overflowing - fixed angle calculation when drawing and selecting arcs - redraw the screen after deselecting when we begin dragging git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5395 99fdad57-331a-0410-800a-d7fa5415bdb3
This commit is contained in:
parent
995aa4ca04
commit
dc09f3435d
1
TODO
1
TODO
@ -19,7 +19,6 @@ Style:
|
|||||||
|
|
||||||
Bugs:
|
Bugs:
|
||||||
- default silk width has no business being hard-coded in obj.c
|
- default silk width has no business being hard-coded in obj.c
|
||||||
- after moving, arc sometimes wrap the wrong way
|
|
||||||
- undelete only works if not much has changed since the deletion
|
- undelete only works if not much has changed since the deletion
|
||||||
|
|
||||||
Code cleanup:
|
Code cleanup:
|
||||||
|
5
dump.c
5
dump.c
@ -355,9 +355,10 @@ int dump(FILE *file)
|
|||||||
|
|
||||||
fprintf(file, "/* MACHINE-GENERATED ! */\n\n");
|
fprintf(file, "/* MACHINE-GENERATED ! */\n\n");
|
||||||
for (frame = frames; frame; frame = frame->next) {
|
for (frame = frames; frame; frame = frame->next) {
|
||||||
if (!frame->name)
|
if (!frame->name) {
|
||||||
|
fprintf(file, "part \"%s\"\n", part_name);
|
||||||
dump_frame(file, frame, "");
|
dump_frame(file, frame, "");
|
||||||
else {
|
} else {
|
||||||
fprintf(file, "frame %s {\n", frame->name);
|
fprintf(file, "frame %s {\n", frame->name);
|
||||||
dump_frame(file, frame, "\t");
|
dump_frame(file, frame, "\t");
|
||||||
fprintf(file, "}\n\n");
|
fprintf(file, "}\n\n");
|
||||||
|
@ -172,6 +172,7 @@ static gboolean button_press_event(GtkWidget *widget, GdkEventButton *event,
|
|||||||
}
|
}
|
||||||
if (res) {
|
if (res) {
|
||||||
inst_deselect();
|
inst_deselect();
|
||||||
|
redraw();
|
||||||
dragging = 1;
|
dragging = 1;
|
||||||
drag_escaped = 0;
|
drag_escaped = 0;
|
||||||
drag_start = pos;
|
drag_start = pos;
|
||||||
|
20
gui_inst.c
20
gui_inst.c
@ -97,7 +97,12 @@ static void draw_arrow(struct draw_ctx *ctx, GdkGC *gc, int fill,
|
|||||||
struct coord p[3];
|
struct coord p[3];
|
||||||
struct coord side;
|
struct coord side;
|
||||||
|
|
||||||
side = normalize(sub_vec(to, from), len);
|
if (from.x == to.x && from.y == to.y) {
|
||||||
|
side.x = 0;
|
||||||
|
side.y = -len;
|
||||||
|
} else {
|
||||||
|
side = normalize(sub_vec(to, from), len);
|
||||||
|
}
|
||||||
p[0] = add_vec(to, rotate(side, 180-angle));
|
p[0] = add_vec(to, rotate(side, 180-angle));
|
||||||
p[1] = to;
|
p[1] = to;
|
||||||
p[2] = add_vec(to, rotate(side, 180+angle));
|
p[2] = add_vec(to, rotate(side, 180+angle));
|
||||||
@ -267,7 +272,7 @@ unit_type gui_dist_arc(struct inst *self, struct coord pos, unit_type scale)
|
|||||||
struct coord c = self->base;
|
struct coord c = self->base;
|
||||||
struct coord p;
|
struct coord p;
|
||||||
unit_type r, d_min, d;
|
unit_type r, d_min, d;
|
||||||
double angle, a2;
|
double angle, a1, a2;
|
||||||
|
|
||||||
r = self->u.arc.width/scale/2;
|
r = self->u.arc.width/scale/2;
|
||||||
if (r < SELECT_R)
|
if (r < SELECT_R)
|
||||||
@ -297,10 +302,15 @@ unit_type gui_dist_arc(struct inst *self, struct coord pos, unit_type scale)
|
|||||||
/* see if we're close to the part that's actually drawn */
|
/* see if we're close to the part that's actually drawn */
|
||||||
|
|
||||||
angle = theta(c, pos);
|
angle = theta(c, pos);
|
||||||
|
a1 = self->u.arc.a1;
|
||||||
a2 = self->u.arc.a2;
|
a2 = self->u.arc.a2;
|
||||||
if (a2 < self->u.arc.a1)
|
if (angle < 0)
|
||||||
a2 += 180;
|
angle += 360;
|
||||||
return angle >= self->u.arc.a1 && angle <= a2 ? d : -1;
|
if (a2 < a1)
|
||||||
|
a2 += 360;
|
||||||
|
if (angle < a1)
|
||||||
|
angle += 360;
|
||||||
|
return angle >= a1 && angle <= a2 ? d : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -103,8 +103,13 @@ void restore_pix_buf(struct pix_buf *buf)
|
|||||||
void draw_arc(GdkDrawable *da, GdkGC *gc, int fill,
|
void draw_arc(GdkDrawable *da, GdkGC *gc, int fill,
|
||||||
int x, int y, int r, double a1, double a2)
|
int x, int y, int r, double a1, double a2)
|
||||||
{
|
{
|
||||||
if (a1 == a2)
|
/*
|
||||||
a2 = a1+360;
|
* This adjustment handles two distinct cases:
|
||||||
|
* - if a1 == a2, we make sure we draw a full circle
|
||||||
|
* - the end angle a2 must always be greater than the start angle a1
|
||||||
|
*/
|
||||||
|
if (a2 <= a1)
|
||||||
|
a2 += 360;
|
||||||
gdk_draw_arc(da, gc, fill, x-r, y-r, 2*r, 2*r, a1*64, (a2-a1)*64);
|
gdk_draw_arc(da, gc, fill, x-r, y-r, 2*r, 2*r, a1*64, (a2-a1)*64);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user