Commit Graph

1413 Commits (b1e280e75f7fc844b65e27c656624e29fbf2bed8)

Author SHA1 Message Date
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
Pierre Delore 501a4829c7 I18n: add fr_FR locale. 2018-07-14 18:21:31 +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 4fab5b7107 Appveyor: add IRC notifications. 2018-07-12 23:06:07 +00:00
whitequark 595ae86b29 I18n: update translations. 2018-07-12 23:06:07 +00:00
whitequark 76561e3831 README: add Community section. 2018-07-12 20:58:40 +00:00
whitequark fb1065deba Travis: add a workaround for travis-ci/travis-ci#4704. 2018-07-12 20:23:58 +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 9cd0044803 macOS: update instructions in README. 2018-07-12 13:39:45 +00:00
whitequark ba71dba024 CMake: use correct gtkmm version constraint.
Many GL APIs appeared in GTK in version 3.16, but in gtkmm only in
version 3.18.
2018-07-12 12:19:59 +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
whitequark fa5557740c macOS: add CFBundleIdentifier to MacOSXBundleInfo.plist.
This is a mandatory field, and its absence breaks 3DConnexion
configuration tool.
2018-07-12 12:15:53 +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
Kevin Zheng 572869dd48 GTK: install MIME type specification. 2018-07-12 05:03:37 +00:00
whitequark c5a3b43665 CMake: support sanitizers on gcc builds, too.
This also fixes Travis Linux builds.
2018-07-11 04:52:11 +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