[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-user: Recap of remaining metric-conversion work
Hey all,
On a recent bug report, Peter C. asked for a summary of the
remaining work needed for the metric conversion. Here you go:
It has been a busy week for me so no progress in the last
eight days or so. Even so, it's been a long time since my
last update...
On my personal branch I have made a fair bit of progress
that has not been pushed. I don't want to publish these
changes yet because I'm still reordering and revising them.
Another reason not to push is that I have converted PCB.Grid
and Settings.Grid from double to Coord (an integer unit). This
causes -severe- rounding errors for people using metric grids
with cmil base units.
Anyway, here are the commits I have made but not pushed:
1. Introduce Coord and Angle units, set a bunch of BDimension,
LocationType and int variables in global.h to one of these.
Convert pcb-printf to use these (including adding %ma spec
to print angles).
2. Convert grid units to Coord. Set mm/mil autodetect code to
look for multiples of 127nm (see bug lp-811393), though I
doubt this will work properly with cmil base units.
3. Add scale-factor lookup functions to pcb-printf and make
GetValue use this instead of its own table. Now there is
only one table of units, in pcb-printf.c, and everything
should be using it.
4. Upgrade unit structures in pcb-printf. Now units have a
"real" suffix that pcb uses internally and in file.c, and
an internationalized copy of the same suffix.
Also, there are 5 step values for GUI spinboxes to replace
the mess of arbitrary mm/mil dependent steps used by Gtk.
Finally, there is a new structure for the stuff in the
Increments tab under Gtk preferences. There is no way to
edit this. The Increments tab is still defunct (see bug
lp-699464) and I have removed --grid-increment-mm, etc,
from the command-line options.
5, 6. Minor cleanups in main.c, gpcb-menu.res, that I missed
in my old unit-macro patches.
7. Remove Settings.grid_unit_mm, support arbitrary units instead.
The "grid_units_mm" flag is now emulated, along with the new
"grid_units_mil" flag. This is so the GUI menu checkboxes still
work.
There is no visible change by this except that you can do
SetUnits("in"), say, with any unit supported in pcb-printf. No
way to save this in file-format, though (see lp-811393 again).
This is why I stuck default precision values, spinbox steps,
increments, etc, in pcb-printf. The GUIs no longer assume the
user will only use mm or mil. (They really have no clue what's
in that pcb-printf table. In principle we could allow the user
to introduce his own units to the table and it would work.)
You can also use the command-line flag --grid-units. Pass this
any supported suffix. --grid-units-mm does not work.
8. Tell file.c to use %mr, make %mr only output unsuffixed cmils.
This is because the %mc [cmil, no suffix] specifier internationalizes
its output, whereas %mr is designed to be consistent.
9. Audit undo.[ch], thermal.c, set.[ch], rubberband.c for proper
unit handling, introduce Coord type.
10. Update hid/gtk/gui-config.c to read new --grid-units command-line
option. (Didn't realize this was necessary before.)
REMAINING WORK
In principle, just audits. The ones I have done so far have been quick
and easy, essentially just replacing LocationType/BDimension with Coord,
using Angle, using NormalizeAngle() and Distance() instead of repeating
code. Nothing deep.
I may even have been done by now except that when auditing search.c, I
found the arc-intersection problems that lead to a recent long thread
on this board. When I get a free moment (probably not till tomorrow) I
will just post a bug report and move on, "fixing" the unit handling
without fixing the actual algorithm.
I expect that aside from that, everything left will be easy. I just need
to spend some time and git'er'done.
After all the source has been audited, I can commit the small changes to
const.h that actually do the conversion. Then I'll push and you guys can
jump on me for all the bugs I've caused.
--
Andrew Poelstra
Email: asp11 at sfu.ca OR apoelstra at wpsoftware.net
Web: http://www.wpsoftware.net/andrew/
_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user