r5423 - trunk/eda/fped
werner at docs.openmoko.org
werner at docs.openmoko.org
Wed Aug 12 12:45:52 CEST 2009
Author: werner
Date: 2009-08-12 12:45:52 +0200 (Wed, 12 Aug 2009)
New Revision: 5423
Modified:
trunk/eda/fped/TODO
trunk/eda/fped/dump.c
trunk/eda/fped/dump.h
trunk/eda/fped/gui_frame.c
trunk/eda/fped/gui_frame.h
trunk/eda/fped/gui_style.c
trunk/eda/fped/gui_style.h
trunk/eda/fped/inst.c
trunk/eda/fped/inst.h
trunk/eda/fped/obj.h
Log:
- put hbox around frame table so that it doesn't grow when we give it more
space than it needs
- dump.c: separated ordering function from actual printing
- added list of vectors and object (on the right side of the variables)
Modified: trunk/eda/fped/TODO
===================================================================
--- trunk/eda/fped/TODO 2009-08-11 23:30:58 UTC (rev 5422)
+++ trunk/eda/fped/TODO 2009-08-12 10:45:52 UTC (rev 5423)
@@ -28,6 +28,9 @@
- default silk width has no business being hard-coded in obj.c
- undelete only works if not much has changed since the deletion
- focus should return to canvas if nobody else wants it
+- when in uninstantiated mode, objects can be changed and then manipulated
+ through the unchanged instance. Tricky to fix without an alternate means to
+ access the object list. (Getting there.)
Code cleanup:
- merge edit_unique with edit_name
@@ -67,8 +70,5 @@
- advanced: silk line width
- future: when encountering an error after a change, we could try to find the
same element in the old instance, and select it
-- idea: run the sort algorithm of dump.c to generate a list of objects per
- frame, then show the list per frame in the GUI, e.g., as an alternative to
- the variables. Allow selection.
- future: consider editing non-canvas items in place
- near future: treat part name as pattern
Modified: trunk/eda/fped/dump.c
===================================================================
--- trunk/eda/fped/dump.c 2009-08-11 23:30:58 UTC (rev 5422)
+++ trunk/eda/fped/dump.c 2009-08-12 10:45:52 UTC (rev 5423)
@@ -20,100 +20,17 @@
#include "dump.h"
-/* ----- variables --------------------------------------------------------- */
+/* ----- order items ------------------------------------------------------- */
-static void dump_var(FILE *file, const struct table *table,
- const char *indent)
+static void add_item(struct order **curr, struct vec *vec, struct obj *obj)
{
- char *s;
-
- s = unparse(table->rows->values->expr);
- fprintf(file, "%sset %s = %s\n\n", indent, table->vars->name, s);
- free(s);
+ (*curr)->vec = vec;
+ (*curr)->obj = obj;
+ (*curr)++;
}
-static void dump_table(FILE *file, const struct table *table,
- const char *indent)
-{
- const struct var *var;
- const struct row *row;
- const struct value *value;
- char *s;
-
- if (table->vars && !table->vars->next &&
- table->rows && !table->rows->next) {
- dump_var(file, table, indent);
- return;
- }
- fprintf(file, "%stable\n%s {", indent, indent);
- for (var = table->vars; var; var = var->next)
- fprintf(file, "%s %s", var == table->vars ? "" : ",",
- var->name);
- fprintf(file, " }\n");
- for (row = table->rows; row; row = row->next) {
- fprintf(file, "%s {", indent);
- for (value = row->values; value; value = value->next) {
- s = unparse(value->expr);
- fprintf(file, "%s %s",
- value == row->values? "" : ",", s);
- free(s);
- }
- fprintf(file, " }\n");
- }
- fprintf(file, "\n");
-}
-
-
-static void dump_loop(FILE *file, const struct loop *loop, const char *indent)
-{
- char *from, *to;
-
- from = unparse(loop->from.expr);
- to = unparse(loop->to.expr);
- fprintf(file, "%sloop %s = %s, %s\n\n",
- indent, loop->var.name, from, to);
- free(from);
- free(to);
-}
-
-
-/* ----- vectors and objects ----------------------------------------------- */
-
-
-static char *generate_name(const struct vec *base)
-{
- const struct vec *walk;
- int n;
-
- n = 0;
- for (walk = base->frame->vecs; walk != base; walk = walk->next)
- n++;
- return stralloc_printf("__%d", n);
-}
-
-
-static char *base_name(const struct vec *base, const struct vec *next)
-{
- if (!base)
- return stralloc("@");
- if (next && base->next == next)
- return stralloc(".");
- if (base->name)
- return stralloc(base->name);
- return generate_name(base);
-}
-
-
-static char *obj_base_name(const struct vec *base, const struct vec *prev)
-{
- if (base && base == prev)
- return stralloc(".");
- return base_name(base, NULL);
-}
-
-
static int n_vec_refs(const struct vec *vec)
{
const struct vec *walk;
@@ -171,7 +88,7 @@
}
-static int may_dump_obj_now(const struct obj *obj, const struct vec *prev)
+static int may_put_obj_now(const struct obj *obj, const struct vec *prev)
{
int n, l;
@@ -209,52 +126,201 @@
}
-static const char *meas_type_name[mt_n] = {
- "meas", "measx", "measy",
- "meas", "measx", "measy",
-};
+static void put_obj(struct order **curr, struct obj *obj,
+ struct vec *prev)
+{
+ if (obj->dumped)
+ return;
+ obj->dumped = 1;
+ add_item(curr, prev, obj);
+}
+/*
+ * Tricky logic ahead: when dumping a vector, we search for a vectors that
+ * depends on that vector for ".". If we find one, we dump it immediately after
+ * this vector.
+ */
+static void recurse_vec(struct order **curr, struct vec *vec)
+{
+ struct vec *next;
+ struct obj *obj;
-static void print_meas_base(FILE *file, struct vec *base)
+ add_item(curr, vec, NULL);
+ for (obj = vec->frame->objs; obj; obj = obj->next)
+ if (may_put_obj_now(obj, vec))
+ put_obj(curr, obj, vec);
+ if (n_vec_refs(vec) == 1) {
+ for (next = vec->next; next->base != vec; next = next->next);
+ recurse_vec(curr, next);
+ }
+}
+
+
+static void order_vecs(struct order **curr, struct vec *vecs)
{
- if (base->frame != root_frame)
- fprintf(file, "%s.", base->frame->name);
- fprintf(file, "%s", base->name);
+ struct vec *vec;
+
+ for (vec = vecs; vec; vec = vec->next)
+ if (!vec->base || n_vec_refs(vec->base) != 1)
+ recurse_vec(curr, vec);
}
-static void dump_obj(FILE *file, struct obj *obj, const char *indent,
- const struct vec *prev)
+struct order *order_frame(const struct frame *frame)
{
- char *base, *s1, *s2, *s3;
+ struct order *order, *curr;
+ struct vec *vec;
+ struct obj *obj;
+ int n = 0;
- if (obj->dumped)
+ for (vec = frame->vecs; vec; vec = vec->next)
+ n++;
+ for (obj = frame->objs; obj; obj = obj->next)
+ if (obj->type != ot_meas)
+ n++;
+
+ for (obj = frame->objs; obj; obj = obj->next)
+ obj->dumped = 0;
+
+ order = alloc_size(sizeof(*order)*(n+1));
+ curr = order;
+
+ order_vecs(&curr, frame->vecs);
+
+ /* frames based on @ (anything else ?) */
+ for (obj = frame->objs; obj; obj = obj->next)
+ if (obj->type != ot_meas)
+ put_obj(&curr, obj, NULL);
+
+ assert(curr == order+n);
+ add_item(&curr, NULL, NULL);
+
+ return order;
+}
+
+
+/* ----- variables --------------------------------------------------------- */
+
+
+static void dump_var(FILE *file, const struct table *table,
+ const char *indent)
+{
+ char *s;
+
+ s = unparse(table->rows->values->expr);
+ fprintf(file, "%sset %s = %s\n\n", indent, table->vars->name, s);
+ free(s);
+}
+
+
+static void dump_table(FILE *file, const struct table *table,
+ const char *indent)
+{
+ const struct var *var;
+ const struct row *row;
+ const struct value *value;
+ char *s;
+
+ if (table->vars && !table->vars->next &&
+ table->rows && !table->rows->next) {
+ dump_var(file, table, indent);
return;
- obj->dumped = 1;
+ }
+ fprintf(file, "%stable\n%s {", indent, indent);
+ for (var = table->vars; var; var = var->next)
+ fprintf(file, "%s %s", var == table->vars ? "" : ",",
+ var->name);
+ fprintf(file, " }\n");
+ for (row = table->rows; row; row = row->next) {
+ fprintf(file, "%s {", indent);
+ for (value = row->values; value; value = value->next) {
+ s = unparse(value->expr);
+ fprintf(file, "%s %s",
+ value == row->values? "" : ",", s);
+ free(s);
+ }
+ fprintf(file, " }\n");
+ }
+ fprintf(file, "\n");
+}
+
+
+static void dump_loop(FILE *file, const struct loop *loop, const char *indent)
+{
+ char *from, *to;
+
+ from = unparse(loop->from.expr);
+ to = unparse(loop->to.expr);
+ fprintf(file, "%sloop %s = %s, %s\n\n",
+ indent, loop->var.name, from, to);
+ free(from);
+ free(to);
+}
+
+
+/* ----- vectors and objects ----------------------------------------------- */
+
+
+static char *generate_name(const struct vec *base)
+{
+ const struct vec *walk;
+ int n;
+
+ n = 0;
+ for (walk = base->frame->vecs; walk != base; walk = walk->next)
+ n++;
+ return stralloc_printf("__%d", n);
+}
+
+
+static char *base_name(const struct vec *base, const struct vec *next)
+{
+ if (!base)
+ return stralloc("@");
+ if (next && base->next == next)
+ return stralloc(".");
+ if (base->name)
+ return stralloc(base->name);
+ return generate_name(base);
+}
+
+
+static char *obj_base_name(const struct vec *base, const struct vec *prev)
+{
+ if (base && base == prev)
+ return stralloc(".");
+ return base_name(base, NULL);
+}
+
+
+char *print_obj(const struct obj *obj, const struct vec *prev)
+{
+ char *base, *s, *s1, *s2, *s3;
+
base = obj_base_name(obj->base, prev);
switch (obj->type) {
case ot_frame:
- fprintf(file, "%sframe %s %s\n",
- indent, obj->u.frame.ref->name, base);
+ s = stralloc_printf("frame %s %s",
+ obj->u.frame.ref->name, base);
break;
case ot_line:
s1 = obj_base_name(obj->u.line.other, prev);
s2 = unparse(obj->u.line.width);
- fprintf(file, "%sline %s %s %s\n", indent, base, s1, s2);
+ s = stralloc_printf("line %s %s %s", base, s1, s2);
free(s1);
free(s2);
break;
case ot_rect:
s1 = obj_base_name(obj->u.rect.other, prev);
s2 = unparse(obj->u.rect.width);
- fprintf(file, "%srect %s %s %s\n", indent, base, s1, s2);
+ s = stralloc_printf("rect %s %s %s", base, s1, s2);
free(s1);
free(s2);
break;
case ot_pad:
s1 = obj_base_name(obj->u.pad.other, prev);
- fprintf(file, "%spad \"%s\" %s %s\n", indent,
+ s = stralloc_printf("pad \"%s\" %s %s",
obj->u.pad.name, base, s1);
free(s1);
break;
@@ -262,89 +328,110 @@
s1 = obj_base_name(obj->u.arc.start, prev);
s3 = unparse(obj->u.arc.width);
if (obj->u.arc.start == obj->u.arc.end) {
- fprintf(file, "%scirc %s %s %s\n",
- indent, base, s1, s3);
+ s = stralloc_printf("circ %s %s %s", base, s1, s3);
} else {
s2 = obj_base_name(obj->u.arc.end, prev);
- fprintf(file, "%sarc %s %s %s %s\n", indent,
+ s = stralloc_printf("arc %s %s %s %s",
base, s1, s2, s3);
free(s2);
}
free(s1);
free(s3);
break;
- case ot_meas:
- fprintf(file, "%s%s ", indent,
- meas_type_name[obj->u.meas.type]);
- if (obj->u.meas.label)
- fprintf(file, "\"%s\" ", obj->u.meas.label);
- print_meas_base(file, obj->base);
- fprintf(file, " %s ",
- obj->u.meas.type < 3 ? obj->u.meas.inverted ? "<-" : "->" :
- obj->u.meas.inverted ? "<<" : ">>");
- print_meas_base(file, obj->u.meas.high);
- if (!obj->u.meas.offset)
- fprintf(file, "\n");
- else {
- s1 = unparse(obj->u.meas.offset);
- fprintf(file, " %s\n", s1);
- free(s1);
- }
- break;
default:
abort();
}
free(base);
+ return s;
}
-/*
- * Tricky logic ahead: when dumping a vector, we search for a vectors that
- * depends on that vector for ".". If we find one, we dump it immediately after
- * this vector.
- */
+/* ----- print measurement ------------------------------------------------- */
-static void recurse_vec(FILE *file, const struct vec *vec, const char *indent)
+
+static const char *meas_type_name[mt_n] = {
+ "meas", "measx", "measy",
+ "meas", "measx", "measy",
+};
+
+
+
+static char *print_meas_base(struct vec *base)
{
- const struct vec *next;
- struct obj *obj;
+ if (base->frame == root_frame)
+ return stralloc_printf("%s", base->name);
+ else
+ return stralloc_printf("%s.%s", base->frame->name, base->name);
+}
+
+
+char *print_meas(const struct obj *obj)
+{
+ char *s, *t;
+ char *s1, *s2, *s3;
+
+ assert(obj->type == ot_meas);
+
+ s = stralloc_printf("%s ", meas_type_name[obj->u.meas.type]);
+ if (obj->u.meas.label) {
+ t = stralloc_printf("%s\"%s\" ", s, obj->u.meas.label);
+ free(s);
+ s = t;
+ }
+ s1 = print_meas_base(obj->base);
+ s2 = stralloc_printf(" %s ",
+ obj->u.meas.type < 3 ? obj->u.meas.inverted ? "<-" : "->" :
+ obj->u.meas.inverted ? "<<" : ">>");
+ s3 = print_meas_base(obj->u.meas.high);
+ t = stralloc_printf("%s%s%s%s", s, s1, s2, s3);
+ free(s);
+ free(s1);
+ free(s2);
+ free(s3);
+ s = t;
+
+ if (!obj->u.meas.offset)
+ return s;
+
+ s1 = unparse(obj->u.meas.offset);
+ t = stralloc_printf("%s %s", s, s1);
+ free(s);
+ free(s1);
+ return t;
+}
+
+
+/* ----- print vector ------------------------------------------------------ */
+
+
+char *print_label(const struct vec *vec)
+{
+ if (vec->name)
+ return stralloc(vec->name);
+ else
+ return generate_name(vec);
+}
+
+
+char *print_vec(const struct vec *vec)
+{
char *base, *x, *y, *s;
base = base_name(vec->base, vec);
x = unparse(vec->x);
y = unparse(vec->y);
if (vec->name)
- fprintf(file, "%s%s: vec %s(%s, %s)\n",
- indent, vec->name, base, x, y);
+ s = stralloc_printf("vec %s(%s, %s)", base, x, y);
else {
- s = generate_name(vec);
- fprintf(file, "%s%s: vec %s(%s, %s)\n", indent, s, base, x, y);
- free(s);
+ s = stralloc_printf("vec %s(%s, %s)", base, x, y);
}
free(base);
free(x);
free(y);
-
- for (obj = vec->frame->objs; obj; obj = obj->next)
- if (may_dump_obj_now(obj, vec))
- dump_obj(file, obj, indent, vec);
- if (n_vec_refs(vec) == 1) {
- for (next = vec->next; next->base != vec; next = next->next);
- recurse_vec(file, next, indent);
- }
+ return s;
}
-static void dump_vecs(FILE *file, const struct vec *vecs, const char *indent)
-{
- const struct vec *vec;
-
- for (vec = vecs; vec; vec = vec->next)
- if (!vec->base || n_vec_refs(vec->base) != 1)
- recurse_vec(file, vec, indent);
-}
-
-
/* ----- frames ------------------------------------------------------------ */
@@ -354,21 +441,36 @@
const struct table *table;
const struct loop *loop;
struct obj *obj;
+ struct order *order;
+ const struct order *item;
+ char *s, *s1;
for (table = frame->tables; table; table = table->next)
dump_table(file, table, indent);
for (loop = frame->loops; loop; loop = loop->next)
dump_loop(file, loop, indent);
- for (obj = frame->objs; obj; obj = obj->next)
- obj->dumped = 0;
- dump_vecs(file, frame->vecs, indent);
- /* frames based on @ (anything else ?) */
- for (obj = frame->objs; obj; obj = obj->next)
- if (obj->type != ot_meas)
- dump_obj(file, obj, indent, NULL);
- for (obj = frame->objs; obj; obj = obj->next)
- dump_obj(file, obj, indent, NULL);
+ order = order_frame(frame);
+ for (item = order; item->vec || item->obj; item++) {
+ if (item->obj) {
+ s = print_obj(item->obj, item->vec);
+ fprintf(file, "%s%s\n", indent, s);
+ } else {
+ s1 = print_label(item->vec);
+ s = print_vec(item->vec);
+ fprintf(file, "%s%s: %s\n", indent, s1, s);
+ }
+ free(s);
+ }
+ free(order);
+
+ for (obj = frame->objs; obj; obj = obj->next) {
+ if (obj->dumped)
+ continue;
+ s = print_meas(obj);
+ fprintf(file, "%s%s\n", indent, s);
+ free(s);
+ }
}
Modified: trunk/eda/fped/dump.h
===================================================================
--- trunk/eda/fped/dump.h 2009-08-11 23:30:58 UTC (rev 5422)
+++ trunk/eda/fped/dump.h 2009-08-12 10:45:52 UTC (rev 5423)
@@ -16,7 +16,31 @@
#include <stdio.h>
+#include "obj.h"
+
+/*
+ * vec obj
+ * --------------------------------------------------------------
+ * NULL NULL end of list
+ * non-NULL NULL vector
+ * NULL non-NULL object, no previous vector
+ * non-NULL non-NULL object, with previous vector
+ */
+
+struct order {
+ struct vec *vec;
+ struct obj *obj;
+};
+
+
+char *print_label(const struct vec *vec);
+char *print_vec(const struct vec *vec);
+char *print_obj(const struct obj *obj, const struct vec *prev);
+char *print_meas(const struct obj *obj);
+
+struct order *order_frame(const struct frame *frame);
+
int dump(FILE *file);
#endif /* !DUMP_H */
Modified: trunk/eda/fped/gui_frame.c
===================================================================
--- trunk/eda/fped/gui_frame.c 2009-08-11 23:30:58 UTC (rev 5422)
+++ trunk/eda/fped/gui_frame.c 2009-08-12 10:45:52 UTC (rev 5423)
@@ -16,6 +16,7 @@
#include "util.h"
#include "error.h"
+#include "dump.h"
#include "inst.h"
#include "obj.h"
#include "delete.h"
@@ -906,7 +907,7 @@
struct table *table;
struct loop *loop;
- vbox= gtk_vbox_new(FALSE, 0);
+ vbox = gtk_vbox_new(FALSE, 0);
for (table = frame->tables; table; table = table->next) {
add_sep(vbox, 3);
build_assignment(vbox, frame, table);
@@ -920,6 +921,122 @@
}
+/* ----- items ------------------------------------------------------------- */
+
+
+static void set_item_color(struct inst *inst, const char *color)
+{
+ GtkWidget *label;
+
+ if (inst->vec)
+ label = inst->vec->list_widget;
+ else
+ label = inst->obj->list_widget;
+ label_in_box_bg(box_of_label(label), color);
+}
+
+
+void gui_frame_select_inst(struct inst *inst)
+{
+ set_item_color(inst, COLOR_ITEM_SELECTED);
+}
+
+
+void gui_frame_deselect_inst(struct inst *inst)
+{
+ set_item_color(inst, COLOR_ITEM_NORMAL);
+}
+
+
+static GtkWidget *item_label(GtkWidget *tab, char *s, int col, int row)
+{
+ GtkWidget *label;
+
+ label = label_in_box_new(s);
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
+ gtk_widget_modify_font(label, item_list_font);
+ gtk_table_attach_defaults(GTK_TABLE(tab), box_of_label(label),
+ col, col+1, row, row+1);
+ label_in_box_bg(box_of_label(label), COLOR_ITEM_NORMAL);
+ free(s);
+ return label;
+}
+
+
+static GtkWidget *build_items(struct frame *frame)
+{
+ GtkWidget *hbox, *tab;
+ struct order *order, *item;
+ struct vec *vec;
+ struct obj *obj;
+ int n;
+ char *s, *t;
+
+ n = 0;
+ for (vec = frame->vecs; vec; vec = vec->next)
+ n++;
+ for (obj = frame->objs; obj; obj = obj->next)
+ if (obj->type != ot_meas)
+ n++;
+
+ hbox = gtk_hbox_new(FALSE, 0);
+
+ tab = gtk_table_new(n, 2, FALSE);
+ gtk_box_pack_start(GTK_BOX(hbox), tab, FALSE, FALSE, 0);
+
+ order = order_frame(frame);
+ n = 0;
+ for (item = order; item->vec || item->obj; item++) {
+ if (item->obj) {
+ s = print_obj(item->obj, item->vec);
+ item->obj->list_widget = item_label(tab, s, 1, n);
+ } else {
+ s = print_label(item->vec);
+ t = stralloc_printf("%s: ", s);
+ free(s);
+ item_label(tab, t, 0, n);
+
+ s = print_vec(item->vec);
+ item->vec->list_widget = item_label(tab, s, 1, n);
+ }
+ n++;
+ }
+ free(order);
+
+ return hbox;
+}
+
+
+static GtkWidget *build_meas(struct frame *frame)
+{
+ GtkWidget *hbox, *tab;
+ struct obj *obj;
+ int n;
+ char *s;
+
+ n = 0;
+ for (obj = frame->objs; obj; obj = obj->next)
+ if (obj->type == ot_meas)
+ n++;
+
+ hbox = gtk_hbox_new(FALSE, 0);
+
+ tab = gtk_table_new(n, 2, FALSE);
+ gtk_box_pack_start(GTK_BOX(hbox), tab, FALSE, FALSE, 0);
+
+ n = 0;
+ for (obj = frame->objs; obj; obj = obj->next) {
+ if (obj->type != ot_meas)
+ continue;
+ s = print_meas(obj);
+ obj->list_widget = item_label(tab, s, 0, n);
+ n++;
+ }
+
+ return hbox;
+}
+
+
/* ----- part name --------------------------------------------------------- */
@@ -1110,18 +1227,22 @@
void build_frames(GtkWidget *vbox)
{
struct frame *frame;
- GtkWidget *tab, *label, *refs, *vars;
+ GtkWidget *hbox, *tab, *label, *refs, *vars, *items, *meas;
int n = 0;
destroy_all_children(GTK_CONTAINER(vbox));
for (frame = frames; frame; frame = frame->next)
n++;
- tab = gtk_table_new(n*2+1, 2, FALSE);
+ hbox = gtk_hbox_new(FALSE, 0);
+
+ tab = gtk_table_new(n*2+3, 3, FALSE);
gtk_table_set_row_spacings(GTK_TABLE(tab), 1);
gtk_table_set_col_spacings(GTK_TABLE(tab), 1);
- gtk_box_pack_start(GTK_BOX(vbox), tab, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(hbox), tab, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
+
label = build_part_name();
gtk_table_attach_defaults(GTK_TABLE(tab), label, 0, 1, 0, 1);
@@ -1138,7 +1259,21 @@
vars = build_vars(frame);
gtk_table_attach_defaults(GTK_TABLE(tab), vars,
1, 2, n*2+2, n*2+3);
+
+ items = build_items(frame);
+ gtk_table_attach_defaults(GTK_TABLE(tab), items,
+ 2, 3, n*2+2, n*2+3);
+
n++;
}
- gtk_widget_show_all(tab);
+
+ label = label_in_box_new(" ");
+ gtk_table_attach_defaults(GTK_TABLE(tab), box_of_label(label),
+ 2, 3, n*2+1, n*2+2);
+
+ meas = build_meas(root_frame);
+ gtk_table_attach_defaults(GTK_TABLE(tab), meas,
+ 2, 3, n*2+2, n*2+3);
+
+ gtk_widget_show_all(hbox);
}
Modified: trunk/eda/fped/gui_frame.h
===================================================================
--- trunk/eda/fped/gui_frame.h 2009-08-11 23:30:58 UTC (rev 5422)
+++ trunk/eda/fped/gui_frame.h 2009-08-12 10:45:52 UTC (rev 5423)
@@ -21,6 +21,9 @@
void select_frame(struct frame *frame);
+void gui_frame_select_inst(struct inst *inst);
+void gui_frame_deselect_inst(struct inst *inst);
+
void build_frames(GtkWidget *vbox);
#endif /* !GUI_FRAME_H */
Modified: trunk/eda/fped/gui_style.c
===================================================================
--- trunk/eda/fped/gui_style.c 2009-08-11 23:30:58 UTC (rev 5422)
+++ trunk/eda/fped/gui_style.c 2009-08-12 10:45:52 UTC (rev 5423)
@@ -32,7 +32,9 @@
GdkGC *gc_meas[mode_n];
GdkGC *gc_frame[mode_n];
+PangoFontDescription *item_list_font;
+
static GdkGC *gc(const char *spec, int width)
{
GdkGCValues gc_values = {
@@ -75,4 +77,6 @@
// gc_highlight = gc("#ff8020", 2);
gc_highlight = gc("#ff90d0", 2);
gc_frame[mode_hover] = gc_vec[mode_hover] = gc("#c00000", 2);
+
+ item_list_font = pango_font_description_from_string(ITEM_LIST_FONT);
}
Modified: trunk/eda/fped/gui_style.h
===================================================================
--- trunk/eda/fped/gui_style.h 2009-08-11 23:30:58 UTC (rev 5422)
+++ trunk/eda/fped/gui_style.h 2009-08-12 10:45:52 UTC (rev 5423)
@@ -47,6 +47,8 @@
#define FRAME_EYE_R1 3
#define FRAME_EYE_R2 5
+#define ITEM_LIST_FONT "Sans 8"
+
#define SELECT_R 6 /* pixels within which we select */
#define DRAG_MIN_R 5
@@ -84,7 +86,10 @@
#define TOOL_UNSELECTED "#dcdad5"
#define TOOL_SELECTED "red"
+#define COLOR_ITEM_NORMAL "#dcdad5"
+#define COLOR_ITEM_SELECTED COLOR_FRAME_SELECTED
+
/* ----- canvas drawing styles --------------------------------------------- */
@@ -99,6 +104,7 @@
extern GdkGC *gc_meas[mode_n];
extern GdkGC *gc_frame[mode_n];
+extern PangoFontDescription *item_list_font;
void gui_setup_style(GdkDrawable *drawable);
Modified: trunk/eda/fped/inst.c
===================================================================
--- trunk/eda/fped/inst.c 2009-08-11 23:30:58 UTC (rev 5422)
+++ trunk/eda/fped/inst.c 2009-08-12 10:45:52 UTC (rev 5423)
@@ -25,6 +25,7 @@
#include "gui_tool.h"
#include "gui_meas.h"
#include "gui_inst.h"
+#include "gui_frame.h"
#include "gui.h"
#include "inst.h"
@@ -117,9 +118,11 @@
deselect_outside();
edit_nothing();
+ if (selected_inst) {
+ gui_frame_deselect_inst(selected_inst);
+ tool_selected_inst(NULL);
+ }
selected_inst = NULL;
- if (selected_inst)
- tool_selected_inst(NULL);
FOR_INST_PRIOS_DOWN(prio) {
if (!show(prio))
continue;
@@ -157,6 +160,7 @@
selected:
set_path(1);
tool_selected_inst(selected_inst);
+ gui_frame_select_inst(selected_inst);
if (selected_inst->ops->select)
selected_inst->ops->select(selected_inst);
return 1;
@@ -269,6 +273,7 @@
if (selected_inst) {
set_path(0);
tool_selected_inst(NULL);
+ gui_frame_deselect_inst(selected_inst);
}
deselect_outside();
status_set_type_x("");
@@ -345,6 +350,8 @@
inst = alloc_type(struct inst);
inst->ops = ops;
+ inst->vec = NULL;
+ inst->obj = NULL;
inst->base = inst->bbox.min = inst->bbox.max = base;
inst->outer = curr_frame;
inst->active = IS_ACTIVE;
Modified: trunk/eda/fped/inst.h
===================================================================
--- trunk/eda/fped/inst.h 2009-08-11 23:30:58 UTC (rev 5422)
+++ trunk/eda/fped/inst.h 2009-08-12 10:45:52 UTC (rev 5423)
@@ -76,8 +76,8 @@
struct coord base;
// struct inst *base_inst; /* frame or vector leading to this item */
struct bbox bbox;
- struct vec *vec; /* undefined if not vector */
- struct obj *obj; /* undefined if not object */
+ struct vec *vec; /* NULL if not vector */
+ struct obj *obj; /* NULL if not object */
struct inst *outer; /* frame containing this item */
int active;
int in_path;
Modified: trunk/eda/fped/obj.h
===================================================================
--- trunk/eda/fped/obj.h 2009-08-11 23:30:58 UTC (rev 5422)
+++ trunk/eda/fped/obj.h 2009-08-12 10:45:52 UTC (rev 5423)
@@ -102,6 +102,9 @@
/* samples for measurements */
struct sample *samples;
+
+ /* for the GUI */
+ GtkWidget *list_widget;
};
struct frame {
@@ -170,6 +173,9 @@
/* for dumping */
int dumped;
+
+ /* for the GUI */
+ GtkWidget *list_widget;
};
More information about the commitlog
mailing list