Commit Graph

30 Commits (f09ae155862f456d70bbb1fc24b21784d69aea0e)

Author SHA1 Message Date
Daniel Richard G 7ca137f5fe Changed GetMilliseconds() to return a 64-bit value
This function previously returned an int32_t. Presuming that it measures
the length of time since the application was started, the 32-bit type would
cause the returned value to wrap from 2^31-1 to -2^31 after a little less
than twenty-five days.
2013-10-28 00:43:38 -04:00
Daniel Richard G dd168ad22c Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:

    QWORD  --> uint64_t
    SQWORD --> int64_t
    DWORD  --> uint32_t
    SDWORD --> int32_t
    WORD   --> uint16_t
    SWORD  --> int16_t
    BYTE   --> uint8_t
    BOOL   --> bool
    TRUE   --> true
    FALSE  --> false

The following related changes are also included:

* Added C99 integer type definitions for Windows, as stdint.h is not
  available prior to Visual Studio 2010

* Changed types of some variables in the SolveSpace class from 'int' to
  'bool', as they actually represent boolean settings

* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
  variables in the Registry

* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()

* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
  inspired by the OpenType spec)

* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
  in a few places, these were represented by an int; these have been
  corrected to uint32_t
2013-10-02 01:45:13 -04:00
Daniel Richard G 70b6bad551 Use '\b' instead of ('h' - 'a' + 1) 2013-09-18 16:41:23 -04:00
Daniel Richard G 66315d5eea Added const qualifiers to edit-control string handling
FLTK's Fl_Input widget, instantiated as {Graphics,Text}EditControl, returns
a 'const char *' string. In order to handle this properly, several of
SolveSpace's internal routines needed to gain a "const" qualifier on the
edit-control string argument.
2013-09-16 15:51:20 -04:00
Daniel Richard G a72575d04e Use casts to bridge mismatches in integer-type sizes and signedness
The compiler gets nervous when we (for example) pass in a size_t as an int
parameter, or assign an int to a char, or assign -1 to an unsigned type. By
adding appropriate casts, we inform the compiler that, yes, we know what
we're doing.

This change also upgrades a va_arg() type from char to int, as char is
always promoted to int when passed through '...'.
2013-08-26 16:19:23 -04:00
Jonathan Westhues 0ee8ba1457 Changes in preparation for the release of SolveSpace under the GPL,
to add that license, and change all copyright notices to me, not
Useful Subset, LLC.

[git-p4: depot-paths = "//depot/solvespace/": change = 2211]
2013-07-28 14:08:34 -08:00
Jonathan Westhues 3dea64af47 Make default text in dimension box the exact (up to ten digits
after decimal) current value of the dimension, not the value
truncated to the same number of digits that are usually displayed.

And make the paste transformed screen accept expressions, not
just integers, for the count, angle, and scale.

[git-p4: depot-paths = "//depot/solvespace/": change = 2181]
2010-10-11 19:13:41 -08:00
Jonathan Westhues 824cc00915 Put wrappers around the functions to show and hide the edit control
in the text window. This means that I can move the conversion from
half-row and column to (x, y) into the platform-independent code,
and that I'll be ready to add my color picker.

[git-p4: depot-paths = "//depot/solvespace/": change = 2171]
2010-07-11 23:51:12 -08:00
Jonathan Westhues 319ba16541 When curves to be split intersect at multiple points, don't just
choose arbitrarily. Instead, split at the point closest to the
mouse pointer.

[git-p4: depot-paths = "//depot/solvespace/": change = 2170]
2010-07-11 22:47:14 -08:00
Jonathan Westhues a95054890f Fix some cases where the green line (that indicates the center of
an in-plane rotation of the view, or of a set of entities) would
remain on screen after the action was over.

[git-p4: depot-paths = "//depot/solvespace/": change = 2142]
2010-05-11 20:47:58 -08:00
Jonathan Westhues 52f9be0925 Add projected point-point distance constraint.
[git-p4: depot-paths = "//depot/solvespace/": change = 2115]
2010-01-27 10:15:06 -08:00
Jonathan Westhues 5302aad1cc Hide the text or graphics edit control when the user left-clicks
somewhere in the text or graphics window. Previously, those
left-clicks just did nothing.

[git-p4: depot-paths = "//depot/solvespace/": change = 2100]
2010-01-08 01:55:22 -08:00
Jonathan Westhues 0f8c303b2e Oops, it was possible to edit the dimension for any constraint, not
just those that actually have associated dimensions. Amazing how
long that bug's been sitting there.

[git-p4: depot-paths = "//depot/solvespace/": change = 2099]
2010-01-08 01:40:47 -08:00
Jonathan Westhues ba8ac7dcd3 Add a screen to edit the view parameters; scale, translation,
rotation. Also clean up the handling of units, by putting the
conversion factors in only one place, and clean up the
expression-parsing but removing all the copies of the same error
message.

[git-p4: depot-paths = "//depot/solvespace/": change = 2093]
2010-01-03 16:35:28 -08:00
Jonathan Westhues a4a1d3b619 Remove the toggle semantics from all the selection stuff. Now
left-clicking always selects, and there's a special context menu
item to deselect. Also streamline the right-click behavior by
making that select the hovered item, and making all the context
menu items work on the selection.

[git-p4: depot-paths = "//depot/solvespace/": change = 2091]
2010-01-03 02:26:15 -08:00
Jonathan Westhues ee052b556a Tweak drag and selection behavior: selection is kept after dragging
selected entities, but cleared after dragging an unselected entity.
Marquee selection is select-only (not toggle), and "Select All"
replaces "Invert Selection". Left-click on nothing will clear the
selection.

Also add context menu entries for cut, copy, and paste.

[git-p4: depot-paths = "//depot/solvespace/": change = 2089]
2009-12-21 08:44:00 -08:00
Jonathan Westhues b974a4adeb A big nasty change, originally just to add paste transformed. So it
does that, and adds a scale factor to that transformation (instead
of just mirroring, as before), but also:

    * Replace the "import mirrored" mechanism with a scale factor,
      which if negative corresponds to a reflection as well.

    * Fix self-intersection checker to report a meaningful point
      when edges are collinear.

    * Don't blow an assertion on some types of invalid file;
      instead provide a nice error message to the user.

    * Clear the naked edges before each regen.

    * Don't create zero-length line segments by snapping a line
      segment's end to its beginning.

[git-p4: depot-paths = "//depot/solvespace/": change = 2086]
2009-12-15 04:26:22 -08:00
Jonathan Westhues 9723f4e44f Add support for a clipboard, with cut, copy, and paste. This works
only in a workplane; but this means that plane sketches are
conveniently transformed from one plane to another.

Also tweak snap to grid to ignore unsnappable entities instead of
triggering an error, and to remove arbitrary limit on the number of
entities / comments that will be snapped.

[git-p4: depot-paths = "//depot/solvespace/": change = 2084]
2009-12-04 00:08:41 -08:00
Jonathan Westhues c74ab47833 Don't create new line segments as zero-length when left-clicking to
draw more line segments, to avoid annoying warnings.

[git-p4: depot-paths = "//depot/solvespace/": change = 2083]
2009-12-03 11:47:44 -08:00
Jonathan Westhues 4cfe7eea64 Split cubic splines and periodic splines too; which is a pain,
because it can't be C2 continuous after splitting (since I'm
doing uniform splines only, and the parametrization changes). So
just knock everything down to cubic Beziers.

Also draw lines to indicate angle and origin when Ctrl+dragging to
rotate in plane of screen.

[git-p4: depot-paths = "//depot/solvespace/": change = 2075]
2009-11-09 19:57:24 -08:00
Jonathan Westhues d74b1e7ece Add ability to set a background image. I import a png with libpng,
load it as a texture, and show it instead of a flat-color
background. Includes user interface to specify scale and
translation of image, but the rotation is always aligned to the
view.

[git-p4: depot-paths = "//depot/solvespace/": change = 2071]
2009-11-07 17:11:38 -08:00
Jonathan Westhues c79604f64d Add marquee selection, a view-aligned rectangle such that
everything even partially within that rectangle gets selected when
I release.

Also make deselecting a point deselect all coincident points too;
otherwise there now exist ways to select both coincident points,
which meant that it was impossible to deselect the lower one.

And fix text window to show selection info even if just constraints
are selected, seems more consistent.

[git-p4: depot-paths = "//depot/solvespace/": change = 2066]
2009-11-03 23:52:58 -08:00
Jonathan Westhues 2ae9983f9e Add context menu item to delete a point-coincident constraint,
which can't be selected with the mouse and would otherwise have to
get deleted by selecting it in the text window.

[git-p4: depot-paths = "//depot/solvespace/": change = 2065]
2009-11-03 19:46:06 -08:00
Jonathan Westhues b9ab62ab3f Remove arbitrary limits on the selection size, and permit more than
one point to be dragged simultaneously. So now a dragged point
drags all the selected points and entities, and a dragged entity
drags its points (except for circles, which drag the radius).

This means that the number of forced points for the solver must now
be unlimited, and it is.

Also add commands to invert the selection within the active group,
and to select an edge chain starting from the current selection.
And redo the context menus a bit; still not great, but less
cluttered and more systematic.

[git-p4: depot-paths = "//depot/solvespace/": change = 2064]
2009-11-03 10:54:49 -08:00
Jonathan Westhues 2f115ec950 A monster change to add support for filled paths. This requires us
to assemble Beziers into outer and inner loops, and find those
loops made up of entities with filled styles. The open paths are
maintained in a separate list, and we assemble as many closed paths
as possible even when open paths exist.

This changes many things. The coplanar check is now performed on
the Beziers, not the resulting polygon. The way that the polygon is
used to determine loop directions is also modified.

Also fix the mouse behavior when dragging a point: drop it when the
mouse is released, even if it is released outside the window, but
don't drop it if the pointer is dragged out of and then back into
our window.

Also special-case SSurface::ClosestPointTo() for planes, for speed.

[git-p4: depot-paths = "//depot/solvespace/": change = 2058]
2009-10-28 23:16:28 -08:00
Jonathan Westhues 0914a27ff4 Put information about which requests generate which entities, and
how many points are associated with each, into a single table.

[git-p4: depot-paths = "//depot/solvespace/": change = 2056]
2009-10-22 06:02:08 -08:00
Jonathan Westhues 2ca5334bdf Add interpolating splines: both periodic splines (that form a
loop), and open-ended splines, with their tangents specified at
their endpoints.

Also change constraint solver matrix size to 1024, on the theory
that a power of two will generate better array indexing, and
replace fabs() with my own function that for some reason is
faster.

[git-p4: depot-paths = "//depot/solvespace/": change = 2055]
2009-10-20 20:46:01 -08:00
Jonathan Westhues 2e9e0da71f Add ability to relax the constraints, applying only
point-coincident constraints and the entity- or group-generated
constraints. Also fix a bug where a dragged point was not released
when the mouse pointer left the window.

[git-p4: depot-paths = "//depot/solvespace/": change = 2045]
2009-10-01 03:22:56 -08:00
Jonathan Westhues ea00c7e979 Increment the version number, and add a context menu item to snap
what's hovered to the grid.

[git-p4: depot-paths = "//depot/solvespace/": change = 2042]
2009-09-30 00:54:01 -08:00
Jonathan Westhues 35df6bd06a Split draw.cpp and textscreens.cpp, and move a few things around.
This creates mouse.cpp and confscreen.cpp.

[git-p4: depot-paths = "//depot/solvespace/": change = 2040]
2009-09-29 05:14:47 -08:00