Commit Graph

774 Commits (88d828546c413f2dcdc1f3cdd6dceaf3999ec27d)

Author SHA1 Message Date
whitequark f43954cc29 Adjust GL1 and GL3 ReadFrame to take pixel ratio into account.
Currently, on HiDPI screens the Export Image command would return
a cropped screenshot.
2019-05-20 19:09:40 +00:00
whitequark 11c5cdc7b0 Adjust GL3 ReadFrame() for GL ES 2.1 compatibility.
Currently on Win32 this errors out and renders a black rectangle.
2019-05-20 19:09:40 +00:00
Ryan Pavlik 62aba398f7 Move two members of Vector to be inline.
Performance change: moved since they show up disproportionately
in profiling.
2019-05-15 19:53:38 +00:00
Ryan A. Pavlik 52a481cd1e Small performance optimization in Vector::Equals.
This function showed up surprisingly high on a CPU time profile
when the GUI was unresponsive "doing things". Removed a duplicated
difference in the not-equal case, and switched to abs and a single compare
instead of two compares with a negation. It seems to have moved the
function further down in the profile.
2019-05-13 15:21:18 +00:00
whitequark 838126f81f GTK: rework f07e975d to fix build on both pre and post 3.24 GTK. 2019-05-13 15:21:11 +00:00
Bauke Conijn 7d181f0d0f Include custom styled entities in the same plane when exporting section. 2019-05-13 14:34:22 +00:00
whitequark c44a471649 Win32: fix destruction order issue leading to crash on close. 2019-05-13 09:13:55 +00:00
Zhuowei Zhang f07e975db1 GTK: fix build on Ubuntu 18.04 by removing debug define
Ubuntu 18.04 uses GTKMM 3.22.2-2, which doesn't support native file chooser.

Commit bc3e09edbf checks if native file chooser
is available, but the result is overridden with a hardcoded define,
probably for debugging.

Removing the debugging code fixes build on Ubuntu 18.04.
2019-05-13 07:03:22 +00:00
whitequark bc3e09edbf GTK: use native file chooser dialog, if available.
This requires GTK 3.24+ and (at least for GTK 3.24) the environment
variable GTK_USE_PORTAL to be set to 1.
2019-05-08 22:59:20 +00:00
whitequark fa66229030 Fix choice of normal for revolution in some corner cases.
Before this commit, if the sketch contain no entities with starting
points off of the axis of revolution, the revolution may fail, which
manifests as the face normals being inverted. The code at the top of
MakeFromRevolutionOf() takes the furthest point from the axis,
projects it on that axis to get a vector. In this case that vector
is essentially zero length except for rounding errors.

After this commit, instead of only considering start points of
beziers, all control points are considered.

Fix by @phkahler.
2019-04-22 11:50:47 +00:00
whitequark b69ef71e63 Fix misuse of Path in dc6c7bd0. 2019-04-21 06:54:46 +00:00
probonopd dc6c7bd0ce Add a lookup for resources in ../share/solvespace.
This is useful for relocatable bundles, e.g. AppImage or NixOS.
2019-04-21 06:16:35 +00:00
whitequark ce0b130d6c Disable mnemonics when pathnames are used as menu item labels.
Based on a patch by Matthew White.
2019-04-13 11:02:43 +00:00
whitequark a7b2f28999 Silence some gcc 7 warnings.
* Mark switch fallthrough
    (-Wfallthrough);
  * Initialize variables to avoid false positives
    (-Wmaybe-uninitialized);
  * Fudge indentation to avoid false positives
    (-Wmisleading-indentation).
2019-03-28 09:46:16 +00:00
Sergiusz Bazanski 3a3a2755bf Implement Q3DO export.
We plan to use flatbuffers in the future for the next generation of
the .slvs file format, so flatbuffers are built unconditionally; and
the Q3DO exporter itself is tiny.
2019-03-28 08:53:37 +00:00
Bauke Conijn 9d1601eea9 Fix uninitialized memory access in toolbar. 2019-02-19 11:35:56 +00:00
Bauke Conijn 8d07a6b4f4 Import missing styles from linked files. 2019-02-19 10:42:14 +00:00
Sergiusz Bazanski 9e512882d1 Add checkbox to control automatic line constraints
Signed-off-by: Sergiusz Bazanski <q3k@q3k.org>
2019-02-11 13:17:38 +00:00
whitequark 94b26ddfac Add a built-in Bitstream Vera Sans Roman font.
Before this commit, the default font chosen for TTF text is Arial
(chosen by the basename of arial.ttf), which isn't present on most
Linux systems, and cannot be redistributed. After this commit, it is
replaced with Bitstream Vera Sans, which can be. Existing files
are not affected.

The font name in the TTF file was artificially modified to add
the (built-in) suffix, which will need to be done if more built-in
fonts are added.
2019-02-11 11:03:47 +00:00
Bauke Conijn e69478e61a Let tangent arc modify the original entities.
Modifying the original entities instead of deleting them, retains the
original associated constraints. This makes creating rounded rectangles
a lot easier.
2019-02-11 10:45:11 +00:00
whitequark e383b7fba8 Remove superfluous glPolygonOffset() call in GL3 renderer.
This caused red fringes on mesh boundary with back faces turned on.
2019-02-04 20:41:50 +00:00
whitequark 28fa348859 Use correct polygon winding order in GL3 renderer. 2019-02-04 20:25:45 +00:00
whitequark 8e4c4b0d46 Check return values of fread, etc in ReadFile/WriteFile. 2019-01-10 07:12:12 +00:00
whitequark 52c41782d8 cli: fix typo. 2018-11-08 04:10:14 +00:00
luz.paz 258545a334 Misc. typos
Found via `codespell -q 3 --skip="./res/locales,./extlib"`
2018-09-19 18:52:11 +00:00
whitequark 4d1e1341d9 GTK: fix an use-after-free in message dialog ShowModal(). 2018-08-03 13:39:00 +00:00
whitequark 42bc7efa44 Fix Z-index of UI elements drawn by the color picker.
Also fix asymmetric crosshairs, while we're at it.
2018-07-31 21:26:47 +00:00
whitequark 21d1a625e3 Fix a few warnings emitted by Clang. 2018-07-31 21:03:52 +00:00
whitequark 80c111bf75 Finish OpenGL 2 to OpenGL 3 renaming started in ecb6550b. 2018-07-31 21:01:28 +00:00
whitequark 4d1bd55cc2 GTK: fix dismissing the editor with Escape.
Before this commit, the editor was simply hidden, and as a result
pressing Escape in the color chooser would leave the latter open.
2018-07-31 20:49:56 +00:00
whitequark eda294efb5 Adjust the horizontal constraint label margin to equal vertical.
Right now, horizontally placed labels appear more cramped than
those that are placed vertically.
2018-07-31 17:21:15 +00:00
Alexander Meißner bc6a923c4c macOS: fix crash on startup.
Added missing @synthesize acceptsFirstResponder;
Replaced generic ApplicationDelegate in MainMenu.xib
2018-07-31 15:55:11 +00:00
whitequark c3875cba9e Add missing override qualifier. 2018-07-31 15:54:31 +00:00
whitequark a4644cc58d GTK: fix message dialogs not being responsive to buttons. 2018-07-22 09:00:13 +00:00
whitequark 8426992f27 Eliminate blocking in Error() and Message() calls.
This serves two purposes.

First, we want to (some day) convert these messages into a less
obtrustive form, something like toaster notifications, such that they
don't interrupt workflow as harshly. That would, of course, be
nonblocking.

Second, some platforms, like Emscripten, do not support nested event
loops, and it's not possible to display a modal dialog on them
synchronously.

When making this commit, I've reviewed all Error() and Message()
calls to ensure that only some of the following is true for all
of them:
  * The call is followed a break or return statement that exits
    an UI entry point (e.g. an MenuX function);
  * The call is followed by cleanup (in fact, in this case the new
    behavior is better, since even with a synchronous modal dialog
    we have to be reentrant);
  * The message is an informational message only and nothing
    unexpected will happen if the operation proceeds in background.

In general, all Error() calls already satisfied the above conditions,
although in some cases I changed control flow aroudn them to more
clearly show that. The Message() calls that didn't satisfy these
conditions were reworked into an asynchronous form.

There are three explicit RunModal() calls left that need to be
reworked into an async form.
2018-07-20 04:40:19 +00:00
whitequark 396cac556d Add missing virtual destructors. 2018-07-19 22:42:24 +00:00
whitequark c37cddfc7f I18n: internationalise some messages that were missing gettext calls. 2018-07-19 21:51:27 +00:00
whitequark fb138f496a Add final qualifiers where applicable.
We have a lot of classes with virtual functions but no virtual
destructor, mostly under render/. While this is not a problem
due to how our hierarchy is structured, some versions of clang
warn about this on the delete statement inside shared_ptr.

We could add a virtual destructor, but adding final qualifiers
expresses intent better, is generally more efficient (since it allows
devirtualizing most virtual calls in render/), and solves
the potential problem clang is warning us about.
2018-07-19 00:11:04 +00:00
whitequark 4f52167a78 Use std::shared_ptr instead of std::unique_ptr for Platform::TimerRef.
We currently support MSVC 2013, and MSVC 2013 has weird bugs around
std::unique_ptr; the one we hit is Connect ID 858243. You can't
actually open the bug report anymore because Microsoft has shut down
Microsoft Connect. We probably shouldn't support a compiler so old
its bugtracker doesn't exist anymore, but there isn't any very good
reason to use unique_ptr for TimerRef either, so let's change that
for the time being.
2018-07-18 23:49:51 +00:00
whitequark a738e3f82e Eliminate imperative redraws.
This commit removes Platform::Window::Redraw function, and rewrites
its uses to run on timer events. Most UI toolkits have obscure issues
with recursive event handling loops, and Emscripten is purely event-
driven and cannot handle imperative redraws at all.

As a part of this change, the Platform::Timer::WindUp function
is split into three to make the interpretation of its argument
less magical. The new functions are RunAfter (a regular timeout,
setTimeout in browser terms), RunAfterNextFrame (an animation
request, requestAnimationFrame in browser terms), and
RunAfterProcessingEvents (a request to run something after all
events for the current frame are processed, used for coalescing
expensive operations in face of input event queues).

This commit changes two uses of Redraw(): the AnimateOnto() and
ScreenStepDimGo() functions. The latter was actually broken in that
on small sketches, it would run very quickly and not animate
the dimension change at all; this has been fixed.

While we're at it, get rid of unused Platform::Window::NativePtr
function as well.
2018-07-18 23:18:02 +00:00
whitequark 738ac02cbf Fix some strict GL ES 2 conformance issues.
This commit fixes two issues that cause issues in WebGL:
  * Non-power-of-two textures must wrap as GL_CLAMP_TO_EDGE.
    This breaks non-power-of-two textures.
  * Render calls with zero primitives should not be issued.
    This just causes warning spam.
2018-07-18 19:40:14 +00:00
whitequark 02ec64ee66 Fix unaligned access in LoadStringFromGzip.
The code in LoadStringFromGzip was attempting to perform an unaligned
access using memcpy, but it cast the source to a pointer with
alignment requirements larger than 1, which, under optimizations,
reintroduced the original issue.
2018-07-18 15:36:59 +00:00
whitequark efc3da4579 CMake: add an ENABLE_CLI flag. 2018-07-18 11:49:06 +00:00
whitequark 22a9705a21 Win32: fix crash on application exit. 2018-07-18 03:07:48 +00:00
whitequark 5853fa0421 Finish refactoring of platform code.
This commit finally unifies all main() functions and moves the few
remaining application-wide functions where they belong.
2018-07-18 03:04:16 +00:00
whitequark 350d2ad211 CLI: fix crash running the "thumbnail" command. 2018-07-18 02:31:37 +00:00
whitequark 0fb9a4cc23 GUI: fix formatting of messages with only one sentence. 2018-07-18 02:31:35 +00:00
whitequark 7630e0e4e2 Make some dubious type conversions explicit.
This is to address MSVC warnings.

This commit changes a few configuration fields to use double instead
of float. There doesn't seem to be any reason these use float except
for the legacy Windows code using float for saved configuration.
Changing their type to double improves consistency.
2018-07-18 01:14:59 +00:00
whitequark c1f1c7c409 Add a platform abstraction for 6-DOF input devices.
This commit mostly just moves code around.
2018-07-18 01:05:19 +00:00
whitequark 6b5db58971 Add a platform abstraction for file dialogs.
This commit merges all ad-hoc file dialog code, such as the feature
where dialogs remember last location and format, and exposes it
through a common interface.

This commit also significantly improves Gtk dialog handling code.
2018-07-17 22:33:45 +00:00
whitequark d7968978ad Add a platform abstraction for message dialogs.
This commit changes the awfully specific code for dialogs with
messages duplicated three times to go through a generic interface.
It also fixes some issues with the way translated messages
were parameterized.

This commit removes the custom message dialog box used on Windows,
for several reasons. First, it was the last element not respecting
HiDPI displays. Second, other OSes do not easily provide this much
control over rendering default message boxes, and both Gnome and
macOS frown upon non-standard renderings such as those; so the custom
rendering was already not used on the other OSes.
2018-07-17 22:33:45 +00:00
whitequark 84bf37abed GTK: save boolean settings as JSON booleans. 2018-07-17 16:05:46 +00:00
whitequark 26f3751ce8 macOS: rename application bundle to SolveSpace.
This changes the capitalization shown in GUI.
2018-07-17 15:01:58 +00:00
whitequark a93283df9d macOS: put assertion message into crash reporter dialog.
This commit makes FatalError a GUI-dependent function.
2018-07-17 15:01:58 +00:00
whitequark eb5501ecd6 Implement a platform abstraction for settings.
This commit mostly just changes the settings code to be in line with
the rest of the platform abstractions, although it also fixes some
settings names to be consistent with others, and uses native bool
types where applicable.

This commit also makes settings-related operations much less
wasteful, not that it should matter.
2018-07-17 15:01:58 +00:00
whitequark f324477dd0 Implement a platform abstraction for windows.
This commit removes a large amount of code partially duplicated
between the text and the graphics windows, and opens the path to
having more than one model window on screen at any given time,
as well as simplifies platform work.

This commit also adds complete support for High-DPI device pixel
ratio. It adds support for font scale factor (a fractional factor
on top of integral device pixel ratio) on the platform side, but not
on the application side.

This commit also adds error checking to all Windows API calls
(within the abstracted code) and fixes a significant number of
misuses and non-future-proof uses of Windows API.

This commit also makes uses of Windows API idiomatic, e.g. using
the built-in vertical scroll bar, native tooltips, control
subclassing instead of hooks in the global dispatch loop, and so on.

It reinstates tooltip support and removes menu-related hacks.
2018-07-17 13:31:17 +00:00
whitequark 55baaf310f Implement a platform abstraction for menus.
This commit removes a large amount of redundant code that needed
to be kept in sync between platforms and also makes it much easier
to add new menu-related functionality since little to no platform
code needs to be altered anymore.

This commit also greatly improves code locality in context menu
handling by allowing context menu click handlers to be closures.

This commit temporarily introduces a SetMainMenu API, which is rather
hacky but only necessary until an abstraction for windows is added.
2018-07-16 11:21:30 +00:00
whitequark 7ab87caa88 Implement a platform abstraction for timers.
This commit temporarily disables tooltip functionality; it will
be handled natively in a platform abstraction for windows using
much simpler code.
2018-07-16 11:21:30 +00:00
whitequark 28f94dcd0a Start using C++ in-place member initialization.
We should make good use of in-place member initialization. Many
new classes have constructors that effectively do nothing but
default-initialize POD members, and when adding new members,
it is very easy to miss initializing them. With in-place
initialization, the code is more compact, the diffs are nicer,
and it's harder to miss them.

This commit only converts render/ and platform/ to use in-place
member initialization, since there was a bug in CairoRenderer,
but we should convert the entire codebase.
2018-07-16 11:21:30 +00:00
whitequark 975b49f520 Win32: offer to restart application on fatal errors.
This changes the assertion failure behavior to be the same in debug
and release builds: to show the complete failure message, and
to offer to restart the application or defer to Windows Error
Reporting to generate a backtrace. Contrary to popular belief,
WER is not useless, and since SolveSpace publishes pdb files,
WER-generated reports can be symbolized.

This commit also addresses the long-standing problem where showing
a dialog on fatal error would re-enter the application code, thus
causing another error or a crash that is more fatal than the current
one.
2018-07-14 16:05:08 +00:00
Bauke Conijn 8192c965ea Show degrees of freedom in property browser. 2018-07-13 04:29:36 +00:00
whitequark 595ae86b29 I18n: update translations. 2018-07-12 23:06:07 +00:00
whitequark f54dabbb5f Clean up includes and include guards.
According to the C standard all preprocessor definitions starting
with an underscore are reserved for standard and implementation use,
so don't use those. Also, sort and unique include directives.
2018-07-12 18:48:51 +00:00
Guido d471e65e7d Implement splitting at point with "Split Curves at Intersection". 2018-07-12 18:39:19 +00:00
whitequark f2ecd7abe6 macOS: use correct format for connexionName field.
3DConnexion configuration tool appears to use Pascal strings there.
2018-07-12 12:17:22 +00:00
EvilSpirit a16c204304 Allow using m (in addition to mm and inch) as base unit. 2018-07-12 12:01:46 +00:00
EvilSpirit 6ad5c684d8 Avoid degenerate triangles when snapping to mesh.
This can cause memory exhaustion when exporting to mesh with small
(but not excessively small) chord tolerance.
2018-07-12 11:50:24 +00:00
EvilSpirit 025bb960c0 Improve performance of mesh-forced assemblies. 2018-07-12 11:47:58 +00:00
whitequark c8fc033047 macOS: fix #include to work on case-sensitive filesystem. 2018-07-12 11:45:15 +00:00
whitequark 9c99f69da5 Clean up unused shader variables. 2018-07-12 11:43:25 +00:00
whitequark 20a4a2b23f Avoid using `tan` as identifier in shaders.
This conflicts with the tan() function, currently only on macOS.
2018-07-12 11:40:51 +00:00
whitequark f37881a2e3 macOS: bundle and statically link external dependencies.
This fixes numerous linking issues where updated system libraries
on macOS cause errors on startup in newer OS versions.
2018-07-12 11:15:31 +00:00
Mat M 03e479eb25 Ensure va_end() is always called in TextWindow::Printf(). 2018-07-12 05:06:35 +00:00
luzpaz 771b415a12 Fix various comment and UI string typos. 2018-07-12 05:05:43 +00:00
whitequark 49ff36fd51 Use a more rigorous check for library containing backtrace(). 2018-07-11 02:36:17 +00:00
whitequark 8cedefc278 Allow using non-ASCII format strings in Printf. 2018-07-10 23:44:02 +00:00
whitequark 2b9ffd1542 Fix handling of relative paths with no directory in solvespace-cli.
Before this commit, e.g. `solvespace-cli regenerate foo.slvs`
would save a file called just `.slvs`.
2018-05-10 15:31:55 +00:00
whitequark 3d7e9f5e7b Provide correct arguments to inflateInit2.
windowBits of 16 means "decode gzip header" and "use window size
from zlib header". For some reason, this results in a window size
that is too small on OpenBSD. Instead, use maximum window size
explicitly, since there is no downside for doing so.
2017-12-17 18:44:38 +00:00
Evil-Spirit a10db16a9c Fix dash-dash-dot line style. 2017-08-08 12:23:48 +00:00
whitequark 49c64f7f15 CMake, macOS: create bundle directory explicitly.
Before this commit, this worked fine with the Unix Makefiles
generator, but not with the Xcode generator.
2017-07-23 03:52:40 +00:00
whitequark 33b6e51737 Locale LCID is a hex number, not a decimal. 2017-05-07 21:45:53 +00:00
whitequark 280d5b902f TTF: avoid crashes on fonts without U+0041 LATIN CAPITAL LETTER A.
Since font sizes in SolveSpace are specified in terms of cap height,
we need U+0041 to determine cap height. Some fonts lack it; in
that case, we assume that cap height is the same as the size we've
requested. This avoids a crash, at the cost of completely wrong
(although consistent) metrics; I do not really know of a better way.
2017-04-26 23:07:54 +00:00
whitequark 5408f73b96 Fix a crash creating a group from a non-reference workplane. 2017-04-21 23:08:08 +00:00
whitequark 85b4b25278 Fix a crash changing g->meshCombine when g->type!=EXTRUDE. 2017-04-16 02:12:31 +00:00
whitequark 1480f890bd Add a check omitted in e5259d7a. 2017-04-16 00:35:44 +00:00
whitequark e5259d7a3e Swap arc endpoints when pasting transformed with negative scale. 2017-04-12 04:51:23 +00:00
whitequark 5d67b42842 CMake: don't have multiple rules generating same targets.
There was a copy rule that copied the locale from the source
to the binary directory, and also a regeneration rule that used
the locale in the binary directory as a temporary file.
Rename the target for the latter.
2017-04-08 18:37:02 +00:00
whitequark 287bd98a3f Fix copying and pasting image requests. 2017-04-08 17:17:38 +00:00
EvilSpirit 99f6ea34f1 Add an option to display areas of closed contours.
This is useful e.g. for architectural work.
2017-04-08 16:43:06 +00:00
whitequark c0b6eaa935 Fix automatic marking of constraints as reference.
To reproduce:
  * New sketch;
  * Create two redundant constraints, with second being automatically
    marked as reference;
  * Switch one of these to non-reference;
  * Allow redundant constraints;
  * All new constraints with labels created as reference, even
    if that specific degree of freedom is not constrained yet.
2017-04-08 14:42:35 +00:00
whitequark 43dc16262a Rewrite equation for pt-on-circle to avoid negative diameter. 2017-04-08 14:38:07 +00:00
EvilSpirit 8fd11f4886 Fix forcing NURBS to mesh in a step group when the flag is inherited.
Before this commit, if the source group of a step rotate/translate
group is forced to triangle mesh, the UI would show that the step
rotate/translate group is also forced to triangle mesh, but the group
would in fact contain NURBS surfaces.
2017-04-06 07:40:47 +00:00
whitequark ecb6550b5c Change mentions of OpenGL 2 to OpenGL 3.
We ended up in a confusing state where OpenGL 2 (like in "gl2")
actually refers to OpenGL ES 2, which roughly corresponds to
OpenGL 3. Rectify that.
2017-04-06 07:20:50 +00:00
whitequark 7eb6574f90 Rename TextWindow::CHAR_WIDTH to CHAR_WIDTH_.
glibc defines a CHAR_WIDTH macro in limits.h since about 6.3.*.
This is apparently added as a part of ISO TS 18661-1:2014, which
I cannot read because it is not publicly available, and which covers
some sort of floating-point extensions. This is one of those changes
that should never have been done yet here we are.
2017-04-06 06:54:07 +00:00
whitequark b0ea9d8eb4 Allow suppressing solid model of extrude and lathe groups. 2017-04-05 18:49:18 +00:00
whitequark 6337bbbcd6 Fix a missing semicolon. 2017-03-22 19:13:00 +00:00
EvilSpirit aaa9c6df7a Fix a texture memory leak. 2017-03-22 19:12:25 +00:00
whitequark 827f54f2c4 GTK: ensure the editor always uses contrasting colors.
On some configurations, it seems that the default GTK theme
has a transparent background, which makes black text on black
(GL) background illegible.
2017-03-19 18:43:27 +00:00
whitequark acc25ecd57 Fix toolbar height after 5744d1d5. 2017-03-13 01:14:59 +00:00
whitequark ca2aad7fea Remove the "style → background image" feature. 2017-03-13 01:12:58 +00:00
EvilSpirit 5744d1d599 Implement an image request. 2017-03-12 00:13:56 +00:00
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 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 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
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 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 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
EvilSpirit 3e668079b5 Fix a crash after creating a constraint.
To reproduce, e.g.:
  * draw a rect;
  * translate the rect;
  * add a pt-on-line constraint between two instances.
2017-01-17 11:26:04 +00:00
whitequark 572fbc7463 Reapply "Simplify Group::IsVisible(), GroupsInOrder()."
This reverts commit 1d1bdddef21baf1e312fcc65bb67e76c87b2b0fc,
with a bugfix for pruning orphans when deleting a group in the middle
of the sketch.
2017-01-17 11:26:04 +00:00
whitequark 67146f6ab2 Revert "Simplify Group::IsVisible(), GroupsInOrder()."
This reverts commit 022d012a44.

The commit above has caused crashes during pruning.
2017-01-17 11:26:04 +00:00
whitequark 8370382a33 Fix reference to a shader that no longer exists. 2017-01-17 11:26:04 +00:00
whitequark 5b2ad9b5f1 Fix 2d stippling of hovered and selected faces.
This was broken in ec07516.
2017-01-17 11:26:04 +00:00
whitequark 6931979b8e Fix an OpenGL initialization glitch.
Before this commit, the first time NewFrame() is called,
the background color would not be filled, leading to interference
with whatever the GUI toolkit decided to put there.
2017-01-14 06:06:55 +00:00