1
0
mirror of git://projects.qi-hardware.com/fped.git synced 2024-06-28 14:35:27 +03:00

- fixed precedence of unary minus, so that -(a+b) isn't printed as -a+b

- removed in_path logic (never missed not having it) and made selected vectors
  a little brighter



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5484 99fdad57-331a-0410-800a-d7fa5415bdb3
This commit is contained in:
werner 2009-08-18 23:49:54 +00:00
parent 4920bb96fa
commit 0e0e4ea32d
5 changed files with 10 additions and 36 deletions

View File

@ -111,9 +111,7 @@ static enum mode get_mode(struct inst *self)
{
if (selected_inst == self)
return mode_selected;
if (self->active)
return self->in_path ? mode_active_in_path : mode_active;
return self->in_path ? mode_inactive_in_path : mode_inactive;
return self->active ? mode_active : mode_inactive;
}

View File

@ -49,13 +49,10 @@ static GdkGC *gc(const char *spec, int width)
static void style(GdkGC *gcs[mode_n],
const char *in, const char *in_path, const char *act, const char *act_path,
const char *sel)
const char *in, const char *act, const char *sel)
{
gcs[mode_inactive] = gc(in, 1);
gcs[mode_inactive_in_path] = gc(in_path, 1);
gcs[mode_active] = gc(act, 1);
gcs[mode_active_in_path] = gc(act_path, 1);
gcs[mode_selected] = gc(sel, 2);
}
@ -65,13 +62,13 @@ void gui_setup_style(GdkDrawable *drawable)
gc_bg = gc("#000000", 0);
gc_bg_error = gc("#000040", 0);
gc_drag = gc("#ffffff", 2);
/* inactive in+path active act+path selected */
style(gc_vec, "#202000", "#404020", "#909040", "#c0c080", "#ffff80");
style(gc_obj, "#006060", INVALID, "#00ffff", INVALID, "#ffff80");
style(gc_pad, "#400000", INVALID, "#ff0000", INVALID, "#ffff80");
style(gc_ptext, "#404040", INVALID, "#ffffff", INVALID, "#ffffff");
style(gc_meas, "#280040", INVALID, "#ff00ff", INVALID, "#ffff80");
style(gc_frame, "#004000", "#205020", "#009000", INVALID, "#ffff80");
/* inactive active selected */
style(gc_vec, "#202000", "#b0b050", "#ffff80");
style(gc_obj, "#006060", "#00ffff", "#ffff80");
style(gc_pad, "#400000", "#ff0000", "#ffff80");
style(gc_ptext, "#404040", "#ffffff", "#ffffff");
style(gc_meas, "#280040", "#ff00ff", "#ffff80");
style(gc_frame, "#004000", "#009000", "#ffff80");
gc_active_frame = gc("#00ff00", 2);
// gc_highlight = gc("#ff8020", 2);

18
inst.c
View File

@ -127,25 +127,9 @@ static int inst_connected(const struct inst *inst)
/* ----- selection --------------------------------------------------------- */
static void set_path(int on)
{
struct inst *inst;
return;
if (inst->ops != &vec_ops && inst->ops != &frame_ops)
return;
/* @@@ wrong */
for (inst = selected_inst; inst; inst = inst->outer) {
if (inst->ops != &vec_ops && inst->ops != &frame_ops)
break;
inst->in_path = on;
}
}
static void inst_select_inst(struct inst *inst)
{
selected_inst = inst;
set_path(1);
tool_selected_inst(inst);
gui_frame_select_inst(inst);
if (inst->ops->select)
@ -315,7 +299,6 @@ int inst_anchors(struct inst *inst, struct vec ***anchors)
void inst_deselect(void)
{
if (selected_inst) {
set_path(0);
tool_selected_inst(NULL);
gui_frame_deselect_inst(selected_inst);
}
@ -448,7 +431,6 @@ static struct inst *add_inst(const struct inst_ops *ops, enum inst_prio prio,
inst->base = inst->bbox.min = inst->bbox.max = base;
inst->outer = curr_frame;
inst->active = IS_ACTIVE;
inst->in_path = 0;
inst->next = NULL;
*curr_pkg->next_inst[prio] = inst;
curr_pkg->next_inst[prio] = &inst->next;

3
inst.h
View File

@ -23,9 +23,7 @@
enum mode {
mode_inactive, /* on inactive frame */
mode_inactive_in_path, /* inactive but is in path to selected */
mode_active, /* on active frame */
mode_active_in_path, /* active and is in path to selected */
mode_selected, /* item is selected */
mode_hover, /* hovering over item's contact area */
mode_n /* number of modes */
@ -80,7 +78,6 @@ struct inst {
struct obj *obj; /* NULL if not object */
struct inst *outer; /* frame containing this item */
int active;
int in_path;
union {
struct {
const struct frame *ref;

View File

@ -90,7 +90,7 @@ static char *unparse_op(const struct expr *expr, enum prec prec)
if (expr->op == op_var)
return stralloc(expr->u.var);
if (expr->op == op_minus)
return merge2("-", unparse_op(expr->u.op.a, prec_add));
return merge2("-", unparse_op(expr->u.op.a, prec_unary));
if (expr->op == op_add)
return merge3(unparse_op(expr->u.op.a, prec_add), "+",
unparse_op(expr->u.op.b, prec_add));