Commit Graph

1177 Commits

Author SHA1 Message Date
whitequark
e2e74762f4 Rework path and file operations to be more robust.
This commit updates a *lot* of rather questionable path handling
logic to be robust. Specifically:
  * All path operations go through Platform::Path.
  * All ad-hoc path handling functions are removed, together with
    PATH_SEP. This removes code that was in platform-independent
    parts, but had platform-dependent behavior.
  * Group::linkFileRel is removed; only an absolute path is stored
    in Group::linkFile. However, only Group::linkFileRel is saved,
    with the relative path calculated on the fly, from the filename
    passed into SaveToFile. This eliminates dependence on global
    state, and makes it unnecessary to have separare code paths
    for saved and not yet saved files.
  * In a departure from previous practice, functions with
    platform-independent code but platform-dependent behavior
    are all grouped under platform/. This makes it easy to grep
    for functions with platform-dependent behavior.
  * Similarly, new (GUI-independent) code for all platforms is added
    in the same platform.cpp file, guarded with #ifs. It turns out
    that implementations for different platforms had a lot of shared
    code that tended to go out of sync.
2017-03-11 18:58:53 +00:00
whitequark
335c217114 Collect together and rigorously test all our ad-hoc path functions. 2017-03-11 16:24:12 +00:00
whitequark
60f85f5a39 Win32: fix invalid accelerator labels. 2017-03-11 16:24:12 +00:00
whitequark
7e2b1b1d8d Add a test for the link group. 2017-03-10 21:19:02 +00:00
whitequark
15f349049c Make CLI usage text more readable. 2017-03-10 21:05:52 +00:00
whitequark
27b59f601e Fix type conversion warnings. 2017-03-10 21:05:52 +00:00
whitequark
dbf66639aa Replace ad-hoc implementations of Basename with calls to it. 2017-03-08 19:25:45 +00:00
whitequark
f2f37aeed8 Remove dead code. 2017-03-08 18:08:20 +00:00
whitequark
9ab37c2ebf README: update zlib package version. 2017-03-07 11:54:15 +00:00
whitequark
61fe8badf2 GTK: take scale factor into account when positioning entry. 2017-03-04 00:09:05 +00:00
whitequark
8e27a5e34b GTK: take margin and border size into account when positioning entry. 2017-03-04 00:09:05 +00:00
EvilSpirit
91574254fe Improve handling of corner cases related to assembled loop normals.
Extrustion top and bottom faces require a normal to be present.

Before this commit, the normal is always taken from the assembled
loop; if the loop could not be assembled (i.e. the loop is broken
or not coplanar) the normal will be (0,0,0), which breaks the sketch.
Also, loops are not generated when generating the sketch
to determine its bounding box.

This may result in spuriously broken sketches when e.g. undoing
a change that has broken a loop.

After this commit, loops are generated when generating for bounding
box, and if the loop could not be assembled, then the workplane
normal is used. This still results in failures when there is
no workplane, but those cases should be quite pathological.
2017-02-17 05:01:19 +00:00
whitequark
dea573e156 Highlight normals and circle radii that have a degree of freedom. 2017-02-17 04:14:36 +00:00
EvilSpirit
3bcc376224 Same orientation constraint doesn't exist in a workplane.
Before this commit, a same orientation constraint created with
a workplane selected would only remove 2 of 3 DOFs. After
this commit, it properly removes all 3 DOFs.
2017-02-17 03:05:43 +00:00
EvilSpirit
6bc2ed9771 Remove nonexistent degrees of freedom from lathe groups.
Before this commit, lathe groups had three DOFs, which of course
could not actually move. After this commit, lathe groups have
zero DOFs, as expected.

This bug was introduced in commit 6dced80.
2017-02-17 03:01:45 +00:00
EvilSpirit
3c36d8f887 Pin comments with custom styles to front layer, like regular ones.
This is the 2.x behavior that was accidentally broken in the canvas
rewrite.
2017-02-17 02:53:20 +00:00
EvilSpirit
312184505c Fix undefined behavior in solvespace-cli. 2017-02-17 02:52:19 +00:00
whitequark
41794dbadb Fix a crash in expression parser.
Found by lineprinter0@gmail.com through fuzzing.
2017-02-17 02:50:00 +00:00
whitequark
e6ed36f739 Add solvespace-debugtool, to expose some internals via CLI. 2017-02-12 14:21:58 +00:00
whitequark
f29d9d7a34 GTK: run DoLater after the next main loop iteration.
Before this commit, DoLater would be run as an idle callback,
which (depending on system performance) could either result in
a half-regenerated sketch being displayed, with only the dragged
entity updated, or no regeneration whatsoever during the drag.

After this commit, the GTK behavior matches macOS and Win32 ones.
2017-02-08 14:27:02 +00:00
whitequark
1871efa02b Commit missing parts of d77f617. 2017-02-06 16:01:10 +00:00
whitequark
2e15f60ef6 Win32: implement support for full-screen graphics window. 2017-02-06 15:12:26 +00:00
whitequark
d77f617dc4 Remove the "show menu bar" option.
Hiding the menu bar was only supported on macOS, and it is inherently
troublesome to port because keyboard accelerators on Win32 and GTK
are inherently dependent on the menu bar being visible.

On top of that, it's not clear how to bring it back if it's hidden
by accident.
2017-02-06 15:11:58 +00:00
whitequark
6cf5409cd7 Update testsuite after ced4244. 2017-02-06 14:50:21 +00:00
whitequark
cd26256675 Travis: run tests again.
Tests used to be included in `make all`, but not since 8d0e226.
2017-02-06 14:49:13 +00:00
EvilSpirit
97e71856b3 Snap point to entity when constraining to a hovered entity.
Before this commit, when a point is constrained to an entity (point,
circle, arc of circle or line segment) by clicking on it,
the resulting constraint is not necessarily satisfied, and the next
regeneration may place the newly constrained point somewhere other
than the intended position. After this commit, the parameters
are modified to satisfy the constraint.
2017-02-06 14:20:19 +00:00
EvilSpirit
ced42440e7 Explicitly represent the parameter used in constraints.
Commit f5485cb and its ancestors add a parameter to some constraints.
This parameter must be materialized and assigned a non-zero value via
ModifyToSatisfy for the solver library to not make unnecessary
changes to the sketch during the initial generation. For this, we
represent it explicitly instead of using hc.param(0), such that
the materialized constraint does not conflict with any user-defined
ones.
2017-02-06 13:02:49 +00:00
whitequark
80c7296316 Win32: do not redefine VOS_NT_WINDOWS32/VFT_APP. 2017-02-06 11:23:06 +00:00
whitequark
4260be2445 DXF: mark POLYLINE as 3d if any of the points have non-zero Z.
This commit follows 41365c5, which enabled export of Z coordinate
by using POLYLINE instead of LWPOLYLINE. After this commit, only
the AcDb2dPolyline/AcDb2dVertex are used when exporting flat views,
which may improve compatibility with 2d design packages.
2017-02-05 09:39:22 +00:00
EvilSpirit
baf9dc0aae Remove degenerate triangles when generating triangle mesh. 2017-02-05 09:25:07 +00:00
whitequark
4465bc0270 CMake: do not remove translations on make clean. 2017-02-02 18:09:50 +00:00
whitequark
51b88280e5 README: suggest release builds, as these are much faster.
Also, remove -DENABLE_TESTS=OFF, since tests are no longer run
when building the default target.
2017-02-02 17:45:55 +00:00
whitequark
279424290b Remove a redundant ReloadAllImported() call. 2017-01-31 02:20:10 +00:00
whitequark
6e88eaef69 Fix a path construction issue introduced in 3fc85b7. 2017-01-31 02:15:37 +00:00
EvilSpirit
d4b052d34d Fix logic introduced in 55ae10b.
Before this commit, the effect of the AddPending() call was
immediately reversed by ClearSuper.
2017-01-24 20:30:48 +00:00
whitequark
3fc85b7934 CLI: add the "regenerate" command, for use in Makefiles etc. 2017-01-24 19:55:53 +00:00
whitequark
27a5f6f9bd CLI: include directory name in %-replacement. 2017-01-24 19:54:47 +00:00
whitequark
67a916d19c CLI: show usage when --help/-h passed. 2017-01-24 19:40:30 +00:00
whitequark
ff0af6fdba Fix a typo in 495a7ac. 2017-01-23 11:15:37 +00:00
whitequark
495a7ac166 Refactor the "File → Export Image" command.
The existing code is horrible and needlessly platform-dependent.
Even worse, it causes a freeze on GTK. Instead of propping that up
with a few more crutches, just fix the root cause.
2017-01-23 00:24:18 +00:00
whitequark
bb2cc4aa56 GTK: do not compose rendered geometry with an alpha buffer.
The somewhat confusingly named set_has_alpha() function does not
affect whether alpha can be used during rendering to the area.
Rather, it affects whether alpha will be used when composing
the contents of the area with the window underneath it.
2017-01-21 06:34:44 +00:00
EvilSpirit
669e6f0dcb Select the appropriate entity when dragging a circle or a normal.
This commit adds logic that was missed in 25631d4.
2017-01-20 11:54:56 +00:00
EvilSpirit
119b17ac75 Fix an occasional crash when starting to drag an entity. 2017-01-20 11:48:47 +00:00
EvilSpirit
86f229c5e6 Render points corresponding to a DOF in the front layer.
Before this commit, if any rendering mode except "show all occluded"
is enabled, points can be highlighted for corresponding to a DOF
after "Analyze → Degrees of Freedom" but then promptly occluded,
which is confusing.
2017-01-20 11:46:31 +00:00
EvilSpirit
db75e06ecc Add a command to show center of mass, assuming uniform density. 2017-01-19 08:54:11 +00:00
whitequark
068191bf28 GTK: unbreak the color chooser.
We want to suppress accelerators but still get input to (at least)
the window where the editor is opened. It's no harm to permit input
to other windows, but it is bad to route all of it to the editor,
since color chooser depends on being able to receive input.

So, what we do is add modal grab to the *overlay*, which has
the editor and the underlay widget, route all events as usual
to children, and just force the key events to go to the editor,
since otherwise they would still propagate up for some reason.
2017-01-17 13:11:09 +00:00
whitequark
8749a175a6 Draw constraints/entities when hovered or selected even if invisible.
This goes really well with the related constraint/request lists,
and in general seems very natural.
2017-01-17 11:53:51 +00:00
whitequark
e388d9fd16 List applied constraints when selecting an entity. 2017-01-17 11:43:45 +00:00
whitequark
5d9356a90a List constrained requests when selecting a constraint. 2017-01-17 11:32:50 +00:00
whitequark
4aae22929a Add *.slvs to gitignore.
I've committed some random sketches one time too many...
2017-01-17 11:29:18 +00:00