Commit Graph

1069 Commits (08c787f74981670ad2c5fdbe5721cb99e7cf6a3c)

Author SHA1 Message Date
Adam Novak 3dc4d0e640 Allow all linkable files as missing files to fix #1297 2022-10-18 18:51:39 -04:00
verylowfreq f7415048a5 Web: Emscripten port updated to current tools. Add saving of options in local storage. 2022-08-21 14:13:22 +03:00
whitequark 5ca6d04e02 Add a very experimental Emscripten port.
Web: Emscripten port updated to current tools. Add saving of options in local storage.

U  Web: Emscripten port updated to current tools. Add saving of options in local storage.
2022-08-21 13:36:50 +03:00
Adam Strzelecki cf4defcd47
mac: Distinguish trackpad from Magic Mouse scroll (#1274)
This is the second attempt to distinguish trackpad scrolling that when used
should yield panning from Magic Mouse scrolling that should control zoom.

Since trackpad will begin with a touch prior to the scroll event, but Magic
Mouse not, we can use it to make sure we trigger panning only on a trackpad.

Previous "mac: Don't interpret single-touch scroll events as pan gestures"
that was flawed was reverted which ultimately lead to being unable to zoom using
Magic Mouse.
2022-08-18 00:15:14 +02:00
ruevs 1e1e655848 Show details for comments associated with points
Since 7e08b02de1 comments can be attached to
points.

Now when such a comment is selected the point (entity) it is associated to
will be shown in the text window together with it's coordinates and the
distance (offset) from the point to the comment.

Most of this was already prepared by Whitequark here
afa9e2890e
I just had to to remove the original 12 year old code by jwesthues that
showed "SELECTED: comment text" for comments.
(6750995ef0)

Fixes #1072
2022-06-14 14:07:00 -04:00
robnee b48ce240c7 Make scheduled/deferred task order deterministic
Fixes #920 #1143

Explanation from @robnee on Feb 7, 2021 in pull request #927

Solvespace uses two timers (generateAllTimer and showTWTimer) to defer tasks
until the event loop processing finishes. This helps coalesce multiple calls
into one. You can call scheduleGenerateAll multiple times while processing UI
messages but only trigger one GenerateAll. scheduleGenerateAll and
scheduleShowTW do their scheuduling by setting timers with durations of zero.
These timers fire (at least on Linux and Windows) some time after all other
events in the message queue have been processed. This works fine when
scheduling either one of these tasks. However, there is no guarantee in what
order the timers will fire (at least on Windows) regardless of which order the
scheduling calls are made. It's pretty easy to demonstrate (on some platforms)
by adding logging to the scheduling calls and timer callbacks.

In many cases TextWindow::Show depends on generateAll happening first. This
causes UI glitches where displays don't update and their contents are stale.
Since this behavior is not deterministic it's easy to imagine how this problem
could make certain bug reports difficult to reproduce and diagnose. #920 is a
good example. It also makes syncing up UI behavior across all platforms a
challenge.

Solving this in the platform domain is tricky. This is PR endeavors to make the
ordering of deferred calls to TextWindow::Show and generateAll deterministic.
It does this by replacing generateAllTimer and showTWTimer with a single
refreshTimer. Calls to scheduleGenerateAll and scheduleShowTW set flags to note
the requested operations and schedule the refreshTimer. A new callback function
SolveSpaceUI::Refresh can then check the flags and ensure that generateAll
happens first. It fixes #920. Moreover, this PR makes it easy to observe and
reproduce this problem reliably and across all platforms by simply reordering
the calls in the Refresh callback.

It's pretty clear that the ordering is important so some solution is needed, if
for no other reason than the sanity of the devs. I think this is a pretty good
solution as it spells out the ordering. If nothing else this PR is helpful in
further investigations.

@ruevs @phkahler I'd like to hear your thoughts.
2022-06-14 13:07:05 -04:00
phkahler be3489e3a0 Add some face and point types to describe screen 2022-06-11 20:47:20 -04:00
phkahler 3fe6349563 Add faces perpendicular and parallel constraints. 2022-06-11 20:46:58 -04:00
Ryan Pavlik ec1c2289e5 Eigen includes are needed in more places.
Also remove erroneous redundant extlib/eigen mentions.
2022-05-17 22:09:48 -05:00
dustinhartlyn fc16cdb370
Fix for zoom in/out error (#1221)
* minor fix open/save dialogue on windows 

On windows 10 the open/save dialogue box has an minor error, and I believe I fixed it. 

When "Open" is selected from the menu, the title of the dialogue box says "SolveSpace - Save File" and the entered file name is "united". My fix correctly titles the dialoged box, and leaves the address bar blank when a file is being opened because "united" is only needed as a default name when a file being saved. 

I found that class FileDialogImplWin32 from guiwin.cpp contains two if statements for "isSaveDialog". This is redundant. I removed the first where the title was originally set, but not working. I then set the title in the second if statement and moved the 'if isEmpty'' to this section.

* Update guiwin.cpp

replaced tabs with spaces

* Created ZoomToMouse function in graphicswin.cpp which referances the mouse position directly. Simplified MouseScroll in mouse.cpp to point to this function instead of altering zoom directly. Also pointed zoom commpand from keyboard and menu to ZoomToMouse so that it works avoids different behavior.

* clean up some comments
2022-02-28 14:22:35 -05:00
Koen Schmeets b429141c28 Revert "mac: Don't interpret single-touch scroll events as pan gestures"
This reverts commit 91db627a81.
2022-02-28 09:45:49 -05:00
phkahler c5ea9a44e1
Move shell functions out of surface.cpp and into shell.cpp (#1220) 2022-02-14 10:26:12 -06:00
ruevs 2383a39636 UI: Display the circumference of a circle in the property browser
Closes #1211
2022-02-09 11:29:07 +02:00
ruevs 026f936989 A workplane can now be defined from a workplane defined by point and normal
It is now possible to create a "New Group | Sketch in New Workplane" from
an existing workplane defined using a point and a nowmal. Before we used to
hit the `ssassert(false, "Unexpected workplane subtype");`.

This makes 4308dc136b more complete and
is related to #1120, #1048 and
https://github.com/solvespace/solvespace/pull/1054
2022-02-03 15:06:07 -05:00
phkahler 465506670c Fix normal issue, when a workplane is created from a point and normal we were only storing the numeric normal so the plane (and subsequent extrusion) wouldn't follow if the sketch was on the face of a revolve. Now we store the handle to the defining normal it predef.entityB so it can update properly on regeneration. 2022-02-03 15:06:07 -05:00
phkahler 61cc28f8b2
Check for text STL when linking (#1197)
* Check for text STL when linking

* Use memcmp in STL import when checking for ASCII format

* Add message box for unsupported STL file type.

Co-authored-by: ruevs <dpr@ruevs.com>
2022-01-27 13:20:35 -05:00
phkahler b399d9a1ec add normals to linked STLs 2022-01-20 09:53:17 -05:00
ruevs f94fc89587 UI: Add a link to the GitHub commit in the Help menu
The "Go to GitHub commit" item in the Help menu opens the URL
https://github.com/solvespace/solvespace/commits/5efc148
and allows the user to see the date of the commit that SolveSpace was
built from.

Closes #1172
2022-01-16 13:08:07 -05:00
ruevs 79a6463856 Make vectors/normals shown in the Property Browser into active links
This makes appropriate vectors/normals explorable/selectable and closes #165.

This is a clean implementation that follows the style of the UI code for
the text window. Previous unmerged attempts from the above issue are:
eb3db32059
782a5bbbe6
a77cedbfd8
41e55b3d79
2022-01-09 00:22:36 +02:00
ruevs 3eaa99cb25 Make all points shown in the Property Browser into active links
This makes all points explorable/selectable and fixes #165 partially.

This is a clean implementation that follows the style of the UI code for
the text window. Previous unmerged attempts from the above issue are:
eb3db32059
782a5bbbe6
a77cedbfd8
41e55b3d79
2022-01-09 00:22:36 +02:00
Ryan Pavlik 3d482f0d52 Fix which outer size we use.
Should be the same right now, but this is clearer.
2022-01-06 19:55:35 -05:00
ruevs 9ba7ab5544 Hide edit boxes before closing the property browser.
When the text window/property browser is closed while and edit box
is active its window remained open. This is incorrect and probably
causes a hang on Linux described in #1168. So hide the edit control
when closing.
2022-01-06 18:47:54 -05:00
ruevs 3136493a6a Load 16bit PNG images correctly by re-scaling to 8bit
Fixes #1110
2022-01-06 15:19:06 +02:00
ruevs 892477ee43 Update the year in the About dialog 2022-01-04 12:32:50 +02:00
luzpaz ae4337f066
Fix various typos (#1178)
Found via `codespell -q 3 -S ./res/locales,./extlib -L asign,ba,hsi,mata,pinter,tothe,wser`

Co-authored-by: Maximilian Federle <max.federle@gmail.com>
2022-01-04 12:28:19 +02:00
Maximilian Federle 34efb6de77
CMake Fixes + Snap port to core20 (#1174)
* CMake: use PROJECT_VERSION instead of solvespace_*_VERSION

In 006539b, solvespace_MAJOR_VERSION etc. were removed.
However, these variables were still referenced in some places.
Solution: Use PROJECT_VERSION instead.

* CMake: re-add link directories for solvespace target

006539b removed the call to link_directories for gtkmm, jsonc & fontconfig.
This leads to linking errors if those libraries are in "non-standard"
paths.
Fix this by introducing a target specific target_link_directories call.

Fixes #1173

* snap: port to core20 & adapt to CMake changes

Moving to core20 was long overdue anyway, and
the recent CMake changes necessitated some fixes.
Also switch to LZO compression for (way) better cold start
performance.
2022-01-02 20:04:57 +01:00
Koen Schmeets 8f049c5a14 Fix build by removing unused var (and accepting new apple terms and conditions) 2022-01-02 01:56:03 +01:00
phkahler 5315a69a1e Increase MAX_UNKNOWNS in the solver from 1024 to 2048 2021-12-31 15:16:52 -05:00
Ryan Pavlik 18dc8ee12c Small simplifications 2021-12-31 14:40:47 -05:00
Ryan Pavlik 8ab70c2c8d Fix formatting 2021-12-31 14:40:47 -05:00
Ryan Pavlik 6edeb66e3d Don't hold the sparse matrices in a pointer at all. 2021-12-31 14:40:47 -05:00
Ryan Pavlik 42f5d3ab0d Banish an unneeded use of our custom containers. 2021-12-31 14:40:47 -05:00
Koen Schmeets 2521dcadc4 Fix loop type 2021-12-31 14:40:47 -05:00
Ryan Pavlik 605b48e6c0 Use unique_ptr in main system jacobian. 2021-12-31 14:40:47 -05:00
EvilSpirit c0f075671b Eigen library integration into solver.
Co-authored-by: Ryan Pavlik <ryan.pavlik@collabora.com>
Co-authored-by: Koen Schmeets <hello@koenschmeets.nl>
2021-12-31 14:40:47 -05:00
Ryan Pavlik dca5ce607d Add Eigen to build. 2021-12-31 14:40:47 -05:00
EvilSpirit e528fabbe4 Add an early out in writing jacobian.
Split from previous large 'Eigen library integration' commit.
2021-12-30 13:59:58 -05:00
EvilSpirit aec46b608e Add a method to Expr.
(Split out from earlier "Eigen library integration" commit)
2021-12-30 13:59:58 -05:00
EvilSpirit 3ba40230dd Some optimization
1. We are making FoldConstants first, so we are copying less amount of data in DeepCopyWithParamsAsPointers.
2. Since we already perform DeepCopyWithParamsAsPointers, PartialWrt already produces params as pointers
2021-12-30 13:59:58 -05:00
EvilSpirit 2f31673708 Decrease WriteJacobian complexity 2021-12-30 13:59:58 -05:00
EvilSpirit 4d58f95b43 Suppress dof calculation flag 2021-12-30 13:59:58 -05:00
EvilSpirit 7f86a78472 Dof calculation when redundant is allowed. 2021-12-30 13:59:58 -05:00
EvilSpirit 708a08f04b SolveBySubstitution of linear complexity. 2021-12-30 13:59:58 -05:00
Ryan Pavlik 006539b945 Clean up/simplify build 2021-12-30 13:59:58 -05:00
Ryan Pavlik a1e18b83cb Normalize namespaces: includes all at global/root namespace.
Should improve the quality of suggestions, etc. we get from tooling.
2021-12-24 11:29:57 -05:00
Ryan Pavlik 6d40eface2 importidf: Fix uninitialized variable 2021-12-24 11:29:57 -05:00
ruevs e07b082eb8 Fix hang when trying to display characters missing from the embedded font
When SolveSpace tries to display an Unicode code point (e.g. U+EA00 )
that does not exist in the embedded vector font (unifont.hex.gz) it hangs
in an endless loop in
`const BitmapFont::Glyph &BitmapFont::GetGlyph(char32_t codepoint)`.

The reason is that the binary search through the text file unifont-8.0.01.hex
that does the "lazy loading" of glyphs does not end.

Here is a short excerpt from the file:

```
D7FE:00007FFE63866DF66DEE6DDE63DE7FFE7FFE61866FBE638E6FBE6F867FFE0000
D7FF:00007FFE63866DF66DEE6DDE63DE7FFE7FFE61866FBE638E6FBE6FBE7FFE0000
F900:0080108810881FF8100800007FFE00000FF008100FF00810042002447FFE0000
F901:00047FFE008010841FFE10841FFC10841FFC10840880050003000CC0703E0000
```

When searching for `0xEA00` after some iterations of the while loop
2450010bbf/src/resource.cpp (L567)
both `first` and `last` end up pointing to F900. After that on each
consecutive iteration of the loop `last` ends up pointing to the LF (0x0A)
just before F900
2450010bbf/src/resource.cpp (L585)
and then `mid` ends up back on F900 here
2450010bbf/src/resource.cpp (L570)
and this will repeat enlessly.

The solution is to do
```
                    first++;
```
here
2450010bbf/src/resource.cpp (L591),
which will make `first==last` and change whe while loop contition to `while(first < last) {` thiw will
allow the while loop to exit.

Tested with
- 0xEA00 - non existent, not found in 16 iterations.
- 0xF900 - exists but takes exactly 16 iterations of the binary search to finish
- 0x0000 - found in 16 iterations
- 0xFFFD - the replacement Unicode code point for non-existing glyphs. Also the end of the font.
- 0xFFFFF - a codepoint beyond the end, not found and does not cause an exception

The lazy parsing of the vector front was introduced here.
645c2d90ac

Fixes #1150
2021-12-21 09:49:08 -05:00
Tom Sutcliffe 91db627a81 mac: Don't interpret single-touch scroll events as pan gestures
To handle the Magic Mouse, whose single-finger touch gestures should be
interpreted as scrollwheel events rather than pan gestures.
2021-12-10 10:25:13 -05:00
phkahler 85f6ec4144 fix STL linking issue. Model was disappearing after the link group. 2021-11-20 19:48:17 -05:00
ruevs df3ef2ab0e GUI: Flexible vertical space above the toolbar
If the main window is not high enough allow the default 32 pixel padding
between the menu bar and the toolbar to shrink down to zero.

This allows the main window height to be a minimum of 688 pixels (on
Windows 10) so it is possible to capture 720P video tutorials.

Fixes #1130
2021-11-04 20:08:54 -04:00