mirror of
git://projects.qi-hardware.com/fped.git
synced 2024-11-22 17:24:03 +02:00
Finally found a nice way to draw arcs in the GUI.
- we freed a package's samples list after recalculating the number of samples, which caused a crash after adding a new vector. We now record the original list length in the package structure. - when dragging a circle, offer the end point first, so that it becomes an arc git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5480 99fdad57-331a-0410-800a-d7fa5415bdb3
This commit is contained in:
parent
de044ca61f
commit
37b52f23fe
1
TODO
1
TODO
@ -35,7 +35,6 @@ Bugs:
|
|||||||
- whenever we call parse_* for input parsing, we may leak lots of expressions
|
- whenever we call parse_* for input parsing, we may leak lots of expressions
|
||||||
- can't edit measurement labels through the GUI
|
- can't edit measurement labels through the GUI
|
||||||
- r of rpads is misleading, particularly if we have a circle
|
- r of rpads is misleading, particularly if we have a circle
|
||||||
- we can't enter an arc through the GUI / can't convert a circle to an arc
|
|
||||||
- using variables in a measurement offset causes a crash because evaluation
|
- using variables in a measurement offset causes a crash because evaluation
|
||||||
takes place after all table entries have been visited
|
takes place after all table entries have been visited
|
||||||
|
|
||||||
|
20
gui_tool.c
20
gui_tool.c
@ -471,12 +471,10 @@ struct pix_buf *draw_move_arc(struct inst *inst, struct coord pos, int i)
|
|||||||
case 0:
|
case 0:
|
||||||
c = pos;
|
c = pos;
|
||||||
break;
|
break;
|
||||||
case 1:
|
|
||||||
from = pos;
|
|
||||||
if (inst->obj->u.arc.start != inst->obj->u.arc.end)
|
|
||||||
break;
|
|
||||||
/* fall through */
|
|
||||||
case 2:
|
case 2:
|
||||||
|
from = pos;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
to = pos;
|
to = pos;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -502,7 +500,7 @@ struct pix_buf *draw_move_arc(struct inst *inst, struct coord pos, int i)
|
|||||||
buf = save_pix_buf(DA,
|
buf = save_pix_buf(DA,
|
||||||
c.x-r_save, c.y-r_save, c.x+r_save, c.y+r_save, 1);
|
c.x-r_save, c.y-r_save, c.x+r_save, c.y+r_save, 1);
|
||||||
draw_arc(DA, gc_drag, FALSE, c.x, c.y, r, a1, a2);
|
draw_arc(DA, gc_drag, FALSE, c.x, c.y, r, a1, a2);
|
||||||
if (i == 2) {
|
if (i == 1) {
|
||||||
end = rotate_r(c, r_save, -a2);
|
end = rotate_r(c, r_save, -a2);
|
||||||
gdk_draw_line(DA, gc_drag, c.x, c.y, end.x, end.y);
|
gdk_draw_line(DA, gc_drag, c.x, c.y, end.x, end.y);
|
||||||
}
|
}
|
||||||
@ -514,19 +512,15 @@ void do_move_to_arc(struct inst *inst, struct inst *to, int i)
|
|||||||
{
|
{
|
||||||
struct vec *vec = inst_get_vec(to);
|
struct vec *vec = inst_get_vec(to);
|
||||||
struct obj *obj = inst->obj;
|
struct obj *obj = inst->obj;
|
||||||
int is_circle;
|
|
||||||
|
|
||||||
is_circle = obj->u.arc.start == obj->u.arc.end;
|
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case 0:
|
case 0:
|
||||||
obj->base = vec;
|
obj->base = vec;
|
||||||
break;
|
break;
|
||||||
case 1:
|
|
||||||
obj->u.arc.start = vec;
|
|
||||||
if (!is_circle)
|
|
||||||
break;
|
|
||||||
/* fall through */
|
|
||||||
case 2:
|
case 2:
|
||||||
|
obj->u.arc.start = vec;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
obj->u.arc.end = vec;
|
obj->u.arc.end = vec;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
11
inst.c
11
inst.c
@ -737,9 +737,13 @@ static int arc_op_anchors(struct inst *inst, struct vec ***anchors)
|
|||||||
{
|
{
|
||||||
struct obj *obj = inst->obj;
|
struct obj *obj = inst->obj;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Put end point first so that this is what we grab if dragging a
|
||||||
|
* circle (thereby turning it into an arc).
|
||||||
|
*/
|
||||||
anchors[0] = &obj->base;
|
anchors[0] = &obj->base;
|
||||||
anchors[1] = &obj->u.arc.start;
|
anchors[1] = &obj->u.arc.end;
|
||||||
anchors[2] = &obj->u.arc.end;
|
anchors[2] = &obj->u.arc.start;
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -959,6 +963,7 @@ void inst_select_pkg(const char *name)
|
|||||||
(*pkg)->next_inst[prio] = &(*pkg)->insts[prio];
|
(*pkg)->next_inst[prio] = &(*pkg)->insts[prio];
|
||||||
(*pkg)->samples =
|
(*pkg)->samples =
|
||||||
zalloc_size(sizeof(struct sample *)*n_samples);
|
zalloc_size(sizeof(struct sample *)*n_samples);
|
||||||
|
(*pkg)->n_samples = n_samples;
|
||||||
}
|
}
|
||||||
curr_pkg = *pkg;
|
curr_pkg = *pkg;
|
||||||
}
|
}
|
||||||
@ -986,7 +991,7 @@ static void free_pkgs(struct pkg *pkg)
|
|||||||
next = inst->next;
|
next = inst->next;
|
||||||
free(inst);
|
free(inst);
|
||||||
}
|
}
|
||||||
reset_samples(pkg->samples);
|
reset_samples(pkg->samples, pkg->n_samples);
|
||||||
free(pkg->samples);
|
free(pkg->samples);
|
||||||
free(pkg);
|
free(pkg);
|
||||||
pkg = next_pkg;
|
pkg = next_pkg;
|
||||||
|
1
inst.h
1
inst.h
@ -114,6 +114,7 @@ struct pkg {
|
|||||||
struct inst *insts[ip_n];
|
struct inst *insts[ip_n];
|
||||||
struct inst **next_inst[ip_n];
|
struct inst **next_inst[ip_n];
|
||||||
struct sample **samples;
|
struct sample **samples;
|
||||||
|
int n_samples;
|
||||||
struct pkg *next;
|
struct pkg *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
4
meas.c
4
meas.c
@ -27,12 +27,12 @@ int n_samples;
|
|||||||
struct num eval_unit(const struct expr *expr, const struct frame *frame);
|
struct num eval_unit(const struct expr *expr, const struct frame *frame);
|
||||||
|
|
||||||
|
|
||||||
void reset_samples(struct sample **samples)
|
void reset_samples(struct sample **samples, int n)
|
||||||
{
|
{
|
||||||
struct sample *next;
|
struct sample *next;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i != n_samples; i++)
|
for (i = 0; i != n; i++)
|
||||||
while (samples[i]) {
|
while (samples[i]) {
|
||||||
next = samples[i]->next;
|
next = samples[i]->next;
|
||||||
free(samples[i]);
|
free(samples[i]);
|
||||||
|
2
meas.h
2
meas.h
@ -60,7 +60,7 @@ struct coord meas_find_next(lt_op_type lt, const struct sample *s,
|
|||||||
struct coord meas_find_max(lt_op_type lt, const struct sample *s);
|
struct coord meas_find_max(lt_op_type lt, const struct sample *s);
|
||||||
|
|
||||||
|
|
||||||
void reset_samples(struct sample **samples);
|
void reset_samples(struct sample **samples, int n);
|
||||||
void meas_start(void);
|
void meas_start(void);
|
||||||
void meas_post(const struct vec *vec, struct coord pos);
|
void meas_post(const struct vec *vec, struct coord pos);
|
||||||
int instantiate_meas(void);
|
int instantiate_meas(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user