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. r5755 - trunk/eda/fped (wer...@docs.openmoko.org)
2. r5756 - trunk/eda/fped (wer...@docs.openmoko.org)
3. r5757 - trunk/eda/fped (wer...@docs.openmoko.org)
--- Begin Message ---
Author: werner
Date: 2009-12-15 20:33:15 +0100 (Tue, 15 Dec 2009)
New Revision: 5755
Modified:
trunk/eda/fped/coord.c
trunk/eda/fped/coord.h
trunk/eda/fped/gui_canvas.c
trunk/eda/fped/gui_status.c
trunk/eda/fped/gui_status.h
trunk/eda/fped/inst.c
Log:
When no instance is selected, show the polar coordinates of the current
pointer position relative to the user origin in the radius/angle fields.
This helps to make quick manual measurements, e.g., of clearances.
This also fixes the following bug:
- gui_canvas.c (refresh_pos): showed canvas coordinates instead of model
coordinates
Modified: trunk/eda/fped/coord.c
===================================================================
--- trunk/eda/fped/coord.c 2009-12-11 00:48:10 UTC (rev 5754)
+++ trunk/eda/fped/coord.c 2009-12-15 19:33:15 UTC (rev 5755)
@@ -131,17 +131,25 @@
}
-double theta(struct coord c, struct coord p)
+double theta_vec(struct coord v)
{
double a;
- a = atan2(p.y-c.y, p.x-c.x)/M_PI*180.0;
+ a = atan2(v.y, v.x)/M_PI*180.0;
if (a < 0)
a += 360.0;
return a;
}
+double theta(struct coord c, struct coord p)
+{
+ p.x -= c.x;
+ p.y -= c.y;
+ return theta_vec(p);
+}
+
+
/* ----- sorting coordinates ----------------------------------------------- */
Modified: trunk/eda/fped/coord.h
===================================================================
--- trunk/eda/fped/coord.h 2009-12-11 00:48:10 UTC (rev 5754)
+++ trunk/eda/fped/coord.h 2009-12-15 19:33:15 UTC (rev 5755)
@@ -84,6 +84,7 @@
struct coord neg_vec(struct coord v);
struct coord rotate_r(struct coord c, unit_type r, double angle);
+double theta_vec(struct coord v);
double theta(struct coord c, struct coord p);
void swap_coord(unit_type *a, unit_type *b);
Modified: trunk/eda/fped/gui_canvas.c
===================================================================
--- trunk/eda/fped/gui_canvas.c 2009-12-11 00:48:10 UTC (rev 5754)
+++ trunk/eda/fped/gui_canvas.c 2009-12-15 19:33:15 UTC (rev 5755)
@@ -36,7 +36,7 @@
void (*highlight)(void) = NULL;
-static struct coord curr_pos;
+static struct coord curr_pos; /* canvas coordinates ! */
static struct coord user_origin = { 0, 0 };
static int dragging = 0;
@@ -55,16 +55,28 @@
static void update_pos(struct coord pos)
{
+ struct coord user;
+ unit_type diag;
+
set_with_units(status_set_sys_x, "X ", pos.x);
set_with_units(status_set_sys_y, "Y ", pos.y);
- set_with_units(status_set_user_x, "x ", pos.x-user_origin.x);
- set_with_units(status_set_user_y, "y ", pos.y-user_origin.y);
+
+ user.x = pos.x-user_origin.x;
+ user.y = pos.y-user_origin.y;
+ set_with_units(status_set_user_x, "x ", user.x);
+ set_with_units(status_set_user_y, "y ", user.y);
+
+ if (!selected_inst) {
+ diag = hypot(user.x, user.y);
+ set_with_units(status_set_r, "r = ", diag);
+ status_set_angle_xy(user);
+ }
}
void refresh_pos(void)
{
- update_pos(curr_pos);
+ update_pos(canvas_to_coord(curr_pos.x, curr_pos.y));
}
Modified: trunk/eda/fped/gui_status.c
===================================================================
--- trunk/eda/fped/gui_status.c 2009-12-11 00:48:10 UTC (rev 5754)
+++ trunk/eda/fped/gui_status.c 2009-12-15 19:33:15 UTC (rev 5755)
@@ -155,6 +155,16 @@
}
+void status_set_angle_xy(struct coord v)
+{
+ if (!v.x && !v.y)
+ status_set_angle("a = 0 deg");
+ else
+ status_set_angle("a = %3.1f deg", theta_vec(v));
+
+}
+
+
static void entry_color(GtkWidget *widget, const char *color)
{
GdkColor col;
Modified: trunk/eda/fped/gui_status.h
===================================================================
--- trunk/eda/fped/gui_status.h 2009-12-11 00:48:10 UTC (rev 5754)
+++ trunk/eda/fped/gui_status.h 2009-12-15 19:33:15 UTC (rev 5755)
@@ -85,6 +85,7 @@
__attribute__((format(printf, 1, 2)));
void status_set_xy(struct coord coord);
+void status_set_angle_xy(struct coord v);
void status_begin_reporting(void);
Modified: trunk/eda/fped/inst.c
===================================================================
--- trunk/eda/fped/inst.c 2009-12-11 00:48:10 UTC (rev 5754)
+++ trunk/eda/fped/inst.c 2009-12-15 19:33:15 UTC (rev 5755)
@@ -23,6 +23,7 @@
#include "delete.h"
#include "gui_util.h"
#include "gui_status.h"
+#include "gui_canvas.h"
#include "gui_tool.h"
#include "gui_meas.h"
#include "gui_inst.h"
@@ -394,6 +395,7 @@
status_set_angle("");
selected_inst = NULL;
edit_nothing();
+ refresh_pos();
}
@@ -449,15 +451,14 @@
int rounded)
{
struct coord d = sub_vec(b, a);
- double angle, r;
+ double r;
unit_type diag;
status_set_xy(d);
if (!d.x && !d.y)
status_set_angle("a = 0 deg");
else {
- angle = theta(a, b);
- status_set_angle("a = %3.1f deg", angle);
+ status_set_angle("a = %3.1f deg", theta(a, b));
}
if (d.x < 0)
d.x = -d.x;
--- End Message ---
--- Begin Message ---
Author: werner
Date: 2009-12-15 21:05:37 +0100 (Tue, 15 Dec 2009)
New Revision: 5756
Modified:
trunk/eda/fped/gui.c
Log:
When entering the first vectors, where were a number of display anomalies
such a vectors pointing in the wrong direction. They were caused by overflows
due to inadequate zoom settings.
- gui.c (change_world): if the extents have grown, zoom to extents
Modified: trunk/eda/fped/gui.c
===================================================================
--- trunk/eda/fped/gui.c 2009-12-15 19:33:15 UTC (rev 5755)
+++ trunk/eda/fped/gui.c 2009-12-15 20:05:37 UTC (rev 5756)
@@ -252,12 +252,20 @@
void change_world(void)
{
+ struct bbox before, after;
+
inst_deselect();
status_begin_reporting();
+ before = inst_get_bbox();
instantiate();
+ after = inst_get_bbox();
label_in_box_bg(active_frame->label, COLOR_FRAME_SELECTED);
build_frames(frames_box);
- redraw();
+ if (after.min.x < before.min.x || after.min.y < before.min.y ||
+ after.max.x > before.max.x || after.max.y > before.max.y)
+ zoom_to_extents();
+ else
+ redraw();
}
--- End Message ---
--- Begin Message ---
Author: werner
Date: 2009-12-15 22:24:30 +0100 (Tue, 15 Dec 2009)
New Revision: 5757
Modified:
trunk/eda/fped/Makefile
trunk/eda/fped/gui_status.c
trunk/eda/fped/gui_status.h
trunk/eda/fped/gui_tool.c
trunk/eda/fped/gui_tool.h
trunk/eda/fped/inst.c
trunk/eda/fped/inst.h
Log:
It can sometimes be unclear what exactly has been selected. To improve this,
we now display an icon for the currently selected instance in the status area.
Modified: trunk/eda/fped/Makefile
===================================================================
--- trunk/eda/fped/Makefile 2009-12-15 20:05:37 UTC (rev 5756)
+++ trunk/eda/fped/Makefile 2009-12-15 21:24:30 UTC (rev 5757)
@@ -23,7 +23,7 @@
XPMS = point.xpm delete.xpm delete_off.xpm \
vec.xpm frame.xpm frame_locked.xpm frame_ready.xpm \
- line.xpm rect.xpm pad.xpm rpad.xpm circ.xpm \
+ line.xpm rect.xpm pad.xpm rpad.xpm arc.xpm circ.xpm \
meas.xpm meas_x.xpm meas_y.xpm \
stuff.xpm stuff_off.xpm meas_off.xpm \
bright.xpm bright_off.xpm all.xpm all_off.xpm
Modified: trunk/eda/fped/gui_status.c
===================================================================
--- trunk/eda/fped/gui_status.c 2009-12-15 20:05:37 UTC (rev 5756)
+++ trunk/eda/fped/gui_status.c 2009-12-15 21:24:30 UTC (rev 5757)
@@ -55,6 +55,7 @@
/* ----- setter functions -------------------------------------------------- */
+static GtkWidget *status_icon;
static GtkWidget *status_name, *status_entry;
static GtkWidget *status_type_x, *status_type_y, *status_type_entry;
static GtkWidget *status_box_x, *status_entry_y;
@@ -144,6 +145,15 @@
/* ----- complex status updates -------------------------------------------- */
+void status_set_icon(GtkWidget *image)
+{
+ vacate_widget(status_icon);
+ if (image)
+ gtk_container_add(GTK_CONTAINER(status_icon), image);
+ gtk_widget_show_all(status_icon);
+}
+
+
void status_set_xy(struct coord coord)
{
/* do dX/dY etc. stuff later */
@@ -920,9 +930,19 @@
void make_status_area(GtkWidget *vbox)
{
GtkWidget *tab, *sep;
+ GtkWidget *hbox, *vbox2;
+ hbox = gtk_hbox_new(FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
+
+ vbox2 = gtk_vbox_new(FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(hbox), vbox2, FALSE, FALSE, 1);
+
+ status_icon = gtk_event_box_new();
+ gtk_box_pack_start(GTK_BOX(vbox2), status_icon, FALSE, FALSE, 0);
+
tab = gtk_table_new(7, 3, FALSE);
- gtk_box_pack_start(GTK_BOX(vbox), tab, FALSE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX(hbox), tab, TRUE, TRUE, 0);
/* types */
Modified: trunk/eda/fped/gui_status.h
===================================================================
--- trunk/eda/fped/gui_status.h 2009-12-15 20:05:37 UTC (rev 5756)
+++ trunk/eda/fped/gui_status.h 2009-12-15 21:24:30 UTC (rev 5757)
@@ -84,6 +84,7 @@
void status_set_unit(const char *fmt, ...)
__attribute__((format(printf, 1, 2)));
+void status_set_icon(GtkWidget *image);
void status_set_xy(struct coord coord);
void status_set_angle_xy(struct coord v);
Modified: trunk/eda/fped/gui_tool.c
===================================================================
--- trunk/eda/fped/gui_tool.c 2009-12-15 20:05:37 UTC (rev 5756)
+++ trunk/eda/fped/gui_tool.c 2009-12-15 21:24:30 UTC (rev 5757)
@@ -18,6 +18,7 @@
#include "util.h"
#include "inst.h"
+#include "meas.h"
#include "obj.h"
#include "gui_util.h"
#include "gui_style.h"
@@ -30,6 +31,7 @@
#include "gui_tool.h"
+#include "icons/arc.xpm"
#include "icons/circ.xpm"
#include "icons/frame.xpm"
#include "icons/frame_locked.xpm"
@@ -977,6 +979,61 @@
}
+/* ----- Retrieve icons by instance characteristics ------------------------ */
+
+
+GtkWidget *get_icon_by_inst(const struct inst *inst)
+{
+ char **image;
+
+ switch (inst->prio) {
+ case ip_frame:
+ image = xpm_frame;
+ break;
+ case ip_pad_copper:
+ case ip_pad_special:
+ image = inst->obj->u.pad.rounded ? xpm_rpad : xpm_pad;
+ break;
+ case ip_circ:
+ image = xpm_circ;
+ break;
+ case ip_arc:
+ image = xpm_arc;
+ break;
+ case ip_rect:
+ image = xpm_rect;
+ break;
+ case ip_meas:
+ switch (inst->obj->u.meas.type) {
+ case mt_xy_next:
+ case mt_xy_max:
+ image = xpm_meas;
+ break;
+ case mt_x_next:
+ case mt_x_max:
+ image = xpm_meas_x;
+ break;
+ case mt_y_next:
+ case mt_y_max:
+ image = xpm_meas_y;
+ break;
+ default:
+ abort();
+ }
+ break;
+ case ip_line:
+ image = xpm_line;
+ break;
+ case ip_vec:
+ image = xpm_vec;
+ break;
+ default:
+ abort();
+ }
+ return make_image(DA, image);
+}
+
+
/* ----- tool bar creation ------------------------------------------------- */
Modified: trunk/eda/fped/gui_tool.h
===================================================================
--- trunk/eda/fped/gui_tool.h 2009-12-15 20:05:37 UTC (rev 5756)
+++ trunk/eda/fped/gui_tool.h 2009-12-15 21:24:30 UTC (rev 5757)
@@ -74,6 +74,8 @@
void tool_selected_inst(struct inst *inst);
+GtkWidget *get_icon_by_inst(const struct inst *inst);
+
void tool_reset(void);
GtkWidget *gui_setup_tools(GdkDrawable *drawable);
Modified: trunk/eda/fped/inst.c
===================================================================
--- trunk/eda/fped/inst.c 2009-12-15 20:05:37 UTC (rev 5756)
+++ trunk/eda/fped/inst.c 2009-12-15 21:24:30 UTC (rev 5757)
@@ -158,6 +158,7 @@
gui_frame_select_inst(inst);
if (inst->ops->select)
selected_inst->ops->select(inst);
+ status_set_icon(get_icon_by_inst(inst));
}
@@ -396,6 +397,7 @@
selected_inst = NULL;
edit_nothing();
refresh_pos();
+ status_set_icon(NULL);
}
@@ -536,6 +538,7 @@
inst = alloc_type(struct inst);
inst->ops = ops;
+ inst->prio = prio;
inst->vec = NULL;
inst->obj = NULL;
inst->base = inst->bbox.min = inst->bbox.max = base;
Modified: trunk/eda/fped/inst.h
===================================================================
--- trunk/eda/fped/inst.h 2009-12-15 20:05:37 UTC (rev 5756)
+++ trunk/eda/fped/inst.h 2009-12-15 21:24:30 UTC (rev 5757)
@@ -73,6 +73,7 @@
struct inst {
const struct inst_ops *ops;
+ enum inst_prio prio; /* currently only used for icon selection */
struct coord base;
struct bbox bbox;
struct vec *vec; /* NULL if not vector */
--- End Message ---
_______________________________________________
commitlog mailing list
commitlog@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/commitlog