Commit Graph

1711 Commits (e75f6b36479cf88163bd58931f28385625b7846c)

Author SHA1 Message Date
ruevs fcb2757d5d Win32: Drastically reduce stack usage at startup. NFC?
See:
https://github.com/solvespace/solvespace/issues/92#issuecomment-567831112

The problem was first introduced here:
dabd57847e

and later "fixed" here:
f324477dd0
by setting the stack size to /STACK:33554432

Solvespace now starts up even with /STACK:554432

According to this:
https://en.cppreference.com/w/cpp/language/value_initialization
```
"2) if T is a class type with a default constructor that is neither user-provided nor deleted (that is, it may be a class with an implicitly-defined or defaulted default constructor), the object is zero-initialized and then it is default-initialized if it has a non-trivial default constructor; "
```
So removing the `{}` should leave both the `System` and `TextWindow` class instances properly initialized.
2020-02-24 08:41:45 +00:00
ruevs 8ef3cacc33 Fix a bug with 3Dconnexion: SpaceMouse
A warning found with /W4 by MSVC 2019 (Microsoft (R) C/C++ Optimizing Compiler Version 19.24.28314)
is an actual bug. How does the SpaceMouse (I do not have one) work at all when the global `hSpaceWareDriverClass` is NULL?!

.\src\platform\guiwin.cpp(1392,34): warning C4459: declaration of 'hSpaceWareDriverClass' hides global declaration
.\src\platform\guiwin.cpp(1389,13): message : see declaration of 'SolveSpace::Platform::hSpaceWareDriverClass'
2020-02-20 14:03:31 +00:00
ruevs f6a774d7bf Fix some trivial warnings found by MSVC. NFC.
Found with /W4 by MSVC 2019 (Microsoft (R) C/C++ Optimizing Compiler Version 19.24.28314)

A bunch of implicit casts 'double' to 'float' and one 'int64_t' to 'unsigned'.

.\src\platform\guiwin.cpp(1237): warning C4701: potentially uninitialized local variable 'cursorName' used
.\src\platform\guiwin.cpp(1237): warning C4703: potentially uninitialized local pointer variable 'cursorName' used

.\src\solvespace.cpp(805,30): warning C4456: declaration of 'gs' hides previous local declaration
.\src\solvespace.cpp(715,17): message : see declaration of 'gs'

.\src\solvespace.cpp(849,47): warning C4456: declaration of 'e' hides previous local declaration
.\src\solvespace.cpp(847,29): message : see declaration of 'e'

.\src\render\render.h(288,51): warning C4458: declaration of 'camera' hides class member
.\src\render\render.h(271,17): message : see declaration of 'SolveSpace::SurfaceRenderer::camera'

.\src\render\render.h(289,57): warning C4458: declaration of 'lighting' hides class member
.\src\render\render.h(272,17): message : see declaration of 'SolveSpace::SurfaceRenderer::lighting'
2020-02-20 14:03:31 +00:00
Maximilian Federle bae84b27e4 snap: Fix missing extension for cli
solvespace-cli needs the gnome-3-28 extension to find its libraries.
2020-02-14 10:01:51 +00:00
Maximilian Federle 1cd727d9dc snap: Remove superfluous files from package
Remove all files from snap that are already included in the base snap
or in any connected content snaps.

The main advantage is the massively reduced snap size:
From ~70 MB down to ~6 MB.
2020-02-14 10:01:51 +00:00
Maximilian Federle dcc80de730 snap: Add missing sudo in Travis deploy step
Running the build step with sudo necessitates running the deploy step with sudo too.
Otherwise, we face permission problems.
2020-02-08 16:50:55 +00:00
Maximilian Federle 65ab59503a snap: Build snaps on Travis without remote-build & drop i386 + armhf
Snapcraft's remote-build does not fit the requirements of CI,
so replace it with builds running directly on Travis:

1. Builds on Travis can run independently, whereas remote-build
competes for the same resource (Launchpad) and will potentially
block if multiple commits require building in succession.
2. Snapcrafts CLI for remote-build is not designed to be easily
scriptable.
3. Travis recently introduced building on arm64, so builds for
arm64 are now very fast and don't require emulation.

We do not build for armhf and i386 any more because they are
of little relevance on the desktop.
2020-02-08 16:15:09 +00:00
Koen Schmeets 3ed1719de2
Fix immediate editing of reference constraints.
Before this commit, if immediate editing of constraints was enabled,
then when adding a reference constraint, an editor was incorrectly
opened.
2020-02-05 05:34:33 +00:00
Maximilian Federle 72bc71cc9d README: add snap as an installation option. 2020-01-23 17:05:13 +00:00
Maximilian Federle 2dcd81d7e7 snap: Release snaps to store via script instead of snap provider
dpl-snap only supports pushing one snap at a time.
Instead of many repetitive deploy statements,
we use our own script to loop over the snaps to be released.
2020-01-23 01:47:10 +00:00
Maximilian Federle d5351c48e3 snap: build snaps on Travis via remote-build.
We invoke builds on Launchpad in stage "deploy" and release it into
the edge channel of the Snap Store.

The deploy stage is blocked on fails of the test stage, so we don't
release snaps with failing tests.
2020-01-21 23:38:55 +00:00
ruevs 16c5fa6889 Fix eight trivial "implicit conversion 'double' to 'int'" warnings. NFC. 2019-12-17 19:35:44 +00:00
whitequark 64c0f62b92 Win32: mark all remaining functions as Unicode. NFC.
Some were missing the *W suffix.
2019-12-06 15:21:51 +00:00
whitequark 69baf52432 Linux: fix Z-order in scalable icon. 2019-12-04 13:57:10 +00:00
whitequark 0b786e6e2b CMake: review minimum required CMake version.
It turns out that using cmake_policy(VERSION) is effectively same as
using cmake_minimum_required(VERSION) because it is a hard error
if the CMake running the script is too old. As such, replace 22525e65
with two changes:
  * Set the minimum required version to 3.7.2 (Debian stretch),
    which also configures policies.
  * If CMake is at least as new as 3.11.0, then set the policies
    according to that version.
This should actually have the intended behavior.
2019-12-02 18:51:58 +00:00
Koen Schmeets 0472b9ea60 macOS: fix tooltips not closing on Catalina. 2019-11-27 12:51:27 +00:00
Koen Schmeets dcdfdec564 Add an option to edit dimension immediately after adding. 2019-11-26 22:34:53 +00:00
Koen Schmeets 58f23aa061 macOS: force show property browser when opening preferences from menu. 2019-11-26 20:31:14 +00:00
Koen Schmeets 552fe354aa Fix commit 07992cecaa. 2019-11-26 14:34:30 +00:00
whitequark 0501f0c99e Don't call GL functions in OpenGl3Renderer::GetIdent.
GetIdent is called from an UI event callback, at which point there
might well not be an active GL context. Before this commit, that
would return a NULL pointer and result in a crash.
2019-11-26 11:23:37 +00:00
whitequark 22525e6515 CMake: update policy to 3.11.
In particular this enables linking with GLVND on Linux by default.
2019-11-26 11:23:37 +00:00
whitequark 07992cecaa Remove unused offscreen GL renderer.
This was used for Gtk 2 and old macOS, but all of those use direct
rendering now.
2019-11-26 11:23:37 +00:00
Maximilian Federle a60d4df179 Refactor Travis config
- Fix invalid osx_image xcode8.2
- Drop depreceated sudo keyword
- Run debian build on bionic image & re-enable building with ui
- Split build into separate jobs & stages for better separation of concerns
2019-11-26 07:58:20 +00:00
whitequark fb536a155d Test for -ffile-prefix-map support instead of comparing versions.
Comparing versions is not viable because Apple clang has its own
versioning scheme which is also undocumented.
2019-11-24 18:55:46 +00:00
whitequark 690f87cf4a On GNU-compatible compilers, avoid embedding paths into binaries.
This is helpful for reproducible builds, and also makes it easier
to debug binaries built on another system.
2019-11-23 16:57:35 +00:00
whitequark 14e095c93a Don't show unusable fonts in font selector.
Before this commit, certain fonts (e.g. Terminus) would appear in
the selector but cause a crash (assertion failure) if they are used.
After this commit, we make sure all preconditions are met before
showing a font there.

Also, improve error reporting to always print font filename.
2019-11-23 16:17:01 +00:00
whitequark e74137dc67 Fix misuse of glTexImage2D (again).
This was originally changed in 74aa80b6, but the fix broke stipping
because it incorrectly changed the logic. Revert that, and just make
the textures smaller instead.
2019-11-23 15:56:57 +00:00
Ryan Pavlik 2fe17a46c2 Remove prototype for an unimplemented function. 2019-11-23 15:35:51 +00:00
Ryan Pavlik 38f42871c7 Remove an integer cast. 2019-11-23 15:35:39 +00:00
Ryan Pavlik 93184c54ac Use standard std::count_if. NFC. 2019-11-23 15:35:29 +00:00
whitequark 8c750cef9c Freeze the scrollbar while editor is open in property browser.
Before this commit, the scrollbar would move freely, without changing
the position of the viewport. It would be reset after editing is
finished.
2019-11-23 15:34:52 +00:00
whitequark f0359556d8 Recompute property browser viewport on resize.
Before this commit, resizing the property browser would cut off
the rows at the bottom, or else add black space, until next refresh.

This could be perhaps more elegantly done by adding an onResize event
but given that each of them would be followed by onRender anyway, it
seems there's no benefit to adding onResize.
2019-11-23 15:04:31 +00:00
whitequark 54015b6777 Call glGetError() after glFinish(), not glFlush().
As I understand it, both glGetError() and glFinish() are serializing
and blockig, so it makes more sense to call them at the same time.
glFlush() does not block.
2019-11-23 14:50:19 +00:00
Thomas Roughton 9b61f988be macOS: Don't use offscreen rendering.
Since Catalina or earlier this no longer causes artifacts when Cocoa
controls are overlaid on a GL layer. Conversely, offscreen rendering
is very slow, especially on HiDPI screens.

Co-Authored-By: Koen Schmeets <hello@koenschmeets.nl>
2019-11-23 14:50:18 +00:00
Ryan A. Pavlik e386d405d6 Make some arguments const/const references, where possible. NFC.
Found and suggested by clang-tidy.May help performance by reducing copies,
depending on frequency of call, etc.
2019-11-23 14:07:31 +00:00
whitequark 65d0bdffdb Split Canvas::FinishFrame out of Canvas::FlushFrame.
When drawing the graphics window, we flush it twice: once to draw
the geometry, and another time to draw the UI overlay (toolbar,
selection marquee, and FPS counter). Calling glFinish() each time
is (on most platforms) just pointlessly slow, but on macOS Catalina,
without offscreen rendering, it causes the toolbar to flicker.

Instead of calling glFinish() twice per frame in that case, call
glFlush() twice and then glFinish() once we really are done.
2019-11-23 13:35:16 +00:00
ruevs ec3056773e Simplify UNION and DIFFERENCE boolean operations.
Union and difference are optimized by replacing the expression
  (!inShell && !inFace)
which is equivqlent to
  (!inShell && !inSame && !inOpp)
with
  outSide
which is equivalent, since SShell::Class::OUTSIDE is the only remaining possibility.
2019-11-23 13:22:15 +00:00
Koen Schmeets b5ccf5acf5 macOS: fix CMake Xcode generator.
This is done by setting `CMAKE_RUNTIME_OUTPUT_DIRECTORY` to `$<1:${CMAKE_BINARY_DIR}/bin>`
2019-11-23 13:20:45 +00:00
Koen Schmeets 0dcc8f3369 Fix Xcode auto-fixable issues 2019-11-23 13:08:22 +00:00
whitequark 74aa80b645 Fix misuse of glTexImage2D.
Per the OpenGL documentation:
> GL_INVALID_VALUE may be generated if level is greater than
> log2(max), where max is the returned value of GL_MAX_TEXTURE_SIZE.

Although we always passed `log2(max) + 1` as `level`, for some reason
none of the GL implementations we run on ever returned an error.
It also appears there is a bug in ANGLE that crashes the process
instead in this case if the C++ runtime performs bound checks on
vector::operator[]=.
2019-11-22 02:11:10 +00:00
phkahler 5d78f993ce Make helix origin create a line even if it's in a different group.
Helix should always make a line for the axis.
2019-09-20 01:09:58 +00:00
phkahler 162897eca7 Reimplement DivPivoting as DivProjected.
The old implementation was an approximation, whereas the new one is exact.
2019-09-20 01:09:25 +00:00
EvilSpirit 7f9117b2bf Calculate area of selected faces, if any. 2019-09-11 10:38:10 +00:00
EvilSpirit 915f55aabc Show volume of current group alongside total volume. 2019-09-11 10:38:10 +00:00
Ryan Pavlik a0e992374d Clean up virtual, override, default, and void params. NFC.
Found by clang-tidy.
2019-09-11 10:31:07 +00:00
Ryan Pavlik ae417fc14c Use emplace_back. NFC.
Found by clang-tidy.
2019-09-11 10:31:07 +00:00
Ryan Pavlik 34dccbf935 Don't call static methods through an instance. NFC.
Found by clang-tidy.
2019-09-11 10:31:07 +00:00
Maximilian Federle 219df31c53 Linux: add support for building snap packages. 2019-09-11 10:12:53 +00:00
Ryan Pavlik b1e280e75f Fix undefined behavior in IdList::end(). 2019-09-11 09:44:30 +00:00
Ryan Pavlik ec13839c92 Modify clang-format config to avoid single-line things. NFC. 2019-09-11 09:43:03 +00:00