r5757 - trunk/eda/fped
werner at docs.openmoko.org
werner at docs.openmoko.org
Tue Dec 15 22:24:30 CET 2009
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 */
More information about the commitlog
mailing list