diff --git a/Makefile b/Makefile
index 5e45d18..1e12ee1 100644
--- a/Makefile
+++ b/Makefile
@@ -12,6 +12,8 @@
PREFIX = /usr/local
+UPLOAD = werner@sita.openmoko.org:public_html/fped/
+
OBJS = fped.o expr.o coord.o obj.o delete.o inst.o util.o error.o \
unparse.o file.o dump.o kicad.o postscript.o meas.o \
cpp.o lex.yy.o y.tab.o \
@@ -25,6 +27,8 @@ XPMS = point.xpm delete.xpm delete_off.xpm \
stuff.xpm stuff_off.xpm meas_off.xpm \
bright.xpm bright_off.xpm all.xpm all_off.xpm
+PNGS = intro-1.png intro-2.png intro-3.png intro-4.png intro-5.png intro-6.png
+
SHELL = /bin/bash
CFLAGS_GTK = `pkg-config --cflags gtk+-2.0`
LIBS_GTK = `pkg-config --libs gtk+-2.0`
@@ -71,7 +75,7 @@ endif
# ----- Rules -----------------------------------------------------------------
-.PHONY: all dep depend clean install uninstall
+.PHONY: all dep depend clean install uninstall upload-manual
.SUFFIXES: .fig .xpm
@@ -102,6 +106,13 @@ y.tab.o: y.tab.c
gui_tool.o gui.o: $(XPMS:%=icons/%)
+# ----- Upload the GUI manual -------------------------------------------------
+
+upload-manual: $(XPMS:%=icons/%)
+ scp gui.html README $(UPLOAD)/
+ scp $(XPMS:%=icons/%) $(UPLOAD)/icons/
+ scp $(PNGS:%=screens/%) $(UPLOAD)/screens/
+
# ----- Dependencies ----------------------------------------------------------
dep depend .depend: lex.yy.c y.tab.h y.tab.c
diff --git a/gui.html b/gui.html
new file mode 100644
index 0000000..5b044a0
--- /dev/null
+++ b/gui.html
@@ -0,0 +1,235 @@
+
+
+Fped GUI Manual
+
+
+Fped GUI Manual
+
+This manual introduces the basic concepts of Fped and explains the elements
+of the graphical user interface. Please refer to the file
+README for more
+technical details and a discussion of the scripting language used by fped.
+
+
+Objects and instances
+
+Footprints tend to be highly repetitive, with many pads placed in a
+simple geometrical pattern. With fped, the user specifies the elements
+to repeat and the way they are repeated. Fped then generates the
+repetitions automatically.
+
+Here is a simple example:
+
+ - Start fped without a command-line argument.
+
- Right-click on the yellow field that says "(root)" and select
+ "Add loop". An entry saying "_ = 0 ... 0 (0)" appears next to the
+ yellow field.
+
+
- Click on the underscore, type n=1,5 and press Enter.
+ The entry should now show "n = 1 ... 5 (1 2 3 4 5)"
+
+
- Click on the dark-yellow vector icon on the right-hand side.
+ A red frame shows that it is selected.
+
- Move the mouse pointer to the green dot in the middle of the
+ black canvas. A red circle appears when the pointer is over the
+ dot.
+
- Press the left mouse button, drag a little to the right, and
+ release the mouse button. A white line appears and changes
+ to dark yellow after the button is released.
+
- Click on the yellow line. It is now shown in bright yellow and
+ a number of text entry fields appear below the canvas.
+
+
- Click into the field on the top that probably says "0.1mm",
+ change it to n*1mm and press Enter.
+
- Select "Zoom all" from the "View" drop-down menu. The canvas
+ should now show the green dot on the left, with a yellow arrow
+ pointing to the right, and four more even darker arrows following
+ that arrow.
+
+
- Click on the icon depicting a light-blue circle.
+
- Move the mouse pointer over the green dot, then drag to the
+ circle at the end of the vector, and release the mouse button.
+ A series of partial circles should appear.
+
+
- Select "Zoom all" again to show the full circles.
+
+
+The graphical items you have entered are a vector and a circle with the
+radius determined by the vector. We call these items "objects". Furthermore,
+you have defined a variable that gets set to the values from 1 to 5, in
+increments of one. Fped had repeatedly drawn the objects for each such
+value. We call the item that have been drawn "instances".
+
+The innermost vector and circle are highlighted. You can highlight other
+instances of the same objects by clicking on the numbers (1 2 3 4 5) shown
+next to the loop.
+
+
+
Frames
+
+Frames serve various purposes:
+
+ - To structure the footprint drawing by grouping like elements.
+ For example, one may want to place pads, outline, and the keep-out
+ area in different frames, and probably subdivide some of those
+ constructs even further.
+
- To define an element that is used in several places. For example,
+ a pad.
+
- To define a repetition through a loop or a table.
+
- To set variables for child frames.
+
Variables
+
+
+Iconography
+
+The right-hand side of the fped window shows the component being drawn on a
+black background. We call this the canvas. It is surrounded by a toolbar on
+the right side and a few buttons with visibility options at the top.
+
+
+The canvas
+
+
+Blue screen
+
+When an expression uses an unknown variable or evaluates to an incorrect
+value (e.g., a bare number where a dimension is expected), the
+instantiation fails. Fped indicates this by changing the background color
+of the canvas from black to blue. The cause of the failure is explained
+in the status bar at the bottom.
+
+In this state, the canvas is no longer updated when making changes until
+the problem has been resolved. The most common causes are a misspelt
+variable name in an expression, the use of a number without unit where a
+dimension is expected, or the removal of a variable that's still used
+somewhere.
+
+If the location of the error is not obvious, the list of objects can be
+shown by selecting "Swap var&code" from the View menu. The object
+in which the error occurred is shown in red. If the error occurred in a
+loop variable, the variable name is shown in red.
+
+
+
Visibility options
+
+When working on a complex component, the number of elements shown can be
+overwhelming. The visibility options help to quickly hide irrelevant
+details and get one's bearings. They are located in the menu bar at the
+top.
+
+
+ - Show all frames. If disabled, only show the currently active frame.
+
+ - Show vectors and frames.
+
+ - Show measurements.
+
+ - Highlight the elements that will be exported to KiCad, i.e.,
+ the pads and the silk screen drawings. To show the component
+ exactly as it will appear in KiCad, also turn off vectors,
+ frames, and measurements.
+
+The visibility options can be combined.
+
+
+Tools
+
+Tools are used to add new elements and to manipulate existing ones.
+
+
+ - The pointer. This is the default tool. The pointer is used to
+ select items and do move points of the selected item.
+
+ To move points, select the item, then move the mouse pointer over
+ the point to move. A red circle will appear under the mouse pointer.
+ Then drag the point to its new location and release the mouse button.
+
+ - Delete the currently selected item. Whenever an item is selected,
+ the delete icon lights up. Clicking the icon deletes the item.
+ To undelete the item, press U.
+
+ - Add a vector. To add a new vector, move the mouse pointer to the
+ new vector's starting point then drag towards the desired end point.
+ Vectors are normally specified via parameters. To enter the parameters,
+ click on the new vector.
+
+ Note that the starting point of the vector has to be in the same
+ frame as the vector being drawn. This limitation also applies to
+ points defining pads and silk-screen items.
+
+
+ - Add a frame reference. A frame reference inserts the content of a
+ frame into another frame. There are three steps in this process:
+
+ - Select the frame to be inserted and click on the frame icon.
+ A large black dot appears in the icon to indicate that a frame
+ reference has been chosen.
+
- Select the frame into which to insert the reference. The dot
+ changes to green to indicate that the reference can now be placed.
+ If the dot stays black, then the selected frame is not a valid
+ destination, i.e., because the reference in turn references this
+ frame.
+
- Click on the location at which to attach the reference. This
+ location can be either the end of a vector or the frame's origin.
+
+ When finished, don't forget that the destination frame is still selected.
+ In order to add elements to the newly referenced frame, you have to
+ select it first.
+
+ - Add a pad. Pads are either rectangular or rounded. They are
+ defined by two points which are opposite corners of the rectangle
+ containing the pad. Move the mouse cursor to the first point, then
+ drag to the second point. The pad's name can be edited after selecting
+ the pad.
+
+ - Add a line or a rectangle. Similar to pads, lines and rectangles
+ are defined by two points. The width of the line can be edited after
+ selecting the line or rectangle.
+
+ - Add circle or arc. Circles are defined by their center end a
+ point at their radius. An arc has a third point, which defines the
+ angle at which the arc ends. If this third point is not located on
+ the radius, the arc ends where an imaginary line between the center
+ and the end point would intersect with the radius.
+
+ An arc is made by first drawing a circle with the radius point at
+ the location where the arc should start. Then click and hold the
+ radius point to drag the end point to the desired location.
+
+ To change the radius point of a circle, first drag the end point,
+ then drag the radius point itself to that same location.
+
+
+ - Add a measurement. Measurements show the distance between points.
+ They can either measure diagonally or only horizontally or only vertically.
+ Unlike other items, measurements are not limited to points in the same
+ frame. Instead, they operate on the minimum, maximum, and next greater
+ coordinates of instances of objects.
+
+ A measurement is added as follows:
+
+ - Click on one of the three measurement icons to select the
+ measurement type. All possible endpoints are highlighted.
+
- Drag from the desired starting point. Now all the endpoints
+ available for this starting point are highlighted.
+
- Drag to the endpoint and release the mouse button. The measurement
+ will now appear as a double-headed arrow and text between the two
+ points (if this is a diagonal measurement) or extending vertically or
+ horizontally from one of the two points.
+
- To move the measurement arrow away from the two points, select
+ the measurement and set an offset.
+
+ Sometimes, the second point becomes unavailable after selecting the
+ first point. This means that the two points are not a minimum or maximum,
+ or a minimum and the next greater neighbour. In this case, just try
+ another pair of points measuring the same distance.
+
+
+
+Keyboard shortcuts
+
+
+
diff --git a/gui_frame.c b/gui_frame.c
index a8a6d1d..3c841d3 100644
--- a/gui_frame.c
+++ b/gui_frame.c
@@ -1013,7 +1013,7 @@ static void build_loop(GtkWidget *vbox, struct frame *frame,
for (i = 0; i != loop->iterations; i++) {
label = add_activator(hbox, loop->active == i,
- loop_select_event, loop, "%d", i);
+ loop_select_event, loop, "%g", loop->n+i);
gtk_object_set_data(GTK_OBJECT(box_of_label(label)), "value",
(gpointer) (long) i);
diff --git a/obj.c b/obj.c
index 3042ef3..3fa66b1 100644
--- a/obj.c
+++ b/obj.c
@@ -238,7 +238,10 @@ static int run_loops(struct frame *frame, struct loop *loop,
n++;
}
loop->initialized = 0;
- loop->iterations = n;
+ if (active) {
+ loop->n = from.n;
+ loop->iterations = n;
+ }
return 1;
fail:
@@ -279,6 +282,17 @@ static int generate_frame(struct frame *frame, struct coord base,
}
+static void reset_all_loops(void)
+{
+ const struct frame *frame;
+ struct loop *loop;
+
+ for (frame = frames; frame; frame = frame->next)
+ for (loop = frame->loops; loop; loop = loop->next)
+ loop->iterations = 0;
+}
+
+
int instantiate(void)
{
struct coord zero = { 0, 0 };
@@ -287,6 +301,7 @@ int instantiate(void)
meas_start();
inst_start();
instantiation_error = NULL;
+ reset_all_loops();
ok = generate_frame(root_frame, zero, NULL, NULL, 1);
if (ok)
ok = instantiate_meas();
diff --git a/obj.h b/obj.h
index 4bb4804..164a696 100644
--- a/obj.h
+++ b/obj.h
@@ -79,6 +79,7 @@ struct loop {
/* GUI use */
int active; /* n-th iteration is active, 0 based */
+ double n; /* start value when it was active */
int iterations; /* iterations when it was active */
/* for evaluation */
diff --git a/screens/intro-1.png b/screens/intro-1.png
new file mode 100644
index 0000000..d3edfca
Binary files /dev/null and b/screens/intro-1.png differ
diff --git a/screens/intro-2.png b/screens/intro-2.png
new file mode 100644
index 0000000..842e887
Binary files /dev/null and b/screens/intro-2.png differ
diff --git a/screens/intro-3.png b/screens/intro-3.png
new file mode 100644
index 0000000..e466c17
Binary files /dev/null and b/screens/intro-3.png differ
diff --git a/screens/intro-4.png b/screens/intro-4.png
new file mode 100644
index 0000000..6bf0fd1
Binary files /dev/null and b/screens/intro-4.png differ
diff --git a/screens/intro-5.png b/screens/intro-5.png
new file mode 100644
index 0000000..01bcc97
Binary files /dev/null and b/screens/intro-5.png differ
diff --git a/screens/intro-6.png b/screens/intro-6.png
new file mode 100644
index 0000000..20c8e31
Binary files /dev/null and b/screens/intro-6.png differ