r5419 - in trunk/eda/fped: . icons

werner at docs.openmoko.org werner at docs.openmoko.org
Tue Aug 11 22:52:33 CEST 2009


Author: werner
Date: 2009-08-11 22:52:33 +0200 (Tue, 11 Aug 2009)
New Revision: 5419

Added:
   trunk/eda/fped/icons/delete_off.fig
Modified:
   trunk/eda/fped/Makefile
   trunk/eda/fped/TODO
   trunk/eda/fped/gui_tool.c
   trunk/eda/fped/gui_tool.h
   trunk/eda/fped/icons/delete.fig
   trunk/eda/fped/inst.c
Log:
Make delete feel "safer".

- objects are now deleted by selecting them, then clicking on the delete icon
- removed tool_ops.click, which was only there because of delete



Modified: trunk/eda/fped/Makefile
===================================================================
--- trunk/eda/fped/Makefile	2009-08-11 20:17:39 UTC (rev 5418)
+++ trunk/eda/fped/Makefile	2009-08-11 20:52:33 UTC (rev 5419)
@@ -18,7 +18,7 @@
 
 XPMS = point.xpm delete.xpm vec.xpm frame.xpm frame_locked.xpm frame_ready.xpm \
        line.xpm rect.xpm pad.xpm circ.xpm meas.xpm meas_x.xpm meas_y.xpm \
-       stuff.xpm stuff_off.xpm meas_off.xpm
+       stuff.xpm stuff_off.xpm meas_off.xpm delete_off.xpm
 
 CFLAGS_GTK = `pkg-config --cflags gtk+-2.0`
 LIBS_GTK = `pkg-config --libs gtk+-2.0`

Modified: trunk/eda/fped/TODO
===================================================================
--- trunk/eda/fped/TODO	2009-08-11 20:17:39 UTC (rev 5418)
+++ trunk/eda/fped/TODO	2009-08-11 20:52:33 UTC (rev 5419)
@@ -2,9 +2,10 @@
 - populate input area (still needed: mm/mil, rezoom)
 - add default unit (combine with grid unit selection ?)
 - consider adding auto/mm/mil selection for each dimension
-- add postscript output
+- add postscript output (partially done)
 - add option to include/omit helper vecs and frames (done for display, still
-  need postscript)
+  need postscript). Better idea: in PS, print the component 10x, 1x, and then
+  each individual frame 10x.
 
 Minor missing features:
 - reorder frames (can use text editor)
@@ -35,6 +36,9 @@
 - the drag logic is too complex. Better: let tool/instance just generate the
   list of points at each stage, then handle the highlighting and hovering
   inside a dragging module.
+- code organization is very poor. E.g., functions belonging to the different
+  items (pads, silk objects, vectors, etc.) should be grouped by item, not by
+  type of function, similar to how some things are now with gui_meas.c
 
 Open decisions:
 - Q: should loop be (start, last) or (start, iterations) ? or start ... last ?
@@ -60,5 +64,8 @@
 - 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
-- future: consider editing off-canvas items in place
+- 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/gui_tool.c
===================================================================
--- trunk/eda/fped/gui_tool.c	2009-08-11 20:17:39 UTC (rev 5418)
+++ trunk/eda/fped/gui_tool.c	2009-08-11 20:52:33 UTC (rev 5419)
@@ -41,15 +41,17 @@
 #include "icons/pad.xpm"
 #include "icons/point.xpm"
 #include "icons/delete.xpm"
+#include "icons/delete_off.xpm"
 #include "icons/rect.xpm"
 #include "icons/vec.xpm"
 
 
-static GtkWidget *ev_point, *ev_frame;
+static GtkWidget *ev_point, *ev_delete, *ev_frame;
 static GtkWidget *active_tool;
 static struct tool_ops *active_ops = NULL;
 static struct inst *hover_inst = NULL;
 static GtkWidget *frame_image, *frame_image_locked, *frame_image_ready;
+static GtkWidget *delete_image[2];
 
 static struct drag_state {
 	struct inst *inst; /* non-NULL if dragging an existing object */
@@ -167,24 +169,28 @@
 /* ----- delete ------------------------------------------------------------ */
 
 
-static void click_delete(struct coord pos)
+static void tool_selected_delete(void)
 {
-	inst_deselect();
-	inst_select(pos);
 	if (selected_inst) {
 		tool_dehover();
 		inst_delete(selected_inst);
+		change_world();
 	}
-	change_world();
 	tool_reset();
 }
 
 
 static struct tool_ops delete_ops = {
-	.click		= click_delete,
+	.tool_selected	= tool_selected_delete,
 };
 
 
+void tool_selected_inst(struct inst *inst)
+{
+	set_image(ev_delete, delete_image[inst != NULL]);
+}
+
+
 /* ----- vec --------------------------------------------------------------- */
 
 
@@ -772,7 +778,7 @@
  * |  |
  * N  N  don't
  * Y  -  if we could drag, drag_new/end_new, else fall over to tool
- * N  Y  click, else single-click creation, else drag_new/end_new
+ * N  Y  else single-click creation, else drag_new/end_new
  */
 
 int tool_consider_drag(struct coord pos)
@@ -800,10 +806,6 @@
 	}
 	if (!active_ops)
 		return 0;
-	if (active_ops->click) {
-		active_ops->click(pos);
-		return 0;
-	}
 
 	curr = get_hover_inst(pos);
 	if (!curr)
@@ -961,8 +963,8 @@
 
 	ev_point = tool_button(bar, drawable, xpm_point,
 	    tool_button_press_event, NULL);
-	tool_button(bar, drawable, xpm_delete,
-	    tool_button_press_event, &delete_ops);
+	ev_delete = tool_button(bar, drawable, NULL,
+	     tool_button_press_event, &delete_ops);
 	tool_separator(bar);
 	tool_button(bar, drawable, xpm_vec,
 	    tool_button_press_event, &vec_ops);
@@ -991,6 +993,10 @@
 	    gtk_widget_ref(make_image(drawable, xpm_frame_ready));
 	set_frame_image(frame_image);
 
+	delete_image[0] = gtk_widget_ref(make_image(drawable, xpm_delete_off));
+	delete_image[1] = gtk_widget_ref(make_image(drawable, xpm_delete));
+	set_image(ev_delete, delete_image[0]);
+
 	tool_reset();
 
 	return bar;

Modified: trunk/eda/fped/gui_tool.h
===================================================================
--- trunk/eda/fped/gui_tool.h	2009-08-11 20:17:39 UTC (rev 5418)
+++ trunk/eda/fped/gui_tool.h	2009-08-11 20:52:33 UTC (rev 5419)
@@ -23,7 +23,6 @@
 	void (*tool_selected)(void);
 	void (*tool_deselected)(void);
 	struct inst *(*find_point)(struct coord pos);
-	void (*click)(struct coord pos);
 	void (*begin_drag_new)(struct inst *from);
 	struct pix_buf *(*drag_new)(struct inst *from, struct coord to);
 	int (*end_new_raw)(struct inst *from, struct coord to);
@@ -71,6 +70,8 @@
 void tool_frame_update(void);
 void tool_frame_deleted(const struct frame *frame);
 
+void tool_selected_inst(struct inst *inst);
+
 void tool_reset(void);
 
 GtkWidget *gui_setup_tools(GdkDrawable *drawable);

Modified: trunk/eda/fped/icons/delete.fig
===================================================================
--- trunk/eda/fped/icons/delete.fig	2009-08-11 20:17:39 UTC (rev 5418)
+++ trunk/eda/fped/icons/delete.fig	2009-08-11 20:52:33 UTC (rev 5419)
@@ -9,7 +9,7 @@
 1200 2
 2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
 	 3600 2400 6000 2400 6000 4800 3600 4800 3600 2400
-2 1 0 15 18 7 50 -1 -1 0.000 0 1 -1 0 0 2
+2 1 0 15 19 7 50 -1 -1 0.000 0 1 -1 0 0 2
 	 4125 2925 5475 4275
-2 1 0 15 18 7 50 -1 -1 0.000 0 1 -1 0 0 2
+2 1 0 15 19 7 50 -1 -1 0.000 0 1 -1 0 0 2
 	 4125 4275 5475 2925

Added: trunk/eda/fped/icons/delete_off.fig
===================================================================
--- trunk/eda/fped/icons/delete_off.fig	                        (rev 0)
+++ trunk/eda/fped/icons/delete_off.fig	2009-08-11 20:52:33 UTC (rev 5419)
@@ -0,0 +1,15 @@
+#FIG 3.2  Produced by xfig version 3.2.5a
+Landscape
+Center
+Inches
+A4      
+100.00
+Single
+-2
+1200 2
+2 2 0 1 0 7 55 -1 10 0.000 0 0 -1 0 0 5
+	 3600 2400 6000 2400 6000 4800 3600 4800 3600 2400
+2 1 0 15 0 7 50 -1 -1 0.000 0 1 -1 0 0 2
+	 4125 2925 5475 4275
+2 1 0 15 0 7 50 -1 -1 0.000 0 1 -1 0 0 2
+	 4125 4275 5475 2925

Modified: trunk/eda/fped/inst.c
===================================================================
--- trunk/eda/fped/inst.c	2009-08-11 20:17:39 UTC (rev 5418)
+++ trunk/eda/fped/inst.c	2009-08-11 20:52:33 UTC (rev 5419)
@@ -118,6 +118,8 @@
 	deselect_outside();
 	edit_nothing();
 	selected_inst = NULL;
+	if (selected_inst)
+		tool_selected_inst(NULL);
 	FOR_INST_PRIOS_DOWN(prio) {
 		if (!show(prio))
 			continue;
@@ -154,6 +156,7 @@
 
 selected:
 	set_path(1);
+	tool_selected_inst(selected_inst);
 	if (selected_inst->ops->select)
 		selected_inst->ops->select(selected_inst);
 	return 1;
@@ -263,8 +266,10 @@
 
 void inst_deselect(void)
 {
-	if (selected_inst)
+	if (selected_inst) {
 		set_path(0);
+		tool_selected_inst(NULL);
+	}
 	deselect_outside();
 	status_set_type_x("");
 	status_set_type_y("");




More information about the commitlog mailing list