* mac: Support for pan, zoom and rotate trackpad gestures
Currently SolveSpace is nearly unusable on a mac if you only have a
buttonless trackpad and not a mouse, because there's no way to pan
(ie right-click-drag) or rotate (ie middle-click-drag). You can zoom,
but only by using two-finger-drag up and down, which ends up getting
interpreted as a scrollwheel event.
This change makes the app behave much more like any other mac app, by
adding 2-finger-drag pan gesture support and pinch-gesture zooming, and
3D rotate using shift-2-finger-drag.
I've also added support for the rotate two-finger trackpad gesture,
which rotates directly around the screen Z axis (rather than in all 3
dimensions) which is actually something I've found myself wanting to do
with the mouse but afaik there's no equivalent way of achieving that.
While I was there, I fixed a bugette in convertMouseEvent which was
incorrectly translating the NSEvent coordinates, and then fixing up the
fact that the sign of the y-coordinate was wrong as a result. Using the
convertPoint API correctly means that fixup is not required because
convertPoint handles it for you.
* Don't do trackpad gestures on anything except the toplevel window
* mac: Fix non-functional scrollbar on text window
Which has not worked quite right since the last major refactor.
* Don't pass right-button drags to the toolbar
This improves the behaviour of trackpad pan/rotate on mac which uses
simulated right-button events.
* Don't pass cmd/ctrl modifier through on trackpad pan/rotate MouseEvents
By no longer always returning NSTerminateCancel in
applicationShouldTerminate.
And implement applicationWillTerminate to ensure the cleanup code in
SolveSpaceUI::Exit() is always called.
As per Xcode 12.4 you can at least do a warning-free incremental build
with these changes. There are still plenty of warnings in a full build
(mostly from thirdparty components) but with these changes you can at
least develop on mac and see if/when you've added any new warnings when
doing incremental builds.
* 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
E.g. for when you have more than one user logged in, in which case
spacenavd works only for the first of those X11 displays.
We try to do it the old way first, so there should be no regressions.
Also fixes storing non-booleans in bool variables.
Gdk::Cursor::create(Gdk::HAND1) yields a hand cursor more appropriate
for "grabbing" vs. pointing. Use the recommended create by name API
to get a "pointing hand" cursor.
...by 1/40th of the scrreen width so that the user can notice it.
This can happen if the window was on a second monitor, which is
disconnected, or if the user knows about `Alt-Space | Move` and then
moving the window with the arrow keys.
Before this, if for example the left edge was off-screen it was moved
to 1920, which is just off-screen, so the window remained invisible.
Fixes: #938
On Windows SolveSpace 2.3 uses a plain dialog for `SolveSpace::Error` and
`SolveSpace::Message` with no icon and no system beep. After the GUI
abstraction was reworked this changed to the default system message boxes
(using MessageBoxIndirectW) that play the "Default Beep" sound and show
red "X" and blue "i" icons respectively.
The beep is annoying since the error and message dialogs are used often to
show required conditions for constraints, new groups and other behaviors.
This disables the beep and uses the SolveSpace icon.
Fixes: 719
On macOS actual scroll delta is used for the zoom amount.
On Windows WHEEL_DELTA is used to allow smooth scrolling if supported.
Shift+Scroll is added for 10x finer zooming.
Went through first the diff of the referenced commit,
then all instances of "Create(Open|Save)FileDialog";
added SuggestFilename() calls where a default exists
This has been previously removed in
6b5db58971Closes#538
The return value of these functions is not an error code and according to
the Win32 API documentation they can not affect `GetLastError`.
Calling sscheck on them normally does not fail since it does
SetLastError(0) before running the checked expression and only then
GetLastError(). However in issue 817 a user discovered that when running
"DisplayFusion" software GetLastError does return an error and SolveSpace
closes.
So while not a strict bug-fix this is a "correctness improvement" for
SolveSpace and works around a possible bug in DisplayFusion.
Similarly the return value of Reg*** functions is now compared to
ERROR_SUCCESS which is zero. Before the sschecks were strictly wrong but
did not cause problems for the same reason as above.
On scroll wheel events convert the mouse coordinates from screen to client
area so that scroll wheel zooming remains centered irrespective of the
window position.
Fixes https://github.com/solvespace/solvespace/issues/806
It was added in 3a3a2755b as a potential way to export colorful meshes
to Horizon EDA but ended up being supported only by SolveSpace. Since no
software can consume the exported q3do files the feature is superfluous.
See https://github.com/solvespace/solvespace/issues/795 for details.
`GetSaveFileNameA` `OPENFILENAMEA` does not like UNC ( "\\\\?\\C:\\..." ) file prefixes in `lpstrFile`.
Work around it by not `Expand`-ing parameters passed on the command line too early.
The only user visible change is that "File|Open Recent" will show items as they
were passed instead of expanded to full path for example:
"..\..\NURBSTests\Intersection2.slvs"
Fixes: https://github.com/solvespace/solvespace/issues/622
This fixes issues #499. The --view option changes projUp and
projRight. For --view to affect the camera, the camera needs to be
initialized using these values.
This has been completely broken since 2018 (commit a93283df), and no
one noticed, so it probably wasn't useful. Instead of fixing it, just
drop the feature and a bunch of odd nonportable code.
The mimalloc temporary heap is a thread-local object that uses RAII
to manage heap lifetimes even in threads that are created implicitly,
e.g. by OpenMP. However, not all threads are necessarily created by
the application; graphics drivers may create their own threads, and
this can lead to deadlocks when combined with library unloading.
Fixes#657.
The heaps are wrapped in a RAIIish thread_local handler,
since being affined affined to a single thread for allocations is
required by the API
Ref: #642
This commit continues the work started in commits 521473ee and
e84fd464 that parallelizes certain geometric operations. This commit
cleans up the temporary arena implementations and makes them
thread-safe.
Also, in commit 521473ee, a call to FreeAllTemporary() was added
during initialization to create the heap on Windows. This is now
not necessary as the heap is created transparently on the first call
to AllocTemporary().
* Don't use a reserved identifier in include guards.
* Use fabs() from <cmath> instead of our own ffabs().
This shouldn't make any difference with modern toolchains.
* Convert a few preprocessor macros to constexprs.
After this commit, dbp() is renamed to DebugPrint() and moved to
platform.cpp, next to other similar functions. The existing short
name is provided by a preprocessor macro, similar to ssassert().
This leaves just the (rather hacky) temporary heap in util*.cpp.