Commit Graph

1028 Commits (7f86a784724298b87e169d1f0fe431119a427115)

Author SHA1 Message Date
whitequark c6194d439c Allow using the constant "pi" in expressions. 2015-12-28 21:37:07 +08:00
EvilSpirit ef3ee55d42 Optimize Expr::From(double) by statically allocating common constants. 2015-12-28 21:37:07 +08:00
ruevs 922a6260d7 Allow building with MinGW on Windows. 2015-12-28 21:37:06 +08:00
whitequark 28166e6200 Use C++ std::{min,max,swap} instead of custom ones.
The main benefit is that std::swap will ensure that the type
of arguments is copy-constructible and move-constructible.
It is more concise as well.

When min and max are defined as macros, they will conflict
with STL header files included by other C++ libraries;
in this case STL will #undef any other definition.
2015-12-28 21:37:06 +08:00
whitequark 063dfc4f98 Require cmake 3.1.0 and C++11.
We plan to use C++11 features in the future. Moreover, recent gtkmm
has a hard requirement on C++11.
2015-12-28 21:37:06 +08:00
whitequark 1b6cd0d632 Make in-tree zlib more robust. 2015-12-28 21:37:06 +08:00
EvilSpirit 4d5a92e9b2 Make faces selectable again after undo. 2015-12-28 21:37:06 +08:00
whitequark fdc39edfd8 Fix AllocTemporary on *nix. 2015-12-28 21:37:06 +08:00
whitequark 06be0d1157 Fix read of uninitialized memory. 2015-12-28 21:37:06 +08:00
whitequark 1422d3abd2 Fix initialization order issue. 2015-12-28 21:37:06 +08:00
whitequark 0159a87a8a Add support for cross-compiling from Linux.
As a side effect, zlib and libpng are now git submodules,
based on their respective official git repositories.
This is necessary, because MinGW has a different ABI and
it cannot use the prebuilt binaries built by MSVC.

The submodules are also used for Windows, for several reasons:
  * to allow 64-bit builds;
  * to allow using newer MSVC, which doesn't like the prebuilt
    libraries;
  * to keep the libraries updated.
2015-07-10 15:59:12 +03:00
whitequark 5e7c7fce7e Rename RgbColor to RgbaColor. 2015-07-10 15:59:12 +03:00
whitequark 75a3936b64 Add support for transparent solids.
Some extra code is necessary to determine that the back faces
should not be drawn in red for transparent solids. It is expected
that the user will first ensure that the shell is watertight
and then set the opacity; back faces are still drawn if
the opacity is exactly 1.

The savefile format is changed backwards-compatibly by stashing
the alpha value in uppermost byte of 4-byte hex color value
in Surface and Triangle clauses. The existing files have 00
in the high byte, so RgbColor::FromPackedInt treats that
as "opaque".
2015-07-10 15:59:12 +03:00
whitequark 1b69032d99 Allow displaying and editing diameter constraints as radius.
The savefile format is not changed; the display option is
stored in Constraint::other.
2015-07-10 15:59:12 +03:00
whitequark f62e95d7b6 Replace \ with / slashes in assembly relative paths on *nix.
This is done specifically targeting the case where an assembly
initially made on Windows is transported to an *nix machine.
On *nix, the paths will be already saved with /, and correctly
read on Windows. On Windows however / is not a first-class separator,
in particular it cannot be used in UNC-style paths \\?\ (which
are the only paths that work with Unicode).

See also:
http://msdn.microsoft.com/en-us/library/aa365247.aspx
2015-07-10 15:59:12 +03:00
whitequark 69c509064c Automatically add horz/vert constraints to lines if close enough. 2015-07-10 15:59:12 +03:00
whitequark f89020ad26 Highlight pending operation on toolbar, even if started via keyboard. 2015-07-10 15:59:12 +03:00
whitequark 46db5378dc Add Travis CI and Appveyor CI configurations. 2015-07-10 15:59:12 +03:00
whitequark 71b7ad7f99 Add an autosave timer.
Original patch by Marc Britten <marc.britten@gmail.com>.
2015-07-10 15:59:12 +03:00
whitequark 22d43d5b83 Remember the last format used to export 2D Views.
This helps a lot when exporting a lot of views, e.g.
for shop drawings.
2015-07-10 15:59:12 +03:00
whitequark d585f0d1ff Make "Align view onto workplane" switch to locked workplane, if any.
Original patch by yugami
(http://solvespace.com/forum.pl?action=viewthread&parent=508).
2015-07-10 15:59:12 +03:00
whitequark d0c0a7ae5a Remove FLTK port.
It provides no value over the native GTK and Cocoa ports.
2015-07-10 15:59:12 +03:00
whitequark bbe4999033 Make sure all DrawOrGetDistance style code only draws in Paint();
Otherwise, GL reports errors when used with FBOs, as well as
creates visual artifacts, especially when UI is also drawn
with OpenGL.
2015-07-10 15:59:12 +03:00
whitequark 4b86fb89f8 Make "Show Menu Bar" and "Full Screen" use Ctrl/Cmd+Fn.
On OS X F11 and F12 are system-global shortcuts. I could switch
them only on Apple platforms, but for consistency I decided not to.
Anyway, neither of those appeared in an official release.
2015-07-10 15:59:12 +03:00
whitequark d76d59ea64 Build Mac OS X dmg installation image. 2015-07-10 15:59:12 +03:00
whitequark 95ab80d0ee Implement OS X port. 2015-07-10 15:59:12 +03:00
whitequark 5d7a5bf3a7 Pack everything into `namespace SolveSpace`.
This is required to avoid name conflicts with the Cocoa libraries
on OS X.

I renamed the `class SolveSpace` to `class SolveSpaceUI`, because
that's what it does, and because otherwise the namespace would
have to be called something else than `namespace SolveSpace`.
2015-07-10 15:59:12 +03:00
whitequark 0807c2fdfe Add a native Debian package. 2015-07-10 15:59:12 +03:00
whitequark d3dbf23725 Add a desktop file in the format understandable by Ubuntu. 2015-07-10 15:59:12 +03:00
whitequark 2ce12155bf Add bug compatibility with Chromium GL (VirtualBox).
I question the life choices that led me here.
2015-07-10 15:59:12 +03:00
whitequark 88e4163970 Use the extension version of FBO extension instead of core.
This will allow solvespace to run on pre-OpenGL 3.0 implementations,
such as VirtualBox (and possibly others).

However, VirtualBox's handling of framebuffer objects is buggy;
it tries to draw over our X window and fails to do either.

I hate OpenGL.
2015-07-10 15:59:12 +03:00
whitequark e27c6b56c3 Implement offscreen rendering using GL framebuffer objects.
Apparently pbuffers are also a deprecated and unportable
way of offscreen rendering. They're not supported by
Chromium OpenGL implementation, which is what 3D-accelerated
VirtualBox uses.

This would also help a future OS X port.
2015-07-10 15:59:12 +03:00
whitequark 622c9efadb Use GL pbuffers instead of GLX pixmaps.
Apparently GLX pixmaps are an antiquated and unsupported method
for offscreen rendering in OpenGL. Specifically this broke
software and VirtualBox accelerated rendering in Ubuntu trusty
and who knows which other systems.

This commit switches the rendering to use pbuffers instead,
while retaining all other logic. The pbuffers are fixed-size,
because reallocating pbuffers during a resize sometimes results
in segfaults in glXMakeCurrent despite apparently correct
API usage.
2015-07-10 15:59:12 +03:00
whitequark 2c39f259db Add a GTK2/3 port.
In principle, GTK3 is the way forward, and GTK2 is officially
deprecated, though still maintained. In practice however, GTK3
is often unbearably buggy; e.g. on my system, combo boxes
don't ever roll up in GTK3 windows. So I have added support
for both.

This required a few minor changes to the core, namely:
  * GTK wants to know beforehand whether a menu item is a check
    menu item or a regular one.
  * GTK doesn't give us an easy way to execute something after
    any event is processed, so an explicit idle timer is added.
    This is a no-op on Win32.
  * A few function signatures were const'ed, since GTK expects
    immutable strings when converting to Glib::ustring.
2015-07-10 15:59:12 +03:00
whitequark b68631ee56 Make fltkutil.cpp independent of FLTK and rename it to unixutil.cpp.
fltkutil.cpp should be independent of FLTK so that it can be linked
into libslvs while neither requiring every user of the library to
reimplement these support routines nor requiring linking in FLTK.
2015-07-10 15:59:11 +03:00
whitequark 5db5f1e152 Add a CMake buildsystem.
Additionally, update build tools so that no stdio redirection
is necessary.
2015-07-10 15:59:11 +03:00
whitequark c5364fe7a8 Trim trailing whitespace. 2015-07-10 15:59:11 +03:00
whitequark 7c7ac17e4b Remove all legacy buildsystems. 2015-07-10 15:59:11 +03:00
whitequark 3a42a8d8cb catc 2015-07-10 15:59:11 +03:00
whitequark 62af550c0b Fix try..catch clauses dealing with C strings.
On *nix, a thrown string literal cannot be caught using
catch(char*), resulting in crashes.
2015-07-10 15:58:56 +03:00
whitequark 024a26bf57 Explicitly request a 24-bit depth buffer in FLTK port.
See http://solvespace.com/forum.pl?action=viewthread&parent=417.
2015-07-05 06:20:25 +03:00
whitequark 14690e6e42 Work around poor line rendering with Intel Mesa-based drivers.
However, don't use ssglLineWidth for UI drawing operations.
These only draw horizontal or vertical lines that don't need to
be antialiased, and thus don't require the workaround. In fact
the workaround would make them thicker than needed.
2015-07-05 06:20:25 +03:00
whitequark 13afcb310e Fix fontconfig detection code in FLTK.
Either clang is stricter than the compiler the authors of that
code used, or fontconfig detection never worked.
2015-07-05 06:20:25 +03:00
whitequark 80046672ef Use Command instead of Control key for shortcuts on OS X.
It is the OS X convention.
2015-07-05 06:20:25 +03:00
whitequark 84f2a59993 Use the degree symbol on non-Windows.
The Windows code uses a degree symbol in Latin-1, which
crashes FLTK on OS X.
2015-07-05 06:20:25 +03:00
whitequark ffd2df9494 Fix dbg() not writing a newline.
puts() appends a newline, but fputs() does not.
Who needs consistency when you have undefined behavior? Oh, wait.
2015-07-05 06:20:25 +03:00
whitequark 1bbf61b8a2 Fix accidental glibc dependency.
fltkmain accidentally used optind instead of optndx. optind is
defined as an extern int in glibc but not on BSD systems.
This also broke passing a filename on command line.
2015-07-05 06:20:25 +03:00
whitequark 604c4bbea3 Fix oops() to not have UB.
Writing to NULL is undefined behavior and it is legal for the
compiler to simply remove it; clang will do so. abort()
or __builtin_trap() would produce the desirable result.
abort() is used as it is more portable.
2015-07-05 06:20:25 +03:00
whitequark 1cd2e2be2f Add Apple-specific OpenGL include statements. 2015-07-05 06:20:25 +03:00
whitequark 5894efcfe5 Fix unresolved symbols in src/constraint.cpp when building libslvs. 2015-07-05 06:20:25 +03:00
Jonathan Westhues ba8202d54a Don't falsely detect inconsistent systems with small angle constraints. 2015-06-08 11:19:29 -07:00
Jonathan Westhues 403d3c04d2 Improve relative paths for file import.
Don't break on case-sensitive filesystems, and don't require an explicit
regen after initial save of the assembly.
2015-05-21 05:26:29 -07:00
Jonathan Westhues 044a4ea8fc Don't offset SVG width and height by one. 2015-04-12 14:24:55 -07:00
Jonathan Westhues 9c9a0d8c28 Merge commit 'refs/merge-requests/16' of https://gitorious.org/solvespace/solvespace 2015-03-10 22:50:31 -07:00
Marc Britten 3b587d022a Updated Freeze to be multi monitor friendly 2015-03-10 22:05:29 -05:00
Roland Lutz 48880f6fe9 Apply automake option `subdir-objects' globally 2015-03-02 21:46:11 +01:00
Roland Lutz 9b68bf8f7b Move library source to src/ directory 2015-03-02 21:46:11 +01:00
Roland Lutz ae37fb783e Control libslvs compilation from src/Makefile.am 2015-03-02 21:46:11 +01:00
Andrew Downing 6cfa884406 fix GraphicsEditControlWindow placement, and fix error due to cmath being included instead of math.h 2015-02-26 12:22:42 -05:00
Andrew Downing 252f4128b7 add includes to dsc.h to fix errors in it's own context (not real errors since dsc.h isnt compiled by itself, just screws up the code model in QtCreator without them) 2015-02-26 09:19:15 -05:00
Andrew Downing 023f404475 add LDFLAGS for FLTK to exposed/Makefile.am and src/Makefile.am 2015-02-25 22:47:35 -05:00
Andrew Downing ce77197dac display GraphicsEditControl in its own tooltip window avoiding the need to hack FLTKs internals 2015-02-25 12:43:01 -05:00
Andrew Downing 396b1c63a4 fix fltk code 2015-02-24 16:07:32 -05:00
Andrew Downing 1bfba0df5f fix fltk code 2015-02-24 15:54:27 -05:00
Marc Britten 0f334cc040 Added updated header information for surfaces 2015-02-08 10:43:19 -06:00
Petteri Aimonen 12a29ddce0 FLTK: Don't oops() when unknown mouse button is pressed.
For example forward/backward buttons are present on many mouses
but are not used by solvespace. This oops() caused solvespace to
crash whenever those buttons were (accidentally) pressed.
2014-12-29 22:33:19 +02:00
Petteri Aimonen 8996833989 Fix crash on Ubuntu when opening assembly files.
Ubuntu enables GCC's buffer overflow checks by default. In SAVEDptr
union, the path was declared as 'char', even though MAX_PATH memory
was actually allocated. The buffer overflow check mistakenly thought
that the buffer size was only 1 and aborted the program whenever it
tried to read a path from a file.
2014-12-29 22:16:21 +02:00
Jonathan Westhues e587d0ebee Fix GUI bugs in FLTK port, per Xavier Thomas's forum post:
"There was some small but annoying bugs with the FLTK port:
-cursor disappear sometimes
-not all the area of the windows (graphic and text windows) is accessible
by the mouse after a re-size
-input widget for editing constraints value are not correctly placed"
2014-05-11 15:43:03 -07:00
Ilya Novoselov f5297093c0 Fix automake "option 'subdir-objects' is disabled" warning 2014-04-10 23:05:17 +06:00
Ilya Novoselov 01213bcafb Rest of code assumes that allocated memory is filled with zeroes 2014-04-08 07:56:57 +06:00
Jonathan Westhues f4916f9ee4 Compare ((char *)p)[0] against '\0', not (char *)p.
Also make the library example compile again under MSVC, and make the
perl scripts to build the image tables work.
2013-12-08 00:32:50 -08:00
Daniel Richard G 1bc73c4a75 Renamed the RGB() macro to RGBi() to avoid collisions with Microsoft
Microsoft defines an RGB() macro that at one point was compatible with our
version (returning a packed integer containing 8-bit red, green and blue
channels), but is no longer, and the incompatibility led to an awkward
situation in w32main.cpp where we had to restore Microsoft's form of the
macro in order for the commctrl.h header to compile. By renaming the macro
to RGBi()---analogous to the RGBf() macro we already define---we avoid the
hassle entirely.
2013-12-02 04:27:34 -05:00
Daniel Richard G f9f321ca84 Warning fixes 2013-12-02 04:27:33 -05:00
Daniel Richard G fd9dc19a34 Added the exposed/ library and demo program to the Autotools build
The libslvs library and CDemo program can now be built by Autotools. A few
code changes were needed for this: C++ comments in C code had to be
converted, constraint.cpp required some massaging, and fltkutil.cpp needed
a stub for InitHeaps().
2013-12-02 04:27:33 -05:00
Daniel Richard G 6c68294249 Improved handling of generated files
Place a pre-built copy of generated source files in src/built/, so that
users building SolveSpace from Git without the tools or setup necessary to
generate these can still complete the process.

Makefile.msvc: Use slashes consistently, and added rules to copy files from
src/built/ if needed

configure.ac: Check for presence of src/built/ at configure time

src/Makefile.am: Handle the generated *.table.h files together with
icon*.h; updated the source-generation rules so that the files are created
in builddir, not srcdir; added rules to copy files from src/built/ if
needed
2013-11-20 01:25:48 -05:00
Daniel Richard G 174ed76ef9 Added libspnav configure option and support to the Autotools build system 2013-11-19 18:17:55 -05:00
Daniel Richard G bb3e5e9bb1 Minor follow-up changes
solvespace.h: Need to #define MAX_PATH on POSIX systems

resource.rc: icon.ico now lives in the same directory as this file
2013-11-19 18:17:55 -05:00
Daniel Richard G 0a24cf40f0 Moved most of the source into a src/ subdirectory
The SolveSpace top-level directory was getting a bit cluttered, so
following the example of numerous other free-software projects, we move the
main application source into a subdirectory and adjust the build systems
accordingly.

Also, got rid of the obj/ directory in favor of creating it on the fly in
Makefile.msvc.
2013-11-19 18:17:32 -05:00