r5349 - developers/werner/fped
werner at docs.openmoko.org
werner at docs.openmoko.org
Fri Jul 31 09:39:29 CEST 2009
Author: werner
Date: 2009-07-31 09:39:28 +0200 (Fri, 31 Jul 2009)
New Revision: 5349
Modified:
developers/werner/fped/TODO
developers/werner/fped/gui_canvas.c
developers/werner/fped/gui_status.c
developers/werner/fped/inst.c
developers/werner/fped/obj.c
Log:
- only highlight active frame, not all other iterations as well
- inst_select now returns 1 if selection was successful. Previous logic of
trying to detect changes was broken.
- when deselecting, redraw the canvas
- hide parameters if nothing is selected
- converted status area to table
Modified: developers/werner/fped/TODO
===================================================================
--- developers/werner/fped/TODO 2009-07-31 03:56:43 UTC (rev 5348)
+++ developers/werner/fped/TODO 2009-07-31 07:39:28 UTC (rev 5349)
@@ -25,7 +25,7 @@
- consider using cairo instead of gdk
- Q: add frame arguments ? (e.g., .frame pad(pin_num_offset) ...)
- Q: should we make it a requirement to generate objects only once ?
-- convert status display to table
- advanced: non-standard solder mask
- advanced: solder paste exceptions (subtractive, additive)
- advanced: silk line width
+- make column of entry field greedily consume all unallocated space
Modified: developers/werner/fped/gui_canvas.c
===================================================================
--- developers/werner/fped/gui_canvas.c 2009-07-31 03:56:43 UTC (rev 5348)
+++ developers/werner/fped/gui_canvas.c 2009-07-31 07:39:28 UTC (rev 5349)
@@ -136,11 +136,14 @@
gpointer data)
{
struct coord pos = canvas_to_coord(&ctx, event->x, event->y);
+ const struct inst *prev;
switch (event->button) {
case 1:
+ prev = selected_inst;
inst_deselect();
- if (inst_select(&ctx, pos))
+ inst_select(&ctx, pos);
+ if (prev != selected_inst)
redraw();
break;
case 2:
Modified: developers/werner/fped/gui_status.c
===================================================================
--- developers/werner/fped/gui_status.c 2009-07-31 03:56:43 UTC (rev 5348)
+++ developers/werner/fped/gui_status.c 2009-07-31 07:39:28 UTC (rev 5349)
@@ -70,72 +70,62 @@
/* ----- setup ------------------------------------------------------------- */
-void make_status_area(GtkWidget *vbox)
+
+static GtkWidget *add_label(GtkWidget *tab, int col, int row)
{
- GtkWidget *hbox, *v2box;
+ GtkWidget *label;
- hbox = gtk_hbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
+ label = label_in_box_new(NULL);
+ gtk_table_attach_defaults(GTK_TABLE(tab), box_of_label(label),
+ col, col+1, row, row+1);
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
+ gtk_label_set_selectable(GTK_LABEL(label), TRUE);
+ return label;
+}
- /* name and input */
- v2box = gtk_vbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX(hbox), v2box, TRUE, TRUE, 1);
+void make_status_area(GtkWidget *vbox)
+{
+ GtkWidget *tab, *hbox;
- status_name = label_in_box_new("<name>");
- gtk_box_pack_start(GTK_BOX(v2box), box_of_label(status_name),
- FALSE, FALSE, 1);
+ tab = gtk_table_new(5, 2, FALSE);
+ gtk_box_pack_start(GTK_BOX(vbox), tab, FALSE, TRUE, 0);
- gtk_misc_set_alignment(GTK_MISC(status_name), 0, 0);
- gtk_label_set_selectable(GTK_LABEL(status_name), TRUE);
+ /* name and input */
+ status_name = add_label(tab, 0, 0);
+
+ /*
+ * @@@ this should make the entry consume all available space. alas, it
+ * doesn't work like that :-(
+ */
+ hbox = gtk_hbox_new(TRUE, 0);
+ gtk_table_attach_defaults(GTK_TABLE(tab), hbox,
+ 0, 1, 1, 2);
+
status_entry = gtk_entry_new();
- gtk_box_pack_start(GTK_BOX(v2box), status_entry, TRUE, FALSE, 1);
+ gtk_box_pack_start(GTK_BOX(hbox), status_entry, TRUE, TRUE, 0);
/* x / y */
- v2box = gtk_vbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX(hbox), v2box, FALSE, FALSE, 1);
+ status_x = add_label(tab, 1, 0);
+ status_y = add_label(tab, 1, 1);
- status_x = gtk_label_new("x = ...");
- gtk_box_pack_start(GTK_BOX(v2box), status_x, TRUE, FALSE, 1);
-
- status_y = gtk_label_new("y = ...");
- gtk_box_pack_start(GTK_BOX(v2box), status_y, FALSE, FALSE, 1);
-
/* r / angle */
- v2box = gtk_vbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX(hbox), v2box, FALSE, FALSE, 1);
+ status_r = add_label(tab, 2, 0);
+ status_angle = add_label(tab, 2, 1);
- status_r = gtk_label_new("r = ...");
- gtk_box_pack_start(GTK_BOX(v2box), status_r, TRUE, FALSE, 1);
-
- status_angle = gtk_label_new("a = ...");
- gtk_box_pack_start(GTK_BOX(v2box), status_angle, TRUE, FALSE, 1);
-
/* sys / user pos */
- v2box = gtk_vbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX(hbox), v2box, TRUE, TRUE, 1);
+ status_sys_pos = add_label(tab, 3, 0);
+ status_user_pos = add_label(tab, 3, 1);
- status_sys_pos = gtk_label_new("1 / 2");
- gtk_box_pack_start(GTK_BOX(v2box), status_sys_pos, TRUE, FALSE, 1);
-
- status_user_pos = gtk_label_new("1 / 2");
- gtk_box_pack_start(GTK_BOX(v2box), status_user_pos, TRUE, FALSE, 1);
-
/* zoom / grid */
- v2box = gtk_vbox_new(FALSE, 0);
- gtk_box_pack_end(GTK_BOX(hbox), v2box, FALSE, FALSE, 1);
+ status_zoom = add_label(tab, 4, 0);
+ status_grid = add_label(tab, 4, 1);
- status_zoom = gtk_label_new("1x");
- gtk_box_pack_start(GTK_BOX(v2box), status_zoom, TRUE, FALSE, 1);
-
- status_grid = gtk_label_new("10mil");
- gtk_box_pack_start(GTK_BOX(v2box), status_grid, TRUE, FALSE, 1);
-
/* message bar */
status_msg = gtk_statusbar_new();
Modified: developers/werner/fped/inst.c
===================================================================
--- developers/werner/fped/inst.c 2009-07-31 03:56:43 UTC (rev 5348)
+++ developers/werner/fped/inst.c 2009-07-31 07:39:28 UTC (rev 5349)
@@ -60,7 +60,6 @@
int inst_select(const struct draw_ctx *ctx, struct coord pos)
{
struct inst *inst;
- const struct inst *prev = selected_inst;
int best_dist, dist;
selected_inst = NULL;
@@ -78,7 +77,7 @@
if (selected_inst->ops->select)
selected_inst->ops->select(selected_inst);
}
- return prev != selected_inst;
+ return selected_inst != NULL;
}
@@ -86,6 +85,11 @@
{
if (selected_inst)
set_path(0);
+ status_set_name("");
+ status_set_x("");
+ status_set_y("");
+ status_set_r("");
+ status_set_angle("");
selected_inst = NULL;
}
Modified: developers/werner/fped/obj.c
===================================================================
--- developers/werner/fped/obj.c 2009-07-31 03:56:43 UTC (rev 5348)
+++ developers/werner/fped/obj.c 2009-07-31 07:39:28 UTC (rev 5349)
@@ -264,7 +264,7 @@
/*
* We ensure during construction that frames can never recurse.
*/
- inst_begin_frame(frame, base, frame == active_frame);
+ inst_begin_frame(frame, base, active && frame == active_frame);
frame->curr_parent = parent;
ok = iterate_tables(frame, frame->tables, base, active);
inst_end_frame(frame);
More information about the commitlog
mailing list