Send commitlog mailing list submissions to
        commitlog@lists.openmoko.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.openmoko.org/mailman/listinfo/commitlog
or, via email, send a message with subject or body 'help' to
        commitlog-requ...@lists.openmoko.org

You can reach the person managing the list at
        commitlog-ow...@lists.openmoko.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of commitlog digest..."
Today's Topics:

   1. r5394 -
      trunk/src/target/AR6kSDK.build_sw.18/host/tools/wmiconfig
      (ste...@docs.openmoko.org)
   2. r5395 - trunk/eda/fped (wer...@docs.openmoko.org)
   3. r5396 - trunk/eda/fped (wer...@docs.openmoko.org)
   4. r5397 - trunk/eda/fped (wer...@docs.openmoko.org)
--- Begin Message ---
Author: stefan
Date: 2009-08-06 11:57:29 +0200 (Thu, 06 Aug 2009)
New Revision: 5394

Modified:
   trunk/src/target/AR6kSDK.build_sw.18/host/tools/wmiconfig/Makefile
Log:
wmiconfig: Honor LDFLAGS.

We need the LDFLAGS in OE. Allowing wmiconfig to build with them.


Modified: trunk/src/target/AR6kSDK.build_sw.18/host/tools/wmiconfig/Makefile
===================================================================
--- trunk/src/target/AR6kSDK.build_sw.18/host/tools/wmiconfig/Makefile  
2009-08-06 06:54:41 UTC (rev 5393)
+++ trunk/src/target/AR6kSDK.build_sw.18/host/tools/wmiconfig/Makefile  
2009-08-06 09:57:29 UTC (rev 5394)
@@ -1,4 +1,4 @@
 CC :=$(ATH_CROSS_COMPILE_TYPE)gcc
 
 all:
-       $(CC) -Wall -DUSER_KEYS -g -I../../include -I../../../include 
-I../../wlan/include -I../../os/linux/include wmiconfig.c -o wmiconfig
+       $(CC) -Wall -DUSER_KEYS -g $(LDFLAGS) -I../../include 
-I../../../include -I../../wlan/include -I../../os/linux/include wmiconfig.c -o 
wmiconfig




--- End Message ---
--- Begin Message ---
Author: werner
Date: 2009-08-06 14:07:24 +0200 (Thu, 06 Aug 2009)
New Revision: 5395

Modified:
   trunk/eda/fped/TODO
   trunk/eda/fped/dump.c
   trunk/eda/fped/gui_canvas.c
   trunk/eda/fped/gui_inst.c
   trunk/eda/fped/gui_util.c
Log:
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



Modified: trunk/eda/fped/TODO
===================================================================
--- trunk/eda/fped/TODO 2009-08-06 09:57:29 UTC (rev 5394)
+++ trunk/eda/fped/TODO 2009-08-06 12:07:24 UTC (rev 5395)
@@ -19,7 +19,6 @@
 
 Bugs:
 - 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
 
 Code cleanup:

Modified: trunk/eda/fped/dump.c
===================================================================
--- trunk/eda/fped/dump.c       2009-08-06 09:57:29 UTC (rev 5394)
+++ trunk/eda/fped/dump.c       2009-08-06 12:07:24 UTC (rev 5395)
@@ -355,9 +355,10 @@
 
        fprintf(file, "/* MACHINE-GENERATED ! */\n\n");
        for (frame = frames; frame; frame = frame->next) {
-               if (!frame->name)
+               if (!frame->name) {
+                       fprintf(file, "part \"%s\"\n", part_name);
                        dump_frame(file, frame, "");
-               else {
+               } else {
                        fprintf(file, "frame %s {\n", frame->name);
                        dump_frame(file, frame, "\t");
                        fprintf(file, "}\n\n");

Modified: trunk/eda/fped/gui_canvas.c
===================================================================
--- trunk/eda/fped/gui_canvas.c 2009-08-06 09:57:29 UTC (rev 5394)
+++ trunk/eda/fped/gui_canvas.c 2009-08-06 12:07:24 UTC (rev 5395)
@@ -172,6 +172,7 @@
                }
                if (res) {
                        inst_deselect();
+                       redraw();
                        dragging = 1;
                        drag_escaped = 0;
                        drag_start = pos;

Modified: trunk/eda/fped/gui_inst.c
===================================================================
--- trunk/eda/fped/gui_inst.c   2009-08-06 09:57:29 UTC (rev 5394)
+++ trunk/eda/fped/gui_inst.c   2009-08-06 12:07:24 UTC (rev 5395)
@@ -97,7 +97,12 @@
        struct coord p[3];
        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[1] = to;
        p[2] = add_vec(to, rotate(side, 180+angle));
@@ -267,7 +272,7 @@
        struct coord c = self->base;
        struct coord p;
        unit_type r, d_min, d;
-       double angle, a2;
+       double angle, a1, a2;
 
        r = self->u.arc.width/scale/2;
        if (r < SELECT_R)
@@ -297,10 +302,15 @@
        /* see if we're close to the part that's actually drawn */
 
        angle = theta(c, pos);
+       a1 = self->u.arc.a1;
        a2 = self->u.arc.a2;
-       if (a2 < self->u.arc.a1)
-               a2 += 180;
-       return angle >= self->u.arc.a1 && angle <= a2 ? d : -1;
+       if (angle < 0)
+               angle += 360;
+       if (a2 < a1)
+               a2 += 360;
+       if (angle < a1)
+               angle += 360;
+       return angle >= a1 && angle <= a2 ? d : -1;
 }
 
 

Modified: trunk/eda/fped/gui_util.c
===================================================================
--- trunk/eda/fped/gui_util.c   2009-08-06 09:57:29 UTC (rev 5394)
+++ trunk/eda/fped/gui_util.c   2009-08-06 12:07:24 UTC (rev 5395)
@@ -103,8 +103,13 @@
 void draw_arc(GdkDrawable *da, GdkGC *gc, int fill,
     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);
 }
 




--- End Message ---
--- Begin Message ---
Author: werner
Date: 2009-08-06 22:19:00 +0200 (Thu, 06 Aug 2009)
New Revision: 5396

Modified:
   trunk/eda/fped/delete.c
   trunk/eda/fped/delete.h
   trunk/eda/fped/fpd.y
   trunk/eda/fped/gui.c
   trunk/eda/fped/gui_tools.c
   trunk/eda/fped/obj.h
Log:
- when dragging the endpoint of an arc, show a helper line to visually connect
  the point being dragged
- added pop-up menus for all frame and variable items (on-going)
- clickable items in the frame/var area now only respond to the left button,
  unless they have a pop-up
- removed the frame delete icon - use pop-up instead



Modified: trunk/eda/fped/delete.c
===================================================================
--- trunk/eda/fped/delete.c     2009-08-06 12:07:24 UTC (rev 5395)
+++ trunk/eda/fped/delete.c     2009-08-06 20:19:00 UTC (rev 5396)
@@ -225,7 +225,32 @@
        }
 }
 
+/* ----- tables ------------------------------------------------------------ */
 
+
+void delete_row(struct row *row)
+{
+}
+
+
+void delete_column(struct table *table, int n)
+{
+}
+
+
+void delete_table(struct table *table)
+{
+}
+
+
+/* ----- loops ------------------------------------------------------------- */
+
+
+void delete_loop(struct loop *loop)
+{
+}
+
+
 /* ----- frames ------------------------------------------------------------ */
 
 

Modified: trunk/eda/fped/delete.h
===================================================================
--- trunk/eda/fped/delete.h     2009-08-06 12:07:24 UTC (rev 5395)
+++ trunk/eda/fped/delete.h     2009-08-06 20:19:00 UTC (rev 5396)
@@ -20,6 +20,10 @@
 
 void delete_vec(struct vec *vec);
 void delete_obj(struct obj *obj);
+void delete_row(struct row *row);
+void delete_column(struct table *table, int n);
+void delete_table(struct table *table);
+void delete_loop(struct loop *loop);
 void delete_frame(struct frame *frame);
 int destroy(void);
 int undelete(void);

Modified: trunk/eda/fped/fpd.y
===================================================================
--- trunk/eda/fped/fpd.y        2009-08-06 12:07:24 UTC (rev 5395)
+++ trunk/eda/fped/fpd.y        2009-08-06 20:19:00 UTC (rev 5396)
@@ -78,6 +78,7 @@
        table->vars = zalloc_type(struct var);
        table->vars->name = id;
        table->vars->frame = curr_frame;
+       table->vars->table = table;
        table->rows = zalloc_type(struct row);
        table->rows->table = table;
        table->rows->values = zalloc_type(struct value);
@@ -97,6 +98,7 @@
        loop->var.name = id;
        loop->var.next = NULL;
        loop->var.frame = curr_frame;
+       loop->var.table = NULL;
        loop->from.expr = from;
        loop->from.row = NULL;
        loop->from.next = NULL;
@@ -296,6 +298,7 @@
                        $$ = zalloc_type(struct var);
                        $$->name = $1;
                        $$->frame = curr_frame;
+                       $$->table = curr_table;
                        $$->next = NULL;
                        n_vars++;
                }

Modified: trunk/eda/fped/gui.c
===================================================================
--- trunk/eda/fped/gui.c        2009-08-06 12:07:24 UTC (rev 5395)
+++ trunk/eda/fped/gui.c        2009-08-06 20:19:00 UTC (rev 5396)
@@ -37,6 +37,406 @@
 static GtkWidget *frames_box;
 
 
+/* ----- popup dispatcher -------------------------------------------------- */
+
+
+static void *popup_data;
+
+
+static void pop_up(GtkWidget *menu, GdkEventButton *event, void *data)
+{
+       popup_data = data;
+       gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
+           event->button, event->time);
+}
+
+
+/* ----- popup: frame ------------------------------------------------------ */
+
+
+static GtkItemFactory *factory_frame;
+static GtkWidget *popup_frame_widget;
+
+
+static void select_frame(struct frame *frame);
+
+
+static void popup_add_frame(void)
+{
+       struct frame *parent = popup_data;
+       struct frame *new;
+
+       new = zalloc_type(struct frame);
+       new->name = unique("_");
+       new->next = parent;
+       new->prev = parent->prev;
+       if (parent->prev)
+               parent->prev->next = new;
+       else
+               frames = new;
+       parent->prev = new;
+       change_world();
+}
+
+
+static void popup_del_frame(void)
+{
+       struct frame *frame = popup_data;
+
+       assert(frame != root_frame);
+       delete_frame(frame);
+       if (active_frame == frame)
+               select_frame(root_frame);
+       change_world();
+}
+
+
+/* @@@ merge with fpd.y */
+
+static void popup_add_table(void)
+{
+       struct frame *frame = popup_data;
+       struct table *table, **walk;
+
+       table = zalloc_type(struct table);
+       table->vars = zalloc_type(struct var);
+       table->vars->name = unique("_");
+       table->vars->frame = frame;
+       table->vars->table = table;
+       table->rows = zalloc_type(struct row);
+       table->rows->table = table;
+       table->rows->values = zalloc_type(struct value);
+       table->rows->values->expr = parse_expr("0");
+       table->rows->values->row = table->rows;
+       table->active_row = table->rows;
+       for (walk = &frame->tables; *walk; walk = &(*walk)->next);
+       *walk = table;
+       change_world();
+}
+
+
+static void popup_add_loop(void)
+{
+       struct frame *frame = popup_data;
+       struct loop *loop, **walk;
+
+       loop = zalloc_type(struct loop);
+       loop->var.name = unique("_");
+       loop->var.frame = frame;
+       loop->from.expr = parse_expr("0");
+       loop->to.expr = parse_expr("0");
+       loop->next = NULL;
+       for (walk = &frame->loops; *walk; walk = &(*walk)->next);
+       *walk = loop;
+       change_world();
+}
+
+
+static GtkItemFactoryEntry popup_frame_entries[] = {
+       { "/Add frame",         NULL,   popup_add_frame,        0, "<Item>" },
+       { "/sep0",              NULL,   NULL,           0, "<Separator>" },
+       { "/Add variable",      NULL,   popup_add_table,        0, "<Item>" },
+       { "/Add loop",          NULL,   popup_add_loop,         0, "<Item>" },
+       { "/sep1",              NULL,   NULL,           0, "<Separator>" },
+       { "/Delete frame",      NULL,   popup_del_frame,        0, "<Item>" },
+       { "/sep2",              NULL,   NULL,           0, "<Separator>" },
+       { "/Close",             NULL,   NULL,           0, "<Item>" },
+       { NULL }
+};
+
+
+static void pop_up_frame(struct frame *frame, GdkEventButton *event)
+{
+       gtk_widget_set_sensitive(
+           gtk_item_factory_get_item(factory_frame, "/Delete frame"),
+           frame != root_frame);
+       pop_up(popup_frame_widget, event, frame);
+}
+
+
+/* ----- popup: single variable -------------------------------------------- */
+
+
+static GtkItemFactory *factory_single_var;
+static GtkWidget *popup_single_var_widget;
+
+
+
+static void add_row_here(struct table *table, struct row **anchor)
+{
+       struct row *row;
+       const struct value *walk;
+       struct value *value;
+
+       row = zalloc_type(struct row);
+       row->table = table;
+       /* @@@ future: adjust type */
+       for (walk = table->rows->values; walk; walk = walk->next) {
+               value = zalloc_type(struct value);
+               value->expr = parse_expr("0");
+               value->row = row;
+               value->next = row->values;
+               row->values = value;
+       }
+       row->next = *anchor;
+       *anchor = row;
+       change_world();
+}
+
+
+static void add_column_here(struct table *table, struct var **anchor)
+{
+       const struct var *walk;
+       struct var *var;
+       struct row *row;
+       struct value *value;
+       struct value **value_anchor;
+       int n = 0, i;
+
+       for (walk = table->vars; walk != *anchor; walk = walk->next)
+               n++;
+       var = zalloc_type(struct var);
+       var->name = unique("_");
+       var->frame = table->vars->frame;
+       var->table = table;
+       var->next = *anchor;
+       *anchor = var;
+       for (row = table->rows; row; row = row->next) {
+               value_anchor = &row->values;
+               for (i = 0; i != n; i++)
+                       value_anchor = &(*value_anchor)->next;
+               value = zalloc_type(struct value);
+               value->expr = parse_expr("0");
+               value->row = row;
+               value->next = *value_anchor;
+               *value_anchor = value;
+       }
+       change_world();
+}
+
+
+static void popup_add_row(void)
+{
+       struct var *var = popup_data;
+
+       add_row_here(var->table, &var->table->rows);
+}
+
+
+static void popup_add_column(void)
+{
+       struct var *var = popup_data;
+
+       add_column_here(var->table, &var->next);
+}
+
+
+static void popup_del_table(void)
+{
+       struct var *var = popup_data;
+
+       delete_table(var->table);
+       change_world();
+}
+
+
+static GtkItemFactoryEntry popup_single_var_entries[] = {
+       { "/Add row",           NULL,   popup_add_row,          0, "<Item>" },
+       { "/Add column",        NULL,   popup_add_column,       0, "<Item>" },
+       { "/sep1",              NULL,   NULL,           0, "<Separator>" },
+       { "/Delete variable",   NULL,   popup_del_table,        0, "<Item>" },
+       { "/sep2",              NULL,   NULL,           0, "<Separator>" },
+       { "/Close",             NULL,   NULL,                   0, "<Item>" },
+       { NULL }
+};
+
+
+static void pop_up_single_var(struct var *var, GdkEventButton *event)
+{
+       pop_up(popup_single_var_widget, event, var);
+}
+
+
+/* ----- popup: table variable --------------------------------------------- */
+
+
+static GtkItemFactory *factory_table_var;
+static GtkWidget *popup_table_var_widget;
+
+
+static void popup_del_column(void)
+{
+       struct var *var = popup_data;
+       const struct var *walk;
+       int n = 0;
+
+       for (walk = var->table->vars; walk != var; walk = walk->next)
+               n++;
+       delete_column(var->table, n);
+       change_world();
+}
+
+
+static GtkItemFactoryEntry popup_table_var_entries[] = {
+       { "/Add row",           NULL,   popup_add_row,          0, "<Item>" },
+       { "/Add column",        NULL,   popup_add_column,       0, "<Item>" },
+       { "/sep1",              NULL,   NULL,           0, "<Separator>" },
+       { "/Delete table",      NULL,   popup_del_table,        0, "<Item>" },
+       { "/Delete column",     NULL,   popup_del_column,       0, "<Item>" },
+       { "/sep2",              NULL,   NULL,           0, "<Separator>" },
+       { "/Close",             NULL,   NULL,           0, "<Item>" },
+       { NULL }
+};
+
+
+static void pop_up_table_var(struct var *var, GdkEventButton *event)
+{
+       gtk_widget_set_sensitive(
+           gtk_item_factory_get_item(factory_table_var, "/Delete column"),
+           var->table->vars->next != NULL);
+       pop_up(popup_table_var_widget, event, var);
+}
+
+
+/* ----- popup: table value ------------------------------------------------ */
+
+
+static GtkItemFactory *factory_table_value;
+static GtkWidget *popup_table_value_widget;
+
+
+static void popup_add_column_by_value(void)
+{
+       struct value *value = popup_data;
+       const struct value *walk;
+       struct table *table = value->row->table;
+       struct var *var = table->vars;
+
+       for (walk = value->row->values; walk != value; walk = walk->next)
+               var = var->next;
+       add_column_here(table, &var->next);
+}
+
+
+static void popup_add_row_by_value(void)
+{
+       struct value *value = popup_data;
+
+       add_row_here(value->row->table, &value->row->next);
+}
+
+
+static void popup_del_row(void)
+{
+       struct value *value = popup_data;
+
+       delete_row(value->row);
+       change_world();
+}
+
+
+static void popup_del_column_by_value(void)
+{
+       struct value *value = popup_data;
+       const struct value *walk;
+       int n = 0;
+
+       for (walk = value->row->values; walk != value; walk = walk->next);
+       delete_column(value->row->table, n);
+       change_world();
+}
+
+
+static GtkItemFactoryEntry popup_table_value_entries[] = {
+       { "/Add row",           NULL,   popup_add_row_by_value, 0, "<Item>" },
+       { "/Add column",        NULL,   popup_add_column_by_value,
+                                                       0, "<Item>" },
+       { "/sep1",              NULL,   NULL,           0, "<Separator>" },
+       { "/Delete row",        NULL,   popup_del_row,          0, "<Item>" },
+       { "/Delete column",     NULL,   popup_del_column_by_value,
+                                                               0, "<Item>" },
+       { "/sep2",              NULL,   NULL,           0, "<Separator>" },
+       { "/Close",             NULL,   NULL,           0, "<Item>" },
+       { NULL }
+};
+
+
+static void pop_up_table_value(struct value *value, GdkEventButton *event)
+{
+       gtk_widget_set_sensitive(
+           gtk_item_factory_get_item(factory_table_value, "/Delete row"),
+           value->row->table->rows->next != NULL);
+       gtk_widget_set_sensitive(
+           gtk_item_factory_get_item(factory_table_value, "/Delete column"),
+           value->row->table->vars->next != NULL);
+       pop_up(popup_table_value_widget, event, value);
+}
+
+
+/* ----- popup: loop ------------------------------------------------------- */
+
+
+static GtkItemFactory *factory_loop_var;
+static GtkWidget *popup_loop_var_widget;
+
+
+static void popup_del_loop(void)
+{
+       struct loop *loop = popup_data;
+
+       delete_loop(loop);
+       change_world();
+}
+
+
+static GtkItemFactoryEntry popup_loop_var_entries[] = {
+       { "/Delete loop",       NULL,   popup_del_loop,         0, "<Item>" },
+       { "/sep2",              NULL,   NULL,           0, "<Separator>" },
+       { "/Close",             NULL,   NULL,           0, "<Item>" },
+       { NULL }
+};
+
+
+static void pop_up_loop_var(struct loop *loop, GdkEventButton *event)
+{
+       pop_up(popup_loop_var_widget, event, loop);
+}
+
+
+/* ----- make popups ------------------------------------------------------- */
+
+
+static GtkWidget *make_popup(const char *name, GtkItemFactory **factory,
+    GtkItemFactoryEntry *entries)
+{
+       GtkWidget *popup;
+       int n;
+
+       n = 0;
+       for (n = 0; entries[n].path; n++);
+
+       *factory = gtk_item_factory_new(GTK_TYPE_MENU, name, NULL);
+       gtk_item_factory_create_items(*factory, n, entries, NULL);
+       popup = gtk_item_factory_get_widget(*factory, name);
+       return popup;
+}
+
+
+static void make_popups(void)
+{
+       popup_frame_widget = make_popup("<FpedFramePopUp>",
+           &factory_frame, popup_frame_entries);
+       popup_single_var_widget = make_popup("<FpedSingleVarPopUp>",
+           &factory_single_var, popup_single_var_entries);
+       popup_table_var_widget = make_popup("<FpedTableVarPopUp>",
+           &factory_table_var, popup_table_var_entries);
+       popup_table_value_widget = make_popup("<FpedTableValusPopUp>",
+           &factory_table_value, popup_table_value_entries);
+       popup_loop_var_widget = make_popup("<FpedLoopVarPopUp>",
+           &factory_loop_var, popup_loop_var_entries);
+}
+
+
 /* ----- menu bar ---------------------------------------------------------- */
 
 
@@ -188,7 +588,16 @@
 static gboolean assignment_var_select_event(GtkWidget *widget,
     GdkEventButton *event, gpointer data)
 {
-       edit_var(data);
+       struct var *var = data;
+
+       switch (event->button) {
+       case 1:
+               edit_var(var);
+               break;
+       case 3:
+               pop_up_single_var(var, event);
+               break;
+       }
        return TRUE;
 }
 
@@ -196,7 +605,13 @@
 static gboolean assignment_value_select_event(GtkWidget *widget,
     GdkEventButton *event, gpointer data)
 {
-       edit_value(data);
+       struct value *value = data;
+
+       switch (event->button) {
+       case 1:
+               edit_value(value);
+               break;
+       }
        return TRUE;
 }
 
@@ -257,7 +672,16 @@
 static gboolean table_var_select_event(GtkWidget *widget,
     GdkEventButton *event, gpointer data)
 {
-       edit_var(data);
+       struct var *var = data;
+
+       switch (event->button) {
+       case 1:
+               edit_var(var);
+               break;
+       case 3:
+               pop_up_table_var(var, event);
+               break;
+       }
        return TRUE;
 }
 
@@ -267,11 +691,18 @@
 {
        struct value *value = data;
 
-       if (!value->row || value->row->table->active_row == value->row)
-               edit_value(value);
-       else {
-               select_row(value->row);
-               change_world();
+       switch (event->button) {
+       case 1:
+               if (!value->row || value->row->table->active_row == value->row)
+                       edit_value(value);
+               else {
+                       select_row(value->row);
+                       change_world();
+               }
+               break;
+       case 3:
+               pop_up_table_value(value, event);
+               break;
        }
        return TRUE;
 }
@@ -353,7 +784,14 @@
 {
        struct loop *loop = data;
 
-       edit_var(&loop->var);
+       switch (event->button) {
+       case 1:
+               edit_var(&loop->var);
+               break;
+       case 3:
+               pop_up_loop_var(loop, event);
+               break;
+       }
        return TRUE;
 }
 
@@ -363,7 +801,11 @@
 {
        struct loop *loop = data;
 
-       edit_value(&loop->from);
+       switch (event->button) {
+       case 1:
+               edit_value(&loop->from);
+               break;
+       }
        return TRUE;
 }
 
@@ -373,7 +815,11 @@
 {
        struct loop *loop = data;
 
-       edit_value(&loop->to);
+       switch (event->button) {
+       case 1:
+               edit_value(&loop->to);
+               break;
+       }
        return TRUE;
 }
 
@@ -383,8 +829,13 @@
 {
        struct loop *loop = data;
 
-       loop->active = (long) gtk_object_get_data(GTK_OBJECT(widget), "value");
-       change_world();
+       switch (event->button) {
+       case 1:
+               loop->active =
+                   (long) gtk_object_get_data(GTK_OBJECT(widget), "value");
+               change_world();
+               break;
+       }
        return TRUE;
 }
 
@@ -495,11 +946,15 @@
 static gboolean part_name_edit_event(GtkWidget *widget, GdkEventButton *event,
     gpointer data)
 {
-       inst_select_outside(widget, unselect_part_name);
-       label_in_box_bg(widget, COLOR_PART_NAME_EDITING);
-       status_set_type_entry("part =");
-       status_set_name("%s", part_name);
-       edit_name(&part_name, validate_part_name, NULL);
+       switch (event->button) {
+       case 1:
+               inst_select_outside(widget, unselect_part_name);
+               label_in_box_bg(widget, COLOR_PART_NAME_EDITING);
+               status_set_type_entry("part =");
+               status_set_name("%s", part_name);
+               edit_name(&part_name, validate_part_name, NULL);
+               break;
+       }
        return TRUE;
 }
 
@@ -575,11 +1030,20 @@
 static gboolean frame_select_event(GtkWidget *widget, GdkEventButton *event,
     gpointer data)
 {
-       if (active_frame != data)
-               select_frame(data);
-       else {
-               if (active_frame->name)
-                       edit_frame(data);
+       struct frame *frame = data;
+
+       switch (event->button) {
+       case 1:
+               if (active_frame != frame)
+                       select_frame(frame);
+               else {
+                       if (active_frame->name)
+                               edit_frame(frame);
+               }
+               break;
+       case 3:
+               pop_up_frame(frame, event);
+               break;
        }
        return TRUE;
 }
@@ -604,23 +1068,17 @@
 }
 
 
-/* ----- frame delete ------------------------------------------------------ */
+/* ----- frame references -------------------------------------------------- */
 
 
-static gboolean frame_delete_event(GtkWidget *widget, GdkEventButton *event,
+static gboolean frame_ref_select_event(GtkWidget *widget, GdkEventButton 
*event,
     gpointer data)
 {
-       struct frame *frame = data;
+       struct obj *obj = data;
 
        switch (event->button) {
        case 1:
-               if (frame == root_frame) {
-                       fail("you cannot delete the root frame");
-                       break;
-               }
-               delete_frame(frame);
-               if (active_frame == frame)
-                       select_frame(root_frame);
+               obj->u.frame.ref->active_ref = data;
                change_world();
                break;
        }
@@ -628,42 +1086,6 @@
 }
 
 
-static GtkWidget *build_frame_delete(struct frame *frame)
-{
-       GtkWidget *evbox, *image;
-       GtkWidget *align;
-
-       evbox = gtk_event_box_new();
-       image = 
-           gtk_image_new_from_stock(GTK_STOCK_CANCEL,
-               GTK_ICON_SIZE_SMALL_TOOLBAR);
-       gtk_container_add(GTK_CONTAINER(evbox), image);
-
-       align = gtk_alignment_new(0.3, 0, 0, 0);
-       gtk_container_add(GTK_CONTAINER(align), evbox);
-       gtk_alignment_set_padding(GTK_ALIGNMENT(align), 2, 0, 0, 0);
-
-       g_signal_connect(G_OBJECT(evbox),
-           "button_press_event", G_CALLBACK(frame_delete_event), frame);
-
-       return align;
-}
-
-
-/* ----- frame references -------------------------------------------------- */
-
-
-static gboolean frame_ref_select_event(GtkWidget *widget, GdkEventButton 
*event,
-    gpointer data)
-{
-       struct obj *obj = data;
-
-       obj->u.frame.ref->active_ref = data;
-       change_world();
-       return TRUE;
-}
-
-
 static GtkWidget *build_frame_refs(const struct frame *frame)
 {
        GtkWidget *hbox;
@@ -686,7 +1108,7 @@
 static void build_frames(GtkWidget *vbox)
 {
        struct frame *frame;
-       GtkWidget *tab, *label, *delete, *refs, *vars;
+       GtkWidget *tab, *label, *refs, *vars;
        int n = 0;
 
        destroy_all_children(GTK_CONTAINER(vbox));
@@ -707,10 +1129,6 @@
                gtk_table_attach_defaults(GTK_TABLE(tab), label,
                    0, 1, n*2+1, n*2+2);
 
-               delete = build_frame_delete(frame);
-               gtk_table_attach_defaults(GTK_TABLE(tab), delete,
-                    0, 1, n*2+2, n*2+3);
-
                refs = build_frame_refs(frame);
                gtk_table_attach_defaults(GTK_TABLE(tab), refs,
                    1, 2, n*2+1, n*2+2);
@@ -818,6 +1236,7 @@
        init_canvas();
        edit_nothing();
        select_frame(root_frame);
+       make_popups();
 
        gtk_main();
 

Modified: trunk/eda/fped/gui_tools.c
===================================================================
--- trunk/eda/fped/gui_tools.c  2009-08-06 12:07:24 UTC (rev 5395)
+++ trunk/eda/fped/gui_tools.c  2009-08-06 20:19:00 UTC (rev 5396)
@@ -386,8 +386,8 @@
 struct pix_buf *draw_move_arc(struct inst *inst, struct draw_ctx *ctx,
     struct coord pos, int i)
 {
-       struct coord c, from, to;
-       double r, a1, a2;
+       struct coord c, from, to, end;
+       double r, r_save, a1, a2;
        struct pix_buf *buf;
 
        c = translate(ctx, inst->base);
@@ -420,8 +420,21 @@
        a2 = -theta(c, to);
        if (a2 < a1)
                a2 += 360.0;
-       buf = save_pix_buf(DA, c.x-r, c.y-r, c.x+r, c.y+r, 1);
+
+       if (i != 2)
+               r_save = r;
+       else {
+               r_save = hypot(to.x-c.x, to.y-c.y);
+               if (r > r_save)
+                       r_save = r;
+       }
+       buf = save_pix_buf(DA,
+           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);
+       if (i == 2) {
+               end = rotate_r(c, r_save, -a2);
+               gdk_draw_line(DA, gc_drag, c.x, c.y, end.x, end.y);
+       }
        return buf;
 }
 

Modified: trunk/eda/fped/obj.h
===================================================================
--- trunk/eda/fped/obj.h        2009-08-06 12:07:24 UTC (rev 5395)
+++ trunk/eda/fped/obj.h        2009-08-06 20:19:00 UTC (rev 5396)
@@ -27,6 +27,7 @@
 
        /* back reference */
        struct frame *frame;
+       struct table *table; /* NULL if loop */
 
        /* for the GUI */
        GtkWidget *widget;




--- End Message ---
--- Begin Message ---
Author: werner
Date: 2009-08-06 23:57:18 +0200 (Thu, 06 Aug 2009)
New Revision: 5397

Modified:
   trunk/eda/fped/delete.c
   trunk/eda/fped/expr.c
   trunk/eda/fped/expr.h
   trunk/eda/fped/fpd.y
   trunk/eda/fped/gui.c
Log:
- tables no longer try to fill the available space in the variables area
- added string-valued expressions (on-going)
- loops, tables, and rows can now be deleted/undeleted (still need columns)



Modified: trunk/eda/fped/delete.c
===================================================================
--- trunk/eda/fped/delete.c     2009-08-06 20:19:00 UTC (rev 5396)
+++ trunk/eda/fped/delete.c     2009-08-06 21:57:18 UTC (rev 5397)
@@ -26,6 +26,10 @@
                dt_vec,
                dt_obj,
                dt_frame,
+               dt_table,
+               dt_row,
+               dt_column,
+               dt_loop,
        } type;
        union {
                struct {
@@ -40,6 +44,24 @@
                        struct obj *ref;
                        struct obj *prev;
                } obj;
+               struct {
+                       struct table *ref;
+                       struct table *prev;
+               } table;
+               struct {
+                       struct row *ref;
+                       struct row *prev;
+               } row;
+               struct {
+                       struct var *var;
+                       struct value *values;
+                       struct table *table;
+                       int n;
+               } col;
+               struct {
+                       struct loop *ref;
+                       struct loop *prev;
+               } loop;
        } u;
        int group;
        struct deletion *next;
@@ -225,32 +247,125 @@
        }
 }
 
-/* ----- tables ------------------------------------------------------------ */
 
 
+/* ----- rows -------------------------------------------------------------- */
+
+
 void delete_row(struct row *row)
 {
+       struct deletion *del;
+       struct row *walk, *prev;
+
+       groups++;
+       prev = NULL;
+       for (walk = row->table->rows; walk != row; walk = walk->next)
+               prev = walk;
+       if (prev)
+               prev->next = row->next;
+       else
+               row->table->rows = row->next;
+       del = new_deletion(dt_row);
+       del->u.row.ref = row;
+       del->u.row.prev = prev;
 }
 
 
+static void undelete_row(struct row *row, struct row *prev)
+{
+       if (prev) {
+               assert(row->next == prev->next);
+               prev->next = row;
+       } else {
+               assert(row->next == row->table->rows);
+               row->table->rows = row;
+       }
+}
+
+
+/* ----- columns ----------------------------------------------------------- */
+
+
 void delete_column(struct table *table, int n)
 {
+       groups++;
 }
 
 
+/* ----- tables ------------------------------------------------------------ */
+
+
 void delete_table(struct table *table)
 {
+       struct frame *frame = table->vars->frame;
+       struct deletion *del;
+       struct table *walk, *prev;
+
+       groups++;
+       prev = NULL;
+       for (walk = frame->tables; walk != table; walk = walk->next)
+               prev = walk;
+       if (prev)
+               prev->next = table->next;
+       else
+               frame->tables = table->next;
+       del = new_deletion(dt_table);
+       del->u.table.ref = table;
+       del->u.table.prev = prev;
 }
 
 
+static void undelete_table(struct table *table, struct table *prev)
+{
+       struct frame *frame = table->vars->frame;
+
+       if (prev) {
+               assert(table->next == prev->next);
+               prev->next = table;
+       } else {
+               assert(table->next == frame->tables);
+               frame->tables = table;
+       }
+}
+
+
 /* ----- loops ------------------------------------------------------------- */
 
 
 void delete_loop(struct loop *loop)
 {
+       struct frame *frame = loop->var.frame;
+       struct deletion *del;
+       struct loop *walk, *prev;
+
+       groups++;
+       prev = NULL;
+       for (walk = frame->loops; walk != loop; walk = walk->next)
+               prev = walk;
+       if (prev)
+               prev->next = loop->next;
+       else
+               frame->loops = loop->next;
+       del = new_deletion(dt_loop);
+       del->u.loop.ref = loop;
+       del->u.loop.prev = prev;
 }
 
 
+static void undelete_loop(struct loop *loop, struct loop *prev)
+{
+       struct frame *frame = loop->var.frame;
+
+       if (prev) {
+               assert(loop->next == prev->next);
+               prev->next = loop;
+       } else {
+               assert(loop->next == frame->loops);
+               frame->loops = loop;
+       }
+}
+
+
 /* ----- frames ------------------------------------------------------------ */
 
 
@@ -347,6 +462,15 @@
        case dt_frame:
                undelete_frame(del->u.frame.ref, del->u.frame.prev);
                break;
+       case dt_loop:
+               undelete_loop(del->u.loop.ref, del->u.loop.prev);
+               break;
+       case dt_table:
+               undelete_table(del->u.table.ref, del->u.table.prev);
+               break;
+       case dt_row:
+               undelete_row(del->u.row.ref, del->u.row.prev);
+               break;
        default:
                abort();
        }

Modified: trunk/eda/fped/expr.c
===================================================================
--- trunk/eda/fped/expr.c       2009-08-06 20:19:00 UTC (rev 5396)
+++ trunk/eda/fped/expr.c       2009-08-06 21:57:18 UTC (rev 5397)
@@ -101,6 +101,13 @@
 /* ----- primary expressions ----------------------------------------------- */
 
 
+struct num op_string(const struct expr *self, const struct frame *frame)
+{
+       fail("cannot evaluate string");
+       return undef;
+}
+
+
 struct num op_num(const struct expr *self, const struct frame *frame)
 {
        return self->u.num;

Modified: trunk/eda/fped/expr.h
===================================================================
--- trunk/eda/fped/expr.h       2009-08-06 20:19:00 UTC (rev 5396)
+++ trunk/eda/fped/expr.h       2009-08-06 21:57:18 UTC (rev 5397)
@@ -43,6 +43,7 @@
        union {
                struct num num;
                const char *var;
+               char *str;
                struct {
                        struct expr *a;
                        struct expr *b;
@@ -107,6 +108,7 @@
 
 struct num op_num(const struct expr *self, const struct frame *frame);
 struct num op_var(const struct expr *self, const struct frame *frame);
+struct num op_string(const struct expr *self, const struct frame *frame);
 
 struct num op_minus(const struct expr *self, const struct frame *frame);
 

Modified: trunk/eda/fped/fpd.y
===================================================================
--- trunk/eda/fped/fpd.y        2009-08-06 20:19:00 UTC (rev 5396)
+++ trunk/eda/fped/fpd.y        2009-08-06 21:57:18 UTC (rev 5397)
@@ -530,6 +530,11 @@
                        $$ = new_op(op_var);
                        $$->u.var = $1;
                }
+       | STRING
+               {
+                       $$ = new_op(op_string);
+                       $$->u.str = $1;
+               }
        | '(' expr ')'
                {
                        $$ = $2;

Modified: trunk/eda/fped/gui.c
===================================================================
--- trunk/eda/fped/gui.c        2009-08-06 20:19:00 UTC (rev 5396)
+++ trunk/eda/fped/gui.c        2009-08-06 21:57:18 UTC (rev 5397)
@@ -712,7 +712,7 @@
     struct table *table)
 {
        GtkWidget *tab, *field;
-       GtkWidget *evbox;
+       GtkWidget *evbox, *align;
        struct var *var;
        struct row *row;
        struct value *value;
@@ -729,7 +729,9 @@
                return;
 
        evbox = gtk_event_box_new();
-       gtk_box_pack_start(GTK_BOX(vbox), evbox, FALSE, FALSE, 0);
+       align = gtk_alignment_new(0, 0, 0, 0);
+       gtk_container_add(GTK_CONTAINER(align), evbox);
+       gtk_box_pack_start(GTK_BOX(vbox), align, FALSE, FALSE, 0);
 
        tab = gtk_table_new(n_rows+1, n_vars, FALSE);
        gtk_container_add(GTK_CONTAINER(evbox), tab);




--- End Message ---
_______________________________________________
commitlog mailing list
commitlog@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/commitlog

Reply via email to