1
0
mirror of git://projects.qi-hardware.com/fped.git synced 2024-11-06 00:54:03 +02:00
Commit Graph

178 Commits

Author SHA1 Message Date
werner
7eb3ac5ba2 When dragging an endpoint of an inverted measurement, we didn't consider that
inst->base and inst->u.meas.end are swapped, causing fped to crash in vec_at.
Also introduced a universal swap() function.

- util.h (swap): new swap function for arguments of any type
- gui_meas.c (begin_drag_move_meas, draw_move_meas): swap the endpoints if
  moving an inverted measurement
- coord.c (sort_coord): use swap() instead of swap_coord
- coord.h, coord.c (swap_coord): removed
- gui_util.c (save_pix_buf): use swap() instead of open-coding the swap 
- kicad.c (kicad_centric): use sort_coord instead of "manually" sorting the
  coordinates



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5968 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-05-30 09:04:26 +00:00
werner
c9af8cd0fe The mechanism for selecting points for measurements reaches its limits when
using frames to encapsulate building blocks, e.g., like macros or functions in
a programming language. Since measurements only know about the frame containing
a vector but not the frames containing that frame, invocations of this frame
from different places can only be distinguished within the min/next/max scheme.
(See the example in README.)

To eliminate this limitation, one needs a way to tell fped to consider a point
only if it has been instantiated through a certain path, e.g., by requiring
some other frames to be visited in its instantiation. This increases the number
of distinct points available for measurements.

The mechanism chosen is to qualify a measurement point with frames that lead to
it. This list of outer frames does not have to include all frames. Without
qualifying, the old behaviour results.

Note that this doesn't cover all possible ways in which a point can appear in
different roles. Multiple frame references can also result from repeating the
same frame reference in the same parent frame. The current qualification
mechanism does not allow such paths to be distinguished. However, one can 
always introduce intermediate frames for this purpose.

Furthermore, repetitions create multiple instances of a point, although in what
should be considered the same role.

- fpd.l: make scanner support free-format a little better by switching back to
  keyword mode after frame braces. This way, one can write a simple frame in a
  single line, which is useful for regression tests.
- fpd.l, fpd.y, README, test/dbg_meas: added %meas directive to print the 
  result of a measurement
- fpd.y, README: measurements can now be labeled. Note that, due to limitations
  of the grammar, the first measurement cannot be labeled.
- error.h, error.c (yywarn): new function for non-fatal diagnostics that always
  get reported to standard error
- bitset.h, bitset.c: functions to manipulate variable-size bit sets
- meas.h, fpd.y, README, test/meas_qual: added the means to specify qualifiers
  for points used in measurements
- dump.c (print_meas_base, print_meas): dump qualifiers
- delete.c (delete_references, test/del_frame): delete measurements that
  reference a frame being deleted in their qualifiers
- obj.h, obj.c (enumerate_frames, instantiate): enumerate all frames so that we
  have an index into the bit vector of visited frames
- meas.h, meas.c (reset_samples, meas_post), obj.c (generate_vecs,
  generate_frame, instantiate): record the set of frames visited for each
  sample
- meas.c (meas_post): only treat two instances of a point as equivalent if the
  set of frames visited of one of them is a superset of set of the other. In
  this case, keep the union of the two sets.
- meas.h, meas.c (meas_find_min, meas_find_next, meas_find_max),
  test/meas_qual: instantiate_meas_pkg only select points for which all frames
  in the qualification have been visited
- gui_meas.c (is_min, is_next, is_max, is_a_next): updated for above change
- inst.h, inst.c (curr_frame, propagate_bbox, add_inst, inst_begin_frame,
  inst_end_frame, inst_start): renamed curr_frame to frame_instantiating to
  avoid clash with curr_frame in fpd.y
- inst.h, inst.c (find_meas_hint): make global
- test/structure, test/del_vec, test/del_frame: fped now warns if a measurement
  is in an unlinked frame. Changed regressions tests to avoid this warning.
- test/Common: new function expect_grep to compare only part of the output



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5967 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-05-29 21:13:48 +00:00
werner
8e60952ba1 New option "-s scale" to set the exact scale factor for full-page Postscript
output.

- postscript.h (postscript_params): didn't declare this global variable
- postscript.c (ps_package_fullpage): if postscript_params.zoom is non-zero,
  scale to this value (instead of auto-scaling) 
- fped.c (usage, main): added option "-s scale" to set the scale factor for -P



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5954 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-05-03 13:41:24 +00:00
werner
24011c74d6 Removed an old bug: parentheses and backslash are meta-characters in Postscript
strings but weren't escaped until now.

- postscript.c: output all Postscript strings with ps_string, which correctly
  escapes parentheses and backslashes
- TODO: removed the bug entry



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5952 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-04-29 21:34:29 +00:00
werner
dbace0b2fa Cleaned up the disgusting mess that was the list of frames. The changes:
- removed root_frame. "frames" now takes its place.
- removed frame->prev. In those few cases where we need the previous frame (for
  deletion and dumping), we walk the list or recurse.
- the list of frames is now in GUI order, not file order.
- when reading the .fpd file, put the root frame first and leave it there.
- instead of walking the frames list and excluding the root frame by testing
  frame->name, just start at frames->next
- likewise, instead of testing !frame->name just use frame == frames



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5948 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-04-28 00:34:32 +00:00
werner
ac535d6e03 Deleting things often left measurements behind. Fixed these bugs, enhanced %del
to also delete frames and items in other frames than the current one, and added
the corresponding regression tests.

- fpd.y, README: %del can now also delete frames
- test/del_frame: regression test for frame deletion
- fpd.y: moved all debug items into debug_item, so that they can be invoked
  after defining measurements
- README: clarified that object labels aren't entirely hidden in the GUI
- delete.c (delete_references): also delete measurements referencing the frame
  (test/del_frame)
- fpd.y (dbg_link_frame): described why we need base_frame in addition to 
  base_vec
- fpd.y, README: %del can now also reach into frames other than the current one
- delete.c (do_delete_vec): also delete references in the root frame, i.e.,
  measurements (tests/del_vec)



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5947 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-04-27 22:36:46 +00:00
werner
dc1e644da1 In the GUI, pad names were always centered on the pad. In the case of
through-hole pads, this could easily make them disappear into the hole. We now
draw them outside the hole.

- gui_inst.c: when showing through-hole pads, gui_draw_pad_text now places the
  pad name into the largest area of the pad outside the hole
- test/frame_ref: removed redundant "with" in all titles



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5946 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-04-27 10:57:09 +00:00
werner
82a12023cd I thought there was a bug in frame ordering, but it turns out that it works
fine. Anyway, here's a new debug construct (%frame) and a bunch of new 
regression tests.

- fpd.y, fpd.l, README: added new directive %frame to link frames also to other
  frames than the current one (like in the GUI)
- gui_tool.h, gui_tool.c: export is_parent_of
- test/frame_ref: regression tests to ensure that frame order remains valid,
  even if we reference late from early frames



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5945 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-04-27 01:02:24 +00:00
werner
39fef16d1c Got rid of the requirement to have a "package" directive. Fixed a grammar error
found in the process. Also taught the regression test system a new trick: the
path to "fped" can be passed in the environment variable FPED. E.g.,
FPED=fped.r5943 make test

- fped.c (usage, main): duplicating the -T option produces a dump to stdout
  before exiting (like %dump would)
- test/Common: new command fped_dump to invoked fped with a second -T option
- test/Common: if the environment variable FPED is set, use its content to
  invoke fped (default is ../fped)
- test/Common: if the environment variable CWD_PREFIX is set, prepend it to
  $FPED if the latter is a relative path 
- Makefile (test, tests): set CWD_PREFIX to .., so that the path given in FPED
  is valid at the point of invocation
- fpd.y: revised grammar to make "package" optional
- fpd.y: measurements were syntactically allowed inside non-root frame
  (test/structure)
- test/structure: test various combinations of the grammatical file structure
- test/tsort: removed all the now unnecessary "package" directives



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5944 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-04-26 23:11:22 +00:00
werner
bc27b094af With a little help from m8cutils and abyss, we now have regression tests for
the topological sort. "make test" or "make tests" invokes the regression tests,
"make valgrind" runs them under valgrind's watchful eyes.

- fped.c (usage, main): added option -T to force batch mode (for regression
  testing)
- Makefile, test/Common: added regression test infrastructure
- test/tsort: test cases for the topological sort
- README: added pointer to test/tsort



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5943 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-04-26 21:30:21 +00:00
werner
190bcaf982 Added a topological sort algorithm, for use when dumping.
- tsort.h, tsort.c, Makefile: stable topological sort with priorities
- fpd.l, fpd.y: added directive %tsort to test-drive the sort algorithm
- README: documented %tsort



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5942 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-04-26 15:18:01 +00:00
werner
e047cc074d Holes can now also be output as KiCad modules.
- gui_style.c (gc_rim): slightly increased brightness when inactive
- kicad.c (kicad_pad): move coordinate transform to new function kicad_centric
- kicad.c: added pads with holes and mechanical holes
- inst.h (struct inst.u.hole), inst.c (inst_hole): added "layers" field, like 
  for pads
- layer.c (LAYER_COPPER, LAYER_PASTE, LAYER_MASK): renamed to LAYER_*_TOP and
  added macros for corresponding bottom layers
- layer.c (refine_layers): mirror top layers of through-hole pads
- layer.h, layer.c (mech_hole_layers): return the layer set for mechanical 
  layers



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5941 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-04-25 15:27:27 +00:00
werner
6db067a90f More work on holes: added documentation and Postscript output.
- overlap.c (inside, test_overlap): check for instance type 
- overlap.c (inside, test_overlap): support hole instances
- README: put a pointer to the GUI description at the beginning
- README, gui.html: documented role and creation of holes
- inst.h: holes can now link to pads and vice versa
- hole.c, obj.c (instantiate): connect holes with pads and apply consistency 
  checks
- postscript.c: added output for holes
- icons/hole.fig: make hatched surroundings of hole look more round



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5940 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-04-25 13:09:36 +00:00
werner
1dda2ac2ae When creating an object in the GUI, its label wasn't initialized. Added
infrastructure for hole objects. (Postscript and KiCad output are still 
missing, and so does sanity checking.)

- gui_tool.c (new_obj_unconnected): set obj->name to NULL
- added hole objects to tool bar, all the various GUI routines, the .fpd
  parser, and the .fpd dumper



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5939 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-04-25 10:58:07 +00:00
werner
9743cb6fa7 One more little DND surprise: drag-end doesn't get called if have a successful
drag-drop. So we have to explicitly clear "dragging", or the last frame
successfully referenced suddenly becomes unselectable.

- gui_frame_drag.c (drag_canvas_drop): call drag_end to clear "dragging"
- TODO: removed the entry about the frame reference procedure



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5938 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-04-25 00:37:04 +00:00
werner
af0d2c78cb Removing the old interface for adding frame refrences. Also updated the
documentation.

- Makefile, icons/frame_locked.fig, icons/frame_ready.fig: removed the icons of
  locked and ready frames 
- gui_tool.c: removed the frame tool and all the image handling associated with
  it, leaving only the bits in place that are used by frame to canvas dragging 
- gui_tool.h, gui_tool.c (tool_frame_update, tool_frame_deleted), gui_canvas.c
  (key_press_event), gui_frame.c (popup_del_frame, select_frame): removed
  the notifications of frame changes
- gui.html: removed the old clumsy frame reference procedure and described the
  new way



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5937 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-04-25 00:11:45 +00:00
werner
84e03e5542 Dragging a frame into the canvas reuses the hover and drag system. In order to
avoid accidently dragging away bits the selected item (and confusing the
internal logic of the hover and drag system in the process), we have to make
sure nothing is selected when we enter the canvas.

- gui_canvas.c (canvas_frame_begin): make sure no instance is selected



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5936 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-04-24 23:08:39 +00:00
werner
1cd6c924d0 Oops. Some nasty debugging code escaped.
- gui_frame_drag.c (drag_canvas_motion): removed broken experimental invocation
  of gtk_drag_finish



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5935 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-04-24 22:18:21 +00:00
werner
0b241a14fe Dragging a frame into the canvas now works. It's built on top of the frame
tool, with all the old code still around, so the code paths are a bit obscure.

- gui_frame_drag.c: use GTK_DEST_DEFAULT_MOTION instead of
  GTK_DEST_DEFAULT_HIGHLIGHT
- gui_frame_drag.c: put meat on the frame and canvas drag and drop skeleton
- gui_frame_drag.c (setup_frame_drag, setup_canvas_drag): use GDK_ACTION_COPY
  instead of GDK_ACTION_PRIVATE
- gui_frame_drag.h, gui_frame_drag.c (is_dragging_anything): new helper
  function to check if we're dragging anything, without specifying what
- gui_canvas.h, gui_canvas.c: added thin interface layer between gui_frame.c 
  and gui_tool.c
- gui_canvas.c (enter_notify_event, leave_notify_event): return FALSE so that
  other widgets can get the events, too
- gui_tool.h, gui_tool.c (tool_hover): return whether we found anything to 
  hover on
- gui_tool.h, gui_tool.c: added interface for dropping a frame on the canvas



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5932 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-04-24 21:46:43 +00:00
werner
a4d2926b2d Working towards the dragging of frames. Changed the press/drag/release logic of
tables such that items are selected on release and we can thus drag without
selecting. (From a user point of view, selecting would be fine. But selecting 
may sometimes cause a change_world or similar, destroying the widget, which 
upsets drag and drop.)

- gui_frame_drag.c (setup_var_drag, setup_value_drag): moved targets to file
  scope
- gui_frame_drag.c (has_target, drag_var_motion, drag_value_motion): Gtk
  doesn't check target compatibility for us, so we have to do this explicitly
- gui_frame_drag.c (drag_begin): don't leak the pixbuf
- gui_frame_drag.c (is_dragging, drag_end), gui_frame_drag.h: for drag vs.
  activations on button release, we now can test what is being dragged. For
  this, we have to explicitly clear the variable "dragging" when done.
- gui_frame_drag.c (setup_var_drag, setup_value_drag): moved common setup to
  setup_drag_common
- gui_frame_drag.c (setup_frame_drag, drag_frame_motion), gui_frame_drag.h, 
  gui_frame.c (frame_select_event, build_frame_label): added infrastructure for
  dragging frames
- gui_frame_drag.c (setup_canvas_drag, drag_canvas_motion), gui_frame_drag.h,
  gui_canvas.c (motion_notify_event, make_canvas): added infrastructure for
  dragging to the canvas
- gui_frame.c (table_var_select_event, table_value_select_event, build_table):
  split logic into press and release action, so that we can drag without
  implicitly selecting



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5930 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-04-23 22:01:56 +00:00
werner
093a34f860 Added support for reordering rows and columns in a table via the GUI. To move
a column, drag the variable or any of its values and drag horizontally. To move
a row, drag one of its value vertically.

- gui_frame.c (table_var_select_event, table_value_select_event): return FALSE
  if dragging is possible
- gui_frame.c (build_table), gui_frame_drag.h, gui_frame_drag.c, Makefile:
  support for rearranging tables using Gtk's drag and drop mechanism
- TODO: two items less



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5929 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-04-23 13:43:19 +00:00
werner
59335b63b0 The partial order algorithm in dump.c sometimes dumped objects before a vector
they referenced. As a band-aid, we now explicitly keep track of which vectors 
have been dumped, and defer objects accordingly. A more correct solution would
be to properly abstract the partial order algorithms (along with the heuristics
for maximizing the number of ".") and to implement it properly.

- fpd.y (debug_item): new rule for %dump and %exit, which can appear also among
  measurements
- fpd.y (frame_items, measurements):  rearranged grammar to allow debug_item
  also in measurements. To avoid ambiguities, the "measurements" section can no
  longer be empty, but it can be omitted as a whole.
- obj.h, dump.c (later, recurse_vec, order_frame): vectors now also have a
  "dumped" flag which is used in "later" to defer dumping an object until all
  the vectors it depends on have been dumped.



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5928 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-04-20 21:01:16 +00:00
werner
b7db446cbb - fped.c (load_file): don't falsely complain about empty files
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5925 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-04-20 03:16:09 +00:00
werner
6b22c8a579 The characteristics of the diagonal of the object selected (length and angle)
were taken from the bounding box and thus included silk width and other
confusing things.

- inst.c (rect_status_sort): wrapper for rect_status that sorts the coordinates
  (min/max)
- inst.c (line_op_select, rect_op_select, meas_op_select): display the
  characteristics of the diagonal of the ideal line(s), not of the bounding box
- inst.c (pad_op_select, rpad_op_select): normalize the diagonal by using
  rect_status_sort instead of rect_status. This makes pads behave like silk
  screen objects.



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5924 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-04-20 02:12:46 +00:00
werner
c9ca5a45be Updated copyright dates of files changed in 2010.
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5923 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-04-20 01:55:49 +00:00
werner
8cd9b7b514 Added a "Save as" dialog and made fped disable "Save" if working on a manually
created file. This is a precaution against accidently saving to a manual work,
which would change the structure and remove all comments.

- fped.h, fped.c, file.c: moved declaration of save_file_name into shared 
  header
- dump.h, dump.c (MACHINE_GENERATED): moved header marking machine-generated
  files into shared macro
- gui.c (save_as_fpd): added "Save as" dialog
- fped.h, fped.c (load_file), gui.c: disable "Save" if editing a file that 
  doesn't have the machine-generated header



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5922 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-04-20 01:11:45 +00:00
werner
e24b9de387 %dump didn't dump the root frame because this frame was only appended to the
list of frames at the end of parsing. We now tentatively append it each time
a %dump is requested.

- fpd.y: append the root frame before calling "dump"



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5921 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-04-19 22:57:51 +00:00
werner
6374b3a61a Added debugging directives to the fped language. They're describe at the end
of README.

- fpd.l, fpd.y, README: added debugging directives %del, %move, %print, %dump,
  and %exit
- obj.h, fpd.y (find_obj, find_label, new_obj): objects can now be labeled
- obj.c (obj_anchors), inst.c (inst_anchors): gathering the list of anchors is 
  now a per-object function, not an instance "method". inst_anchors implements 
  the vector vs. object switch.
- inst.h, inst.c: removed all *_op_anchors functions
- expr.c (str_unit): in the past, we returned a malloc'ed string, but these 
  times are long gone. Thus, don't stralloc("").



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5919 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-04-19 14:39:57 +00:00
werner
e302162a70 When unselecting a value selected for editing in a table with a single row, the
unselected value was set to the background color for an inactive row. Now it's
set to the color of an active row.

- gui_frame.c (unselect_value): to detect a table, consider not only the number
  of rows but also the number of columns
- gui_frame.c (unselect_value, edit_value_list): use COLOR_EXPR_* for
  expressions, not COLOR_VAR_* (this has no visual effect for now, since the
  colors in questions have the same value)



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5918 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-04-19 12:23:04 +00:00
werner
bacbfb3f39 When editing, fped would sometimes not respond to [Enter] if the value had not
changed. This was particularly noticeable when editing variable names.

- gui_status.c (activate): reset the selection (along with all open edits) also
  when nothing has changed



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5915 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-04-18 16:43:41 +00:00
werner
8e9001644c Make fped build with older versions of Gtl.
- gui_util.c: gtk_widget_get_snapshot is only available since Gtk version 2.14.
  Omit debug_save_widget if using an older version of Gtk. (Reported by Igor
  Almeida.)



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5853 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-03-16 12:37:14 +00:00
werner
aaba06fb24 Full-page postscript now includes all packages (not just the first one).
Measurement lines now have a fixed size, so they can't scale to invisibility.

- Makefile: don't pass CFLAGS twice when making dependencies
- postscript.c (postscript): moved iteration over packages to new function
  ps_for_all_pkg, for sharing with postscript_fullpage
- postscript.c (postscript_fullpage): print all packages
- postscript.c (ps_meas): use real size for measurement lines
- postscript.c (PS_MEAS_LINE): changed measurement line width from 0.015 scaled
  mm to 0.1 real mm



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5851 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-02-23 01:02:19 +00:00
werner
140b60d074 Generating full dependencies for each and every change slowed down development
quite a bit. We now use per-file granularity for dependencies, reducing the
overhead by about a factor of 30.

- Makefile: generate per-file dependencies (.d) when compiling, based on
  http://scottmcpeak.com/autodepend/autodepend.html
- Makefile: "depend" target is no longer used



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5850 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-02-20 05:10:24 +00:00
werner
ea8e848f72 New option -P for batch output for full-page postscript.
- fped.c (main, usage): new option -P to output full-page Postscript
- postscript.c (postscript): renamed full-page output to postscript_page,
  uncommented it, and added auto-zoom
- file.c, file.h (write_ps_fullpage): handler for full-page postscript
- fped.c (usage): clarified that -k and -p/-P don/t exclude each other



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5849 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-02-19 22:27:25 +00:00
werner
c8cf877204 Simplified and improved the design of wrapped tables.
- gui_frame.c (build_table): don't add an extra column for wrapped tables. They
  look better without it.
- gui_frame.c (build_table): add two pixels of background color between parts
  of a wrapped table
- gui_style.h (FRAME_AREA_MISC_WIDTH): reduced to better fit real layout



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5848 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-02-19 14:00:55 +00:00
werner
4bfb601a40 Wrap wide tables.
- gui_frame.c (build_table): restructured code to build tables column by column
  instead of row by row
- gui_frame.c (build_table): wrap tables wider than the screen area available
  for variables and tables
- gui_util.h, gui_util.c (get_widget_width): new helper function that returns a
  widget's requested width
- gui.c, gui_style.h: replace hard-coded initial pane size with constants
  DEFAULT_FRAME_AREA_WIDTH and DEFAULT_FRAME_AREA_HEIGHT
- gui.c (change_world): pass the width of the left pane as a wrapping hint to 
  build_frames
- gui_frame.c (build_frames): subtract width of longest package template or 
  frame name from available width
- gui.c (change_world): moved call to build_frames to separate function
  do_build_frames
- gui.c (gui_main): used g_signal_connect_swapped instead of g_signal_connect
  for no good reason



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5847 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-02-19 10:27:46 +00:00
werner
3ba5a476b8 - Makefile (SVN_VERSION): use "svn info -R" to get the correct SVN revision
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5846 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-02-18 14:18:30 +00:00
werner
53a01182a3 Show fped's SVN revision in the title bar.
- Makefile: pass SVN version and commit status to CPP
- gui.c (gui_main): show SVN revision in the title bar, if available



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5845 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-02-18 14:03:14 +00:00
werner
3d6ef48930 As a shortcut, accept entry of "0" as a valid distance for dimensions. (For
safety, this only works if used directly, not through variables.)

- gui_status.c (edit_any_expr): replaced with dist_expr_store, which changes
  values of "0" to "0mm"
- gui_status.c, gui_status.h (edit_dist_expr): new function to edit distance
  expressions
- inst.c (obj_line_edit, obj_rect_edit, obj_arc_edit, obj_meas_edit): changed
  edit_expr to edit_dist_expr



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5844 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-02-18 13:39:20 +00:00
werner
0115283735 Variables and loops can now be added from the variable/loop pop-ups, without
having to go all the way up to the frame.

- gui_frame.c: factory tables had very ragged indentation
- gui_frame.c: added "Add variable" and "Add loop" to variable, table, and loop
  pop-up



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5843 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-02-18 11:35:12 +00:00
werner
9c22c1b2e5 gtk_init calls setlocale(..., ""), which can upset all uses of scanf, printf,
etc. We restore sanity by resetting the locale to "C". Reported by Nick 
Oestergaard.

- gui.c (gui_init): reset the locale to "C" after calling gtk_init 



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5793 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-01-18 22:57:49 +00:00
werner
8a0039f202 When clicking on an instance, fped used to select the currenly active instance
of the corresponding object but didn't change any table or loop selection to
make it active. (It did already change the frame reference.) This meant that,
upon clicking on an instance, often a different instance of the same object
would be selected. This was confusing at best.

With the below changes, table rows and loop iterations are adjusted such that 
the instance that was clicked on becomes active. If the algorithm fails, fped 
will print "__inst_select: tries exhausted" and fail safely. Please report if 
this happens.

- obj.c (search_inst, find_inst, instantiate): added mechanism to search for 
  instances matching a previous instance
- obj.c (run_loops, iterate_tables): record matches in found_* elements of the
  object's struct
- obj.c (reset_found, activate_found): helper functions to initialize and apply
  the activation leading to the instance found
- inst.c (activate_item): added comment explaining how activate_item is
  supposed to work and the fallacies of that logic
- inst.c (inst_select): added tries counter to avoid infinite recursion when
  results don't converge
- inst.c (__inst_select): when selecting an instance in the same frame, adjust
  tables and loops such that the instance becomes active
- inst.c: added call to find_inst after most instance creations (add_inst)
- obj.h: documented the meaning of the curr[ent]*, active*, and found* fields



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5792 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-01-12 02:18:58 +00:00
werner
e84727ce95 When editing a variable or value, the actual value is now shown. The choice
of active frame reference, row, and loop instance affects this value, as it
should.

- obj.c (run_loops): reset loop->curr_value to UNDEF when instantiation is done
- obj.c (generate_frame): reset frame->curr_parent to NULL when instantiation
  is done
- expr.c (eval_var, eval_string_var): distinguish beteen instantiation and
  editing mode, and use "active" values in the latter
- gui_frame.c (edit_var, edit_value, edit_value_list): display the value of the
  variable or the active expression in the "X" field
- gui_frame.c (assignment_value_select_event, table_value_select_event,
  loop_from_select_event, loop_to_select_event): pass the frame to edit_value
  and edit_value_list
- expr.c (str_unit): since we may now accidently expose a wider range of
  exponents, removed -2 ... 2 exponent range limitation



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5788 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-01-10 13:09:55 +00:00
werner
393c178a5f Added tooltips for editable status area items. All tools are now tipped.
- gui_status.h, gui_status.c (edit_*): edit functions now accept a tooltip
- added tooltips for editable status area items
- tooltips on setup_set_type_* looked strange. Show them only for the value
  field next to the type field.



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5776 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-01-03 00:36:52 +00:00
werner
feabeb73f4 The build process used dependencies only if they were explicitly generated.
This often caused accidental builds without proper dependencies.

- Makefile: include .depend also if it doesn't exist yet. This way, GNU make
  will build it and all is fine.
- Makefile: use "-include" instead of "include" to avoid unnecessary nagging
- Makefile: make .depend depend on *.h and *.c, so that we catch all changes
  that _might_ affect the dependencies (this is a little inefficient but better
  safe than sorry)
- README: "make dep" is no longer needed
- TODO: added thoughts for more improvements



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5774 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-01-02 23:58:03 +00:00
werner
661398c20a Yet more tooltips. This time, for all non-editable fields in the status area.
- gui_status.h: use macro to generate status_set_* delarations, just as we use
  a macro for their definitions
- added tooltips for all non-editable fields in the status area



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5773 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-01-02 23:27:36 +00:00
werner
f9eefa4e69 When repeatedly clicking on a stack of items to cycle through the stack, a
click on an anchor point of the selected object would be treated as a drag, 
even if the click was very short. This created a very confusing user 
experience.

- gui_canvas.c (button_release_event): if we didn't "escape" the drag radius,
  don't treat the click as a drag but run the click-to-select process instead
  (note: the drag visualization still flickers briefly)
- gui_canvas.c (button_release_event): to find out if we've escaped the drag
  radius, just call drag_left instead of duplicating some of its code



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5772 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-01-02 22:04:25 +00:00
werner
522e8df574 When selecting a tool and then selecting an object, the tool still appeared to
be active, while in truth it had been reset internally.

- gui_canvas.c (button_press_event): if a click is used for selection (and not
  dragging), reset the tool first



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5771 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-01-02 21:38:15 +00:00
werner
1cd5e6da94 Canvas tooltips now work. The problem was that expose events set the paint
region to only cover the newly exposed area. This prevented the general 
redrawing from clearing areas that still contained hovering and dragging
items. However,the paint region has no effect on reading from the drawable.
Thus when rebuilding the hover and drag stack, the still tainted image was
stored.

This issue could be solved by either introducing a separate mode where the
stack is redrawn instead of rebuilt, or by turning off double-buffering. 
The former would complicate the already fickle logic of overlays, and not
having double-buffering doesn't seem to cause any ill effects.

- gui_canvas.c (make_canvas): disable double-buffering of canvas so that the
  paint region is not restricted in expose events
- gui_tool.c (tool_tip): enabled canvas tooltips



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5770 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-01-02 15:47:46 +00:00
werner
14f21c0aee More work on tooltips and a build fix.
- Makefile: use PID in temporary file name in PPM to XPM conversion, so that we
  don't get mysterious failures in parallel builds
- gui_util.c (debug_save_pixbuf, debug_save_widget): helper functions to debug
  pixbuf and widget content
- Makefile: added target "montage" to show the images recorded with
  debug_save_pixbuf and debug_save_widget
- gui_over.c: when debugging, record the saves pixbuf in files
- gui_tool.c (tool_hover): removed unnecessary initialization
- added infrastructure for tooltips on the canvas (doesn't work properly yet)



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5769 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-01-02 12:55:34 +00:00