2013-07-28 22:08:34 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// All declarations not grouped specially elsewhere.
|
|
|
|
//
|
|
|
|
// Copyright 2008-2013 Jonathan Westhues.
|
|
|
|
//-----------------------------------------------------------------------------
|
2008-03-25 10:02:13 +00:00
|
|
|
|
|
|
|
#ifndef __SOLVESPACE_H
|
|
|
|
#define __SOLVESPACE_H
|
|
|
|
|
2015-03-29 00:33:46 +00:00
|
|
|
#include <config.h>
|
2013-10-25 05:04:16 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdio.h>
|
2015-03-23 17:49:04 +00:00
|
|
|
#include <stddef.h>
|
2013-10-25 05:04:16 +00:00
|
|
|
#include <stdarg.h>
|
|
|
|
#include <math.h>
|
|
|
|
#include <limits.h>
|
2015-03-27 15:43:28 +00:00
|
|
|
#include <algorithm>
|
2016-03-03 09:53:10 +00:00
|
|
|
#include <memory>
|
2015-12-26 15:54:26 +00:00
|
|
|
#include <string>
|
2015-12-27 06:35:46 +00:00
|
|
|
#include <vector>
|
2016-01-11 12:18:18 +00:00
|
|
|
#include <map>
|
2013-10-25 05:04:16 +00:00
|
|
|
#ifdef HAVE_STDINT_H
|
|
|
|
# include <stdint.h>
|
|
|
|
#endif
|
|
|
|
#ifdef WIN32
|
|
|
|
# include <windows.h> // required by GL headers
|
|
|
|
#endif
|
2015-03-17 16:14:47 +00:00
|
|
|
#ifdef __APPLE__
|
2015-12-27 06:35:46 +00:00
|
|
|
# include <strings.h> // for strcasecmp in file.cpp
|
2015-03-17 16:14:47 +00:00
|
|
|
# include <OpenGL/gl.h>
|
|
|
|
# include <OpenGL/glu.h>
|
|
|
|
#else
|
|
|
|
# include <GL/gl.h>
|
|
|
|
# include <GL/glu.h>
|
|
|
|
#endif
|
2013-10-25 05:04:16 +00:00
|
|
|
|
Rewrite TTF to Bezier conversion using Freetype.
Benefits:
* Much simpler code.
* Handles the entire TTF spec, not just a small subset that
only really worked well on Windows fonts.
* Handles all character sets as well as accented characters.
* Much faster parsing, since Freetype lazily loads and
caches glyphs.
* Support for basically every kind of font that was invented,
not just TTF.
Note that OpenType features, e.g. ligatures, are not yet supported.
This means that Arabic and Devanagari scripts, among others, will
not be rendered in their proper form.
RTL scripts are not supported either, neither in TTF nor in
the text window. Adding RTL support is comparatively easy, but
given that Arabic would not be legibly rendered anyway, this is not
done so far.
2016-01-30 01:42:44 +00:00
|
|
|
// We declare these in advance instead of simply using FT_Library
|
|
|
|
// (defined as typedef FT_LibraryRec_* FT_Library) because including
|
|
|
|
// freetype.h invokes indescribable horrors and we would like to avoid
|
|
|
|
// doing that every time we include solvespace.h.
|
|
|
|
struct FT_LibraryRec_;
|
|
|
|
struct FT_FaceRec_;
|
|
|
|
|
2013-10-21 21:29:25 +00:00
|
|
|
// The few floating-point equality comparisons in SolveSpace have been
|
|
|
|
// carefully considered, so we disable the -Wfloat-equal warning for them
|
|
|
|
#ifdef __clang__
|
|
|
|
# define EXACT(expr) \
|
|
|
|
(_Pragma("clang diagnostic push") \
|
|
|
|
_Pragma("clang diagnostic ignored \"-Wfloat-equal\"") \
|
|
|
|
(expr) \
|
|
|
|
_Pragma("clang diagnostic pop"))
|
|
|
|
#else
|
|
|
|
# define EXACT(expr) (expr)
|
|
|
|
#endif
|
|
|
|
|
2008-03-28 10:00:37 +00:00
|
|
|
// Debugging functions
|
2015-03-17 16:17:51 +00:00
|
|
|
#ifdef NDEBUG
|
2013-09-19 06:35:56 +00:00
|
|
|
#define oops() do { dbp("oops at line %d, file %s\n", __LINE__, __FILE__); \
|
2015-03-17 16:17:51 +00:00
|
|
|
exit(-1); } while(0)
|
|
|
|
#else
|
|
|
|
#define oops() do { dbp("oops at line %d, file %s\n", __LINE__, __FILE__); \
|
|
|
|
abort(); } while(0)
|
|
|
|
#endif
|
2013-10-25 05:04:16 +00:00
|
|
|
|
2013-10-19 05:36:45 +00:00
|
|
|
#ifndef isnan
|
|
|
|
# define isnan(x) (((x) != (x)) || (x > 1e11) || (x < -1e11))
|
|
|
|
#endif
|
2008-06-03 18:28:41 +00:00
|
|
|
|
2015-03-23 17:49:04 +00:00
|
|
|
namespace SolveSpace {
|
|
|
|
|
2015-03-27 15:43:28 +00:00
|
|
|
using std::min;
|
|
|
|
using std::max;
|
|
|
|
using std::swap;
|
|
|
|
|
2015-11-06 08:40:12 +00:00
|
|
|
#if defined(__GNUC__)
|
|
|
|
__attribute__((__format__ (__printf__, 1, 2)))
|
|
|
|
#endif
|
|
|
|
std::string ssprintf(const char *fmt, ...);
|
|
|
|
|
2008-05-26 03:39:45 +00:00
|
|
|
inline int WRAP(int v, int n) {
|
2009-01-03 12:27:33 +00:00
|
|
|
// Clamp it to the range [0, n)
|
2008-05-26 03:39:45 +00:00
|
|
|
while(v >= n) v -= n;
|
|
|
|
while(v < 0) v += n;
|
|
|
|
return v;
|
|
|
|
}
|
2009-01-03 12:27:33 +00:00
|
|
|
inline double WRAP_NOT_0(double v, double n) {
|
|
|
|
// Clamp it to the range (0, n]
|
|
|
|
while(v > n) v -= n;
|
|
|
|
while(v <= 0) v += n;
|
|
|
|
return v;
|
|
|
|
}
|
2009-03-19 17:40:11 +00:00
|
|
|
inline double WRAP_SYMMETRIC(double v, double n) {
|
|
|
|
// Clamp it to the range (-n/2, n/2]
|
|
|
|
while(v > n/2) v -= n;
|
|
|
|
while(v <= -n/2) v += n;
|
|
|
|
return v;
|
|
|
|
}
|
2009-01-03 12:27:33 +00:00
|
|
|
|
2009-10-21 04:46:01 +00:00
|
|
|
// Why is this faster than the library function?
|
|
|
|
inline double ffabs(double v) { return (v > 0) ? v : (-v); }
|
|
|
|
|
2008-05-22 10:28:28 +00:00
|
|
|
#define CO(v) (v).x, (v).y, (v).z
|
|
|
|
|
2015-10-31 08:22:26 +00:00
|
|
|
#define ANGLE_COS_EPS (1e-6)
|
2009-03-08 10:59:57 +00:00
|
|
|
#define LENGTH_EPS (1e-6)
|
2009-01-27 05:48:40 +00:00
|
|
|
#define VERY_POSITIVE (1e10)
|
|
|
|
#define VERY_NEGATIVE (-1e10)
|
2008-05-11 10:40:37 +00:00
|
|
|
|
2008-04-17 06:42:32 +00:00
|
|
|
#define isforname(c) (isalnum(c) || (c) == '_' || (c) == '-' || (c) == '#')
|
|
|
|
|
2015-03-29 00:33:46 +00:00
|
|
|
#if defined(WIN32) && !defined(HAVE_STDINT_H)
|
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 05:45:13 +00:00
|
|
|
// Define some useful C99 integer types.
|
|
|
|
typedef UINT64 uint64_t;
|
|
|
|
typedef INT64 int64_t;
|
|
|
|
typedef UINT32 uint32_t;
|
|
|
|
typedef INT32 int32_t;
|
|
|
|
typedef USHORT uint16_t;
|
|
|
|
typedef SHORT int16_t;
|
|
|
|
typedef UCHAR uint8_t;
|
|
|
|
typedef CHAR int8_t;
|
|
|
|
#endif
|
2008-04-01 10:48:44 +00:00
|
|
|
|
2015-12-27 07:51:28 +00:00
|
|
|
#if defined(WIN32)
|
|
|
|
std::string Narrow(const wchar_t *s);
|
|
|
|
std::wstring Widen(const char *s);
|
|
|
|
std::string Narrow(const std::wstring &s);
|
|
|
|
std::wstring Widen(const std::string &s);
|
|
|
|
#endif
|
|
|
|
|
2009-02-09 12:40:48 +00:00
|
|
|
inline double Random(double vmax) {
|
|
|
|
return (vmax*rand()) / RAND_MAX;
|
|
|
|
}
|
|
|
|
|
2008-04-14 10:28:32 +00:00
|
|
|
class Expr;
|
2008-04-22 13:14:15 +00:00
|
|
|
class ExprVector;
|
2008-05-05 06:18:01 +00:00
|
|
|
class ExprQuaternion;
|
2015-07-10 11:54:39 +00:00
|
|
|
class RgbaColor;
|
2008-04-14 10:28:32 +00:00
|
|
|
|
2008-06-30 09:09:17 +00:00
|
|
|
//================
|
2008-04-14 10:28:32 +00:00
|
|
|
// From the platform-specific code.
|
2015-12-27 06:35:46 +00:00
|
|
|
#if defined(WIN32)
|
|
|
|
#define PATH_SEP "\\"
|
|
|
|
#else
|
|
|
|
#define PATH_SEP "/"
|
|
|
|
#endif
|
|
|
|
|
2015-12-27 08:09:00 +00:00
|
|
|
FILE *ssfopen(const std::string &filename, const char *mode);
|
|
|
|
void ssremove(const std::string &filename);
|
|
|
|
|
2008-05-28 10:10:31 +00:00
|
|
|
#define MAX_RECENT 8
|
|
|
|
#define RECENT_OPEN (0xf000)
|
|
|
|
#define RECENT_IMPORT (0xf100)
|
2015-12-27 01:03:24 +00:00
|
|
|
extern std::string RecentFile[MAX_RECENT];
|
2008-05-28 10:10:31 +00:00
|
|
|
void RefreshRecentMenus(void);
|
|
|
|
|
2016-01-11 12:18:18 +00:00
|
|
|
enum DialogChoice { DIALOG_YES = 1, DIALOG_NO = -1, DIALOG_CANCEL = 0 };
|
|
|
|
DialogChoice SaveFileYesNoCancel(void);
|
|
|
|
DialogChoice LoadAutosaveYesNo(void);
|
|
|
|
DialogChoice LocateImportedFileYesNoCancel(const std::string &filename,
|
|
|
|
bool canCancel);
|
2015-03-29 04:46:57 +00:00
|
|
|
|
|
|
|
#define AUTOSAVE_SUFFIX "~"
|
2013-09-18 20:49:32 +00:00
|
|
|
|
2015-03-24 23:38:06 +00:00
|
|
|
#if defined(HAVE_GTK)
|
2015-03-18 17:02:11 +00:00
|
|
|
// Selection pattern format to be parsed by GTK3 glue code:
|
|
|
|
// "PNG File\t*.png\n"
|
|
|
|
// "JPEG File\t*.jpg\t*.jpeg\n"
|
|
|
|
// "All Files\t*"
|
|
|
|
# define PAT1(desc,e1) desc "\t*." e1 "\n"
|
|
|
|
# define PAT2(desc,e1,e2) desc "\t*." e1 "\t*." e2 "\n"
|
|
|
|
# define ENDPAT "All Files\t*"
|
2015-03-24 06:45:53 +00:00
|
|
|
#elif defined(__APPLE__)
|
|
|
|
// Selection pattern format to be parsed by Cocoa glue code:
|
|
|
|
// "PNG File\tpng\n"
|
|
|
|
// "JPEG file\tjpg,jpeg\n"
|
|
|
|
// "All Files\t*"
|
|
|
|
# define PAT1(desc,e1) desc "\t" e1 "\n"
|
|
|
|
# define PAT2(desc,e1,e2) desc "\t" e1 "," e2 "\n"
|
|
|
|
# define ENDPAT "All Files\t*"
|
2013-10-25 05:04:16 +00:00
|
|
|
#else
|
|
|
|
// Selection pattern format for Win32's OPENFILENAME.lpstrFilter:
|
|
|
|
// "PNG File (*.png)\0*.png\0"
|
|
|
|
// "JPEG File (*.jpg;*.jpeg)\0*.jpg;*.jpeg\0"
|
|
|
|
// "All Files (*)\0*\0\0"
|
|
|
|
# define PAT1(desc,e1) desc " (*." e1 ")\0*." e1 "\0"
|
|
|
|
# define PAT2(desc,e1,e2) desc " (*." e1 ";*." e2 ")\0*." e1 ";*." e2 "\0"
|
|
|
|
# define ENDPAT "All Files (*)\0*\0\0"
|
|
|
|
#endif
|
|
|
|
|
2009-10-12 10:40:48 +00:00
|
|
|
// SolveSpace native file format
|
2013-10-25 05:04:16 +00:00
|
|
|
#define SLVS_PATTERN PAT1("SolveSpace Models", "slvs") ENDPAT
|
2009-10-12 10:40:48 +00:00
|
|
|
// PNG format bitmap
|
2013-10-25 05:04:16 +00:00
|
|
|
#define PNG_PATTERN PAT1("PNG", "png") ENDPAT
|
2009-10-12 10:40:48 +00:00
|
|
|
// Triangle mesh
|
2013-10-25 05:04:16 +00:00
|
|
|
#define MESH_PATTERN \
|
|
|
|
PAT1("STL Mesh", "stl") \
|
|
|
|
PAT1("Wavefront OBJ Mesh", "obj") \
|
2016-01-11 10:53:04 +00:00
|
|
|
PAT1("Three.js-compatible Mesh, with viewer", "html") \
|
|
|
|
PAT1("Three.js-compatible Mesh, mesh only", "js") \
|
2013-10-25 05:04:16 +00:00
|
|
|
ENDPAT
|
2009-10-12 10:40:48 +00:00
|
|
|
// NURBS surfaces
|
2013-10-25 05:04:16 +00:00
|
|
|
#define SRF_PATTERN PAT2("STEP File", "step", "stp") ENDPAT
|
2009-10-12 10:40:48 +00:00
|
|
|
// 2d vector (lines and curves) format
|
2013-10-25 05:04:16 +00:00
|
|
|
#define VEC_PATTERN \
|
|
|
|
PAT1("PDF File", "pdf") \
|
|
|
|
PAT2("Encapsulated PostScript", "eps", "ps") \
|
|
|
|
PAT1("Scalable Vector Graphics", "svg") \
|
|
|
|
PAT2("STEP File", "step", "stp") \
|
2016-01-05 08:11:40 +00:00
|
|
|
PAT1("DXF File (AutoCAD 2007)", "dxf") \
|
2013-10-25 05:04:16 +00:00
|
|
|
PAT2("HPGL File", "plt", "hpgl") \
|
|
|
|
PAT1("G Code", "txt") \
|
|
|
|
ENDPAT
|
2009-10-12 10:40:48 +00:00
|
|
|
// 3d vector (wireframe lines and curves) format
|
2013-10-25 05:04:16 +00:00
|
|
|
#define V3D_PATTERN \
|
|
|
|
PAT2("STEP File", "step", "stp") \
|
2016-01-05 08:11:40 +00:00
|
|
|
PAT1("DXF File (AutoCAD 2007)", "dxf") \
|
2013-10-25 05:04:16 +00:00
|
|
|
ENDPAT
|
2009-10-12 10:40:48 +00:00
|
|
|
// Comma-separated value, like a spreadsheet would use
|
2016-01-11 08:44:56 +00:00
|
|
|
#define CSV_PATTERN \
|
|
|
|
PAT1("CSV File", "csv") \
|
|
|
|
ENDPAT
|
|
|
|
|
2016-01-11 08:23:51 +00:00
|
|
|
bool GetSaveFile(std::string &filename, const std::string &defExtension,
|
|
|
|
const char *selPattern);
|
|
|
|
bool GetOpenFile(std::string &filename, const std::string &defExtension,
|
|
|
|
const char *selPattern);
|
Rewrite TTF to Bezier conversion using Freetype.
Benefits:
* Much simpler code.
* Handles the entire TTF spec, not just a small subset that
only really worked well on Windows fonts.
* Handles all character sets as well as accented characters.
* Much faster parsing, since Freetype lazily loads and
caches glyphs.
* Support for basically every kind of font that was invented,
not just TTF.
Note that OpenType features, e.g. ligatures, are not yet supported.
This means that Arabic and Devanagari scripts, among others, will
not be rendered in their proper form.
RTL scripts are not supported either, neither in TTF nor in
the text window. Adding RTL support is comparatively easy, but
given that Arabic would not be legibly rendered anyway, this is not
done so far.
2016-01-30 01:42:44 +00:00
|
|
|
std::vector<std::string> GetFontFiles();
|
2008-04-18 11:11:48 +00:00
|
|
|
|
2013-08-26 18:58:35 +00:00
|
|
|
void OpenWebsite(const char *url);
|
2008-02-09 13:52:01 +00:00
|
|
|
|
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 05:45:13 +00:00
|
|
|
void CheckMenuById(int id, bool checked);
|
|
|
|
void RadioMenuById(int id, bool selected);
|
|
|
|
void EnableMenuById(int id, bool enabled);
|
2008-04-18 11:11:48 +00:00
|
|
|
|
2015-11-06 08:40:12 +00:00
|
|
|
void ShowGraphicsEditControl(int x, int y, const std::string &str);
|
2008-04-21 10:12:04 +00:00
|
|
|
void HideGraphicsEditControl(void);
|
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 05:45:13 +00:00
|
|
|
bool GraphicsEditControlIsVisible(void);
|
2015-11-06 08:40:12 +00:00
|
|
|
void ShowTextEditControl(int x, int y, const std::string &str);
|
2008-05-27 06:36:59 +00:00
|
|
|
void HideTextEditControl(void);
|
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 05:45:13 +00:00
|
|
|
bool TextEditControlIsVisible(void);
|
2010-04-26 07:52:49 +00:00
|
|
|
void MoveTextScrollbarTo(int pos, int maxPos, int page);
|
2008-04-21 10:12:04 +00:00
|
|
|
|
2009-09-23 10:59:59 +00:00
|
|
|
#define CONTEXT_SUBMENU (-1)
|
|
|
|
#define CONTEXT_SEPARATOR (-2)
|
2013-08-26 18:58:35 +00:00
|
|
|
void AddContextMenuItem(const char *legend, int id);
|
2009-09-23 10:59:59 +00:00
|
|
|
void CreateContextSubmenu(void);
|
|
|
|
int ShowContextMenu(void);
|
|
|
|
|
2013-10-25 05:04:16 +00:00
|
|
|
void ToggleMenuBar(void);
|
|
|
|
bool MenuBarIsVisible(void);
|
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 05:45:13 +00:00
|
|
|
void ShowTextWindow(bool visible);
|
2008-04-14 10:28:32 +00:00
|
|
|
void InvalidateText(void);
|
2008-04-27 05:00:12 +00:00
|
|
|
void InvalidateGraphics(void);
|
2008-04-18 11:11:48 +00:00
|
|
|
void PaintGraphics(void);
|
2013-10-25 05:04:16 +00:00
|
|
|
void ToggleFullScreen(void);
|
|
|
|
bool FullScreenIsActive(void);
|
2008-06-12 07:31:41 +00:00
|
|
|
void GetGraphicsWindowSize(int *w, int *h);
|
2010-05-03 05:04:42 +00:00
|
|
|
void GetTextWindowSize(int *w, int *h);
|
2013-10-28 04:28:39 +00:00
|
|
|
int64_t GetMilliseconds(void);
|
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 05:45:13 +00:00
|
|
|
int64_t GetUnixTime(void);
|
2008-04-18 11:11:48 +00:00
|
|
|
|
2013-08-26 18:58:35 +00:00
|
|
|
void dbp(const char *str, ...);
|
2008-05-30 07:32:30 +00:00
|
|
|
#define DBPTRI(tri) \
|
|
|
|
dbp("tri: (%.3f %.3f %.3f) (%.3f %.3f %.3f) (%.3f %.3f %.3f)", \
|
|
|
|
CO((tri).a), CO((tri).b), CO((tri).c))
|
|
|
|
|
2015-12-27 01:03:24 +00:00
|
|
|
void SetCurrentFilename(const std::string &filename);
|
2010-04-26 07:52:49 +00:00
|
|
|
void SetMousePointerToHand(bool yes);
|
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 05:45:13 +00:00
|
|
|
void DoMessageBox(const char *str, int rows, int cols, bool error);
|
2009-01-02 10:38:36 +00:00
|
|
|
void SetTimerFor(int milliseconds);
|
2015-03-29 04:46:57 +00:00
|
|
|
void SetAutosaveTimerFor(int minutes);
|
2015-03-18 17:02:11 +00:00
|
|
|
void ScheduleLater();
|
2008-06-03 18:48:47 +00:00
|
|
|
void ExitNow(void);
|
2008-07-08 08:02:22 +00:00
|
|
|
|
2015-12-26 15:54:26 +00:00
|
|
|
void CnfFreezeInt(uint32_t val, const std::string &name);
|
|
|
|
void CnfFreezeFloat(float val, const std::string &name);
|
|
|
|
void CnfFreezeString(const std::string &val, const std::string &name);
|
|
|
|
std::string CnfThawString(const std::string &val, const std::string &name);
|
|
|
|
uint32_t CnfThawInt(uint32_t val, const std::string &name);
|
|
|
|
float CnfThawFloat(float val, const std::string &name);
|
2008-04-18 11:11:48 +00:00
|
|
|
|
2013-08-26 20:40:25 +00:00
|
|
|
void *AllocTemporary(size_t n);
|
2008-07-13 12:58:52 +00:00
|
|
|
void FreeTemporary(void *p);
|
2008-04-25 10:11:29 +00:00
|
|
|
void FreeAllTemporary(void);
|
2013-08-26 20:40:25 +00:00
|
|
|
void *MemAlloc(size_t n);
|
2008-04-18 07:06:37 +00:00
|
|
|
void MemFree(void *p);
|
2009-04-20 07:30:09 +00:00
|
|
|
void InitHeaps(void);
|
2008-06-30 09:09:17 +00:00
|
|
|
void vl(void); // debug function to validate heaps
|
|
|
|
|
|
|
|
// End of platform-specific functions
|
|
|
|
//================
|
2008-04-14 10:28:32 +00:00
|
|
|
|
2009-05-24 11:37:07 +00:00
|
|
|
class Group;
|
2009-02-27 14:05:08 +00:00
|
|
|
class SSurface;
|
2008-03-25 10:02:13 +00:00
|
|
|
#include "dsc.h"
|
2008-04-23 07:29:19 +00:00
|
|
|
#include "polygon.h"
|
2009-01-15 03:55:42 +00:00
|
|
|
#include "srf/surface.h"
|
2008-05-29 10:10:12 +00:00
|
|
|
|
|
|
|
class Entity;
|
|
|
|
class hEntity;
|
2008-06-23 08:25:17 +00:00
|
|
|
class Param;
|
|
|
|
class hParam;
|
2008-05-29 10:10:12 +00:00
|
|
|
typedef IdList<Entity,hEntity> EntityList;
|
2008-06-23 08:25:17 +00:00
|
|
|
typedef IdList<Param,hParam> ParamList;
|
2008-05-29 10:10:12 +00:00
|
|
|
|
2008-03-26 09:18:12 +00:00
|
|
|
#include "sketch.h"
|
2008-04-12 14:12:26 +00:00
|
|
|
#include "ui.h"
|
2008-04-08 12:54:53 +00:00
|
|
|
#include "expr.h"
|
2008-03-25 10:02:13 +00:00
|
|
|
|
2008-03-27 09:53:51 +00:00
|
|
|
|
2008-04-11 11:13:47 +00:00
|
|
|
// Utility functions that are provided in the platform-independent code.
|
2016-02-14 20:13:40 +00:00
|
|
|
class utf8_iterator : std::iterator<std::forward_iterator_tag, char32_t> {
|
|
|
|
const char *p, *n;
|
|
|
|
public:
|
|
|
|
utf8_iterator(const char *p) : p(p), n(NULL) {}
|
|
|
|
bool operator==(const utf8_iterator &i) const { return p==i.p; }
|
|
|
|
bool operator!=(const utf8_iterator &i) const { return p!=i.p; }
|
|
|
|
ptrdiff_t operator- (const utf8_iterator &i) const { return p -i.p; }
|
|
|
|
utf8_iterator& operator++() { **this; p=n; n=NULL; return *this; }
|
|
|
|
utf8_iterator operator++(int) { utf8_iterator t(*this); operator++(); return t; }
|
|
|
|
char32_t operator*();
|
|
|
|
};
|
|
|
|
class ReadUTF8 {
|
|
|
|
const std::string &str;
|
|
|
|
public:
|
|
|
|
ReadUTF8(const std::string &str) : str(str) {}
|
|
|
|
utf8_iterator begin() const { return utf8_iterator(&str[0]); }
|
|
|
|
utf8_iterator end() const { return utf8_iterator(&str[str.length()]); }
|
|
|
|
};
|
|
|
|
|
2015-03-22 13:39:12 +00:00
|
|
|
void ssglLineWidth(GLfloat width);
|
2013-10-22 04:45:06 +00:00
|
|
|
void ssglVertex3v(Vector u);
|
|
|
|
void ssglAxisAlignedQuad(double l, double r, double t, double b, bool lone = true);
|
|
|
|
void ssglAxisAlignedLineLoop(double l, double r, double t, double b);
|
2013-10-25 05:04:16 +00:00
|
|
|
#ifdef WIN32
|
|
|
|
# define SSGL_CALLBACK __stdcall
|
|
|
|
#else
|
|
|
|
# define SSGL_CALLBACK
|
|
|
|
#endif
|
|
|
|
extern "C" { typedef void SSGL_CALLBACK ssglCallbackFptr(void); }
|
2013-10-22 04:45:06 +00:00
|
|
|
void ssglTesselatePolygon(GLUtesselator *gt, SPolygon *p);
|
|
|
|
void ssglFillPolygon(SPolygon *p);
|
2015-07-10 11:54:39 +00:00
|
|
|
void ssglFillMesh(bool useSpecColor, RgbaColor color,
|
2015-03-26 10:30:12 +00:00
|
|
|
SMesh *m, uint32_t h, uint32_t s1, uint32_t s2);
|
2013-10-22 04:45:06 +00:00
|
|
|
void ssglDebugPolygon(SPolygon *p);
|
|
|
|
void ssglDrawEdges(SEdgeList *l, bool endpointsToo);
|
|
|
|
void ssglDebugMesh(SMesh *m);
|
|
|
|
void ssglMarkPolygonNormal(SPolygon *p);
|
|
|
|
typedef void ssglLineFn(void *data, Vector a, Vector b);
|
2016-02-05 09:28:29 +00:00
|
|
|
void ssglWriteText(const std::string &str, double h, Vector t, Vector u, Vector v,
|
2013-10-22 04:45:06 +00:00
|
|
|
ssglLineFn *fn, void *fndata);
|
2016-02-05 09:28:29 +00:00
|
|
|
void ssglWriteTextRefCenter(const std::string &str, double h, Vector t, Vector u, Vector v,
|
2013-10-22 04:45:06 +00:00
|
|
|
ssglLineFn *fn, void *fndata);
|
2016-02-05 09:28:29 +00:00
|
|
|
double ssglStrWidth(const std::string &str, double h);
|
2013-10-22 04:45:06 +00:00
|
|
|
double ssglStrHeight(double h);
|
2015-07-10 11:54:39 +00:00
|
|
|
void ssglLockColorTo(RgbaColor rgb);
|
2016-02-23 18:00:39 +00:00
|
|
|
void ssglStippledLine(Vector a, Vector b, double width,
|
2016-03-25 08:05:50 +00:00
|
|
|
int stippleType, double stippleScale, bool maybeFat);
|
2016-02-23 18:00:39 +00:00
|
|
|
void ssglStippledLine(Vector a, Vector b, double width,
|
2016-03-25 08:05:50 +00:00
|
|
|
const char *stipplePattern, double stippleScale, bool maybeFat);
|
2013-10-22 04:45:06 +00:00
|
|
|
void ssglFatLine(Vector a, Vector b, double width);
|
|
|
|
void ssglUnlockColor(void);
|
2015-07-10 11:54:39 +00:00
|
|
|
void ssglColorRGB(RgbaColor rgb);
|
|
|
|
void ssglColorRGBa(RgbaColor rgb, double a);
|
2013-10-22 04:45:06 +00:00
|
|
|
void ssglDepthRangeOffset(int units);
|
|
|
|
void ssglDepthRangeLockToFront(bool yes);
|
|
|
|
void ssglDrawPixelsWithTexture(uint8_t *data, int w, int h);
|
2015-11-05 19:39:27 +00:00
|
|
|
void ssglInitializeBitmapFont();
|
2016-02-14 20:13:40 +00:00
|
|
|
void ssglBitmapText(const std::string &str, Vector p);
|
2015-11-05 19:39:27 +00:00
|
|
|
void ssglBitmapCharQuad(char32_t chr, double x, double y);
|
|
|
|
int ssglBitmapCharWidth(char32_t chr);
|
2010-04-26 07:52:49 +00:00
|
|
|
#define TEXTURE_BACKGROUND_IMG 10
|
2015-11-05 19:39:27 +00:00
|
|
|
#define TEXTURE_DRAW_PIXELS 20
|
|
|
|
#define TEXTURE_COLOR_PICKER_2D 30
|
|
|
|
#define TEXTURE_COLOR_PICKER_1D 40
|
|
|
|
#define TEXTURE_BITMAP_FONT 50
|
2008-03-27 09:53:51 +00:00
|
|
|
|
2008-03-25 10:02:13 +00:00
|
|
|
|
2008-03-26 09:18:12 +00:00
|
|
|
#define arraylen(x) (sizeof((x))/sizeof((x)[0]))
|
2008-03-27 09:53:51 +00:00
|
|
|
#define PI (3.1415926535897931)
|
|
|
|
void MakeMatrix(double *mat, double a11, double a12, double a13, double a14,
|
|
|
|
double a21, double a22, double a23, double a24,
|
|
|
|
double a31, double a32, double a33, double a34,
|
|
|
|
double a41, double a42, double a43, double a44);
|
2013-09-20 19:01:00 +00:00
|
|
|
bool MakeAcceleratorLabel(int accel, char *out);
|
2015-12-27 01:03:24 +00:00
|
|
|
bool FilenameHasExtension(const std::string &str, const char *ext);
|
2013-08-26 18:58:35 +00:00
|
|
|
void Message(const char *str, ...);
|
|
|
|
void Error(const char *str, ...);
|
2015-12-26 15:54:26 +00:00
|
|
|
void CnfFreezeBool(bool v, const std::string &name);
|
|
|
|
void CnfFreezeColor(RgbaColor v, const std::string &name);
|
|
|
|
bool CnfThawBool(bool v, const std::string &name);
|
|
|
|
RgbaColor CnfThawColor(RgbaColor v, const std::string &name);
|
2008-03-27 09:53:51 +00:00
|
|
|
|
2008-04-20 11:35:10 +00:00
|
|
|
class System {
|
|
|
|
public:
|
2013-09-09 19:50:32 +00:00
|
|
|
enum { MAX_UNKNOWNS = 1024 };
|
2008-04-20 11:35:10 +00:00
|
|
|
|
2008-06-23 08:25:17 +00:00
|
|
|
EntityList entity;
|
|
|
|
ParamList param;
|
2008-04-20 11:35:10 +00:00
|
|
|
IdList<Equation,hEquation> eq;
|
|
|
|
|
2009-04-20 07:30:09 +00:00
|
|
|
// A list of parameters that are being dragged; these are the ones that
|
|
|
|
// we should put as close as possible to their initial positions.
|
2009-11-03 18:54:49 +00:00
|
|
|
List<hParam> dragged;
|
2009-04-20 07:30:09 +00:00
|
|
|
|
2013-09-09 19:50:32 +00:00
|
|
|
enum {
|
|
|
|
// In general, the tag indicates the subsys that a variable/equation
|
|
|
|
// has been assigned to; these are exceptions for variables:
|
|
|
|
VAR_SUBSTITUTED = 10000,
|
|
|
|
VAR_DOF_TEST = 10001,
|
|
|
|
// and for equations:
|
|
|
|
EQ_SUBSTITUTED = 20000
|
|
|
|
};
|
2008-04-20 11:35:10 +00:00
|
|
|
|
2008-04-21 01:26:36 +00:00
|
|
|
// The system Jacobian matrix
|
2008-04-20 11:35:10 +00:00
|
|
|
struct {
|
2008-04-21 01:26:36 +00:00
|
|
|
// The corresponding equation for each row
|
|
|
|
hEquation eq[MAX_UNKNOWNS];
|
2008-04-20 11:35:10 +00:00
|
|
|
|
2008-04-21 01:26:36 +00:00
|
|
|
// The corresponding parameter for each column
|
|
|
|
hParam param[MAX_UNKNOWNS];
|
2008-05-01 06:25:38 +00:00
|
|
|
|
2008-04-21 01:26:36 +00:00
|
|
|
// We're solving AX = B
|
2008-04-20 11:35:10 +00:00
|
|
|
int m, n;
|
2008-04-21 01:26:36 +00:00
|
|
|
struct {
|
|
|
|
Expr *sym[MAX_UNKNOWNS][MAX_UNKNOWNS];
|
|
|
|
double num[MAX_UNKNOWNS][MAX_UNKNOWNS];
|
|
|
|
} A;
|
2008-05-01 06:25:38 +00:00
|
|
|
|
2008-05-13 02:35:31 +00:00
|
|
|
double scale[MAX_UNKNOWNS];
|
|
|
|
|
2008-05-12 07:29:50 +00:00
|
|
|
// Some helpers for the least squares solve
|
|
|
|
double AAt[MAX_UNKNOWNS][MAX_UNKNOWNS];
|
|
|
|
double Z[MAX_UNKNOWNS];
|
|
|
|
|
2008-04-21 01:26:36 +00:00
|
|
|
double X[MAX_UNKNOWNS];
|
2008-05-01 06:25:38 +00:00
|
|
|
|
2008-04-21 01:26:36 +00:00
|
|
|
struct {
|
|
|
|
Expr *sym[MAX_UNKNOWNS];
|
|
|
|
double num[MAX_UNKNOWNS];
|
|
|
|
} B;
|
|
|
|
} mat;
|
2008-04-20 11:35:10 +00:00
|
|
|
|
2008-09-05 11:25:53 +00:00
|
|
|
static const double RANK_MAG_TOLERANCE, CONVERGE_TOLERANCE;
|
2008-07-02 08:18:25 +00:00
|
|
|
int CalculateRank(void);
|
Distinguish overconstrained and redundantly constrained sketches.
When a solver error arises after a change to the sketch, it should
be easy to understand exactly why it happened. Before this change,
two functionally distinct modes of failure were lumped into one:
the same "redundant constraints" message was displayed when all
degrees of freedom were exhausted and the had a solution, but also
when it had not.
To understand why this is problematic, let's examine several ways
in which we can end up with linearly dependent equations in our
system:
0) create a triangle, then constrain two different pairs of edges
to be perpendicular
1) add two distinct distance constraints on the same segment
2) add two identical distance constraints on the same segment
3) create a triangle, then constrain edges to lengths a, b, and c
so that a+b=c
The case (0) is our baseline case: the constraints in it make
the system unsolvable yet they do not remove more degrees of freedom
than the amount we started with. So the displayed error is
"unsolvable constraints".
The constraints in case (1) remove one too many degrees of freedom,
but otherwise are quite like the case (0): the cause of failure that
is useful to the user is that the constraints are mutually
incompatible.
The constraints in cases (2) and (3) however are not like the others:
there is a set of parameters that satisfies all of the constraints,
but the constraints still remove one degree of freedom too many.
It makes sense to display a different error message for cases (2)
and (3) because in practice, cases like this are likely to arise from
adjustment of constraint values on sketches corresponding to systems
that have a small amount of degenerate solutions, and this is very
different from systems arising in cases like (0) where no adjustment
of constraint values will ever result in a successful solution.
So the error message displayed is "redundant constraints".
At last, this commit makes cases (0) and (1) display a message
with only a minor difference in wording. This is deliberate.
The reason is that the facts "the system is unsolvable" and
"the system is unsolvable and also has linearly dependent equations"
present no meaningful, actionable difference to the user, and placing
emphasis on it would only cause confusion.
However, they are still distinguished, because in case (0) we
list all relevant constraints (and thus we say they are "mutually
incompatible") but in case (1) we only list the ones that constrain
the sketch further than some valid solution (and we say they are
"unsatisfied").
2016-01-21 09:28:05 +00:00
|
|
|
bool TestRank(void);
|
2008-05-12 07:29:50 +00:00
|
|
|
static bool SolveLinearSystem(double X[], double A[][MAX_UNKNOWNS],
|
|
|
|
double B[], int N);
|
|
|
|
bool SolveLeastSquares(void);
|
2008-04-20 11:35:10 +00:00
|
|
|
|
2009-04-19 20:37:51 +00:00
|
|
|
bool WriteJacobian(int tag);
|
2008-04-20 11:35:10 +00:00
|
|
|
void EvalJacobian(void);
|
|
|
|
|
2009-04-20 07:30:09 +00:00
|
|
|
void WriteEquationsExceptFor(hConstraint hc, Group *g);
|
|
|
|
void FindWhichToRemoveToFixJacobian(Group *g, List<hConstraint> *bad);
|
2008-05-07 07:10:20 +00:00
|
|
|
void SolveBySubstitution(void);
|
|
|
|
|
2009-04-20 07:30:09 +00:00
|
|
|
bool IsDragged(hParam p);
|
2008-05-01 06:25:38 +00:00
|
|
|
|
2008-04-20 11:35:10 +00:00
|
|
|
bool NewtonSolve(int tag);
|
2009-04-20 07:30:09 +00:00
|
|
|
|
2013-09-09 19:50:32 +00:00
|
|
|
enum {
|
Distinguish overconstrained and redundantly constrained sketches.
When a solver error arises after a change to the sketch, it should
be easy to understand exactly why it happened. Before this change,
two functionally distinct modes of failure were lumped into one:
the same "redundant constraints" message was displayed when all
degrees of freedom were exhausted and the had a solution, but also
when it had not.
To understand why this is problematic, let's examine several ways
in which we can end up with linearly dependent equations in our
system:
0) create a triangle, then constrain two different pairs of edges
to be perpendicular
1) add two distinct distance constraints on the same segment
2) add two identical distance constraints on the same segment
3) create a triangle, then constrain edges to lengths a, b, and c
so that a+b=c
The case (0) is our baseline case: the constraints in it make
the system unsolvable yet they do not remove more degrees of freedom
than the amount we started with. So the displayed error is
"unsolvable constraints".
The constraints in case (1) remove one too many degrees of freedom,
but otherwise are quite like the case (0): the cause of failure that
is useful to the user is that the constraints are mutually
incompatible.
The constraints in cases (2) and (3) however are not like the others:
there is a set of parameters that satisfies all of the constraints,
but the constraints still remove one degree of freedom too many.
It makes sense to display a different error message for cases (2)
and (3) because in practice, cases like this are likely to arise from
adjustment of constraint values on sketches corresponding to systems
that have a small amount of degenerate solutions, and this is very
different from systems arising in cases like (0) where no adjustment
of constraint values will ever result in a successful solution.
So the error message displayed is "redundant constraints".
At last, this commit makes cases (0) and (1) display a message
with only a minor difference in wording. This is deliberate.
The reason is that the facts "the system is unsolvable" and
"the system is unsolvable and also has linearly dependent equations"
present no meaningful, actionable difference to the user, and placing
emphasis on it would only cause confusion.
However, they are still distinguished, because in case (0) we
list all relevant constraints (and thus we say they are "mutually
incompatible") but in case (1) we only list the ones that constrain
the sketch further than some valid solution (and we say they are
"unsatisfied").
2016-01-21 09:28:05 +00:00
|
|
|
SOLVED_OKAY = 0,
|
|
|
|
DIDNT_CONVERGE = 10,
|
|
|
|
REDUNDANT_OKAY = 11,
|
|
|
|
REDUNDANT_DIDNT_CONVERGE = 12,
|
|
|
|
TOO_MANY_UNKNOWNS = 20
|
2013-09-09 19:50:32 +00:00
|
|
|
};
|
2009-04-21 07:56:17 +00:00
|
|
|
int Solve(Group *g, int *dof, List<hConstraint> *bad,
|
|
|
|
bool andFindBad, bool andFindFree);
|
2013-09-19 04:33:12 +00:00
|
|
|
|
|
|
|
void Clear(void);
|
2008-04-20 11:35:10 +00:00
|
|
|
};
|
|
|
|
|
Rewrite TTF to Bezier conversion using Freetype.
Benefits:
* Much simpler code.
* Handles the entire TTF spec, not just a small subset that
only really worked well on Windows fonts.
* Handles all character sets as well as accented characters.
* Much faster parsing, since Freetype lazily loads and
caches glyphs.
* Support for basically every kind of font that was invented,
not just TTF.
Note that OpenType features, e.g. ligatures, are not yet supported.
This means that Arabic and Devanagari scripts, among others, will
not be rendered in their proper form.
RTL scripts are not supported either, neither in TTF nor in
the text window. Adding RTL support is comparatively easy, but
given that Arabic would not be legibly rendered anyway, this is not
done so far.
2016-01-30 01:42:44 +00:00
|
|
|
#include "ttf.h"
|
2008-03-26 09:18:12 +00:00
|
|
|
|
2009-06-11 05:57:23 +00:00
|
|
|
class StepFileWriter {
|
|
|
|
public:
|
2015-12-27 01:03:24 +00:00
|
|
|
void ExportSurfacesTo(const std::string &filename);
|
2009-06-11 05:57:23 +00:00
|
|
|
void WriteHeader(void);
|
2015-02-08 16:43:19 +00:00
|
|
|
void WriteProductHeader(void);
|
2009-06-11 05:57:23 +00:00
|
|
|
int ExportCurve(SBezier *sb);
|
|
|
|
int ExportCurveLoop(SBezierLoop *loop, bool inner);
|
2009-10-12 09:28:34 +00:00
|
|
|
void ExportSurface(SSurface *ss, SBezierList *sbl);
|
2009-06-11 05:57:23 +00:00
|
|
|
void WriteWireframe(void);
|
|
|
|
void WriteFooter(void);
|
|
|
|
|
|
|
|
List<int> curves;
|
|
|
|
List<int> advancedFaces;
|
|
|
|
FILE *f;
|
|
|
|
int id;
|
|
|
|
};
|
|
|
|
|
2009-01-14 05:10:42 +00:00
|
|
|
class VectorFileWriter {
|
2016-01-06 12:40:17 +00:00
|
|
|
protected:
|
|
|
|
Vector u, v, n, origin;
|
|
|
|
double cameraTan, scale;
|
|
|
|
|
2009-01-14 05:10:42 +00:00
|
|
|
public:
|
|
|
|
FILE *f;
|
2015-12-25 08:29:08 +00:00
|
|
|
std::string filename;
|
2009-01-27 05:48:40 +00:00
|
|
|
Vector ptMin, ptMax;
|
2009-07-03 20:55:57 +00:00
|
|
|
|
2009-04-15 06:50:06 +00:00
|
|
|
static double MmToPts(double mm);
|
|
|
|
|
2015-12-27 01:03:24 +00:00
|
|
|
static VectorFileWriter *ForFile(const std::string &filename);
|
2009-01-14 05:10:42 +00:00
|
|
|
|
2016-01-06 12:40:17 +00:00
|
|
|
~VectorFileWriter();
|
|
|
|
|
|
|
|
void SetModelviewProjection(const Vector &u, const Vector &v, const Vector &n,
|
|
|
|
const Vector &origin, double cameraTan, double scale);
|
|
|
|
Vector Transform(Vector &pos) const;
|
|
|
|
|
|
|
|
void OutputLinesAndMesh(SBezierLoopSetSet *sblss, SMesh *sm);
|
2009-01-27 05:48:40 +00:00
|
|
|
|
2009-10-30 10:38:34 +00:00
|
|
|
void BezierAsPwl(SBezier *sb);
|
|
|
|
void BezierAsNonrationalCubic(SBezier *sb, int depth=0);
|
2009-09-22 05:46:30 +00:00
|
|
|
|
2016-01-06 12:40:17 +00:00
|
|
|
virtual bool OutputConstraints(IdList<Constraint,hConstraint> *constraint)
|
|
|
|
{ return false; }
|
|
|
|
|
2015-07-10 11:54:39 +00:00
|
|
|
virtual void StartPath( RgbaColor strokeRgb, double lineWidth,
|
2016-04-12 23:57:49 +00:00
|
|
|
bool filled, RgbaColor fillRgb, hStyle hs) = 0;
|
2015-07-10 11:54:39 +00:00
|
|
|
virtual void FinishPath(RgbaColor strokeRgb, double lineWidth,
|
2016-04-12 23:57:49 +00:00
|
|
|
bool filled, RgbaColor fillRgb, hStyle hs) = 0;
|
2009-10-30 10:38:34 +00:00
|
|
|
virtual void Bezier(SBezier *sb) = 0;
|
2009-03-17 16:33:46 +00:00
|
|
|
virtual void Triangle(STriangle *tr) = 0;
|
2009-01-14 05:10:42 +00:00
|
|
|
virtual void StartFile(void) = 0;
|
|
|
|
virtual void FinishAndCloseFile(void) = 0;
|
2010-01-14 05:24:32 +00:00
|
|
|
virtual bool HasCanvasSize(void) = 0;
|
2009-01-14 05:10:42 +00:00
|
|
|
};
|
|
|
|
class DxfFileWriter : public VectorFileWriter {
|
|
|
|
public:
|
2015-12-28 10:50:38 +00:00
|
|
|
struct BezierPath {
|
|
|
|
std::vector<SBezier *> beziers;
|
|
|
|
};
|
|
|
|
|
2016-01-06 12:40:17 +00:00
|
|
|
std::vector<BezierPath> paths;
|
|
|
|
IdList<Constraint,hConstraint> *constraint;
|
|
|
|
|
|
|
|
bool OutputConstraints(IdList<Constraint,hConstraint> *constraint);
|
2015-12-28 10:50:38 +00:00
|
|
|
|
2015-07-10 11:54:39 +00:00
|
|
|
void StartPath( RgbaColor strokeRgb, double lineWidth,
|
2016-04-12 23:57:49 +00:00
|
|
|
bool filled, RgbaColor fillRgb, hStyle hs);
|
2015-07-10 11:54:39 +00:00
|
|
|
void FinishPath(RgbaColor strokeRgb, double lineWidth,
|
2016-04-12 23:57:49 +00:00
|
|
|
bool filled, RgbaColor fillRgb, hStyle hs);
|
2009-03-17 16:33:46 +00:00
|
|
|
void Triangle(STriangle *tr);
|
2009-10-30 10:38:34 +00:00
|
|
|
void Bezier(SBezier *sb);
|
2009-01-27 05:48:40 +00:00
|
|
|
void StartFile(void);
|
|
|
|
void FinishAndCloseFile(void);
|
2010-01-14 05:24:32 +00:00
|
|
|
bool HasCanvasSize(void) { return false; }
|
2016-03-24 13:55:36 +00:00
|
|
|
bool NeedToOutput(Constraint *c);
|
2009-01-27 05:48:40 +00:00
|
|
|
};
|
|
|
|
class EpsFileWriter : public VectorFileWriter {
|
|
|
|
public:
|
2009-10-30 10:38:34 +00:00
|
|
|
Vector prevPt;
|
|
|
|
void MaybeMoveTo(Vector s, Vector f);
|
|
|
|
|
2015-07-10 11:54:39 +00:00
|
|
|
void StartPath( RgbaColor strokeRgb, double lineWidth,
|
2016-04-12 23:57:49 +00:00
|
|
|
bool filled, RgbaColor fillRgb, hStyle hs);
|
2015-07-10 11:54:39 +00:00
|
|
|
void FinishPath(RgbaColor strokeRgb, double lineWidth,
|
2016-04-12 23:57:49 +00:00
|
|
|
bool filled, RgbaColor fillRgb, hStyle hs);
|
2009-04-15 06:50:06 +00:00
|
|
|
void Triangle(STriangle *tr);
|
2009-10-30 10:38:34 +00:00
|
|
|
void Bezier(SBezier *sb);
|
2009-04-15 06:50:06 +00:00
|
|
|
void StartFile(void);
|
|
|
|
void FinishAndCloseFile(void);
|
2010-01-14 05:24:32 +00:00
|
|
|
bool HasCanvasSize(void) { return true; }
|
2009-04-15 06:50:06 +00:00
|
|
|
};
|
|
|
|
class PdfFileWriter : public VectorFileWriter {
|
|
|
|
public:
|
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 05:45:13 +00:00
|
|
|
uint32_t xref[10];
|
|
|
|
uint32_t bodyStart;
|
2009-10-30 10:38:34 +00:00
|
|
|
Vector prevPt;
|
|
|
|
void MaybeMoveTo(Vector s, Vector f);
|
2009-04-15 06:50:06 +00:00
|
|
|
|
2015-07-10 11:54:39 +00:00
|
|
|
void StartPath( RgbaColor strokeRgb, double lineWidth,
|
2016-04-12 23:57:49 +00:00
|
|
|
bool filled, RgbaColor fillRgb, hStyle hs);
|
2015-07-10 11:54:39 +00:00
|
|
|
void FinishPath(RgbaColor strokeRgb, double lineWidth,
|
2016-04-12 23:57:49 +00:00
|
|
|
bool filled, RgbaColor fillRgb, hStyle hs);
|
2009-03-17 16:33:46 +00:00
|
|
|
void Triangle(STriangle *tr);
|
2009-10-30 10:38:34 +00:00
|
|
|
void Bezier(SBezier *sb);
|
2009-01-27 05:48:40 +00:00
|
|
|
void StartFile(void);
|
|
|
|
void FinishAndCloseFile(void);
|
2010-01-14 05:24:32 +00:00
|
|
|
bool HasCanvasSize(void) { return true; }
|
2009-01-27 05:48:40 +00:00
|
|
|
};
|
|
|
|
class SvgFileWriter : public VectorFileWriter {
|
|
|
|
public:
|
2009-10-30 10:38:34 +00:00
|
|
|
Vector prevPt;
|
|
|
|
void MaybeMoveTo(Vector s, Vector f);
|
|
|
|
|
2015-07-10 11:54:39 +00:00
|
|
|
void StartPath( RgbaColor strokeRgb, double lineWidth,
|
2016-04-12 23:57:49 +00:00
|
|
|
bool filled, RgbaColor fillRgb, hStyle hs);
|
2015-07-10 11:54:39 +00:00
|
|
|
void FinishPath(RgbaColor strokeRgb, double lineWidth,
|
2016-04-12 23:57:49 +00:00
|
|
|
bool filled, RgbaColor fillRgb, hStyle hs);
|
2009-03-17 16:33:46 +00:00
|
|
|
void Triangle(STriangle *tr);
|
2009-10-30 10:38:34 +00:00
|
|
|
void Bezier(SBezier *sb);
|
2009-01-27 05:48:40 +00:00
|
|
|
void StartFile(void);
|
|
|
|
void FinishAndCloseFile(void);
|
2010-01-14 05:24:32 +00:00
|
|
|
bool HasCanvasSize(void) { return true; }
|
2009-01-27 05:48:40 +00:00
|
|
|
};
|
|
|
|
class HpglFileWriter : public VectorFileWriter {
|
|
|
|
public:
|
|
|
|
static double MmToHpglUnits(double mm);
|
2015-07-10 11:54:39 +00:00
|
|
|
void StartPath( RgbaColor strokeRgb, double lineWidth,
|
2016-04-12 23:57:49 +00:00
|
|
|
bool filled, RgbaColor fillRgb, hStyle hs);
|
2015-07-10 11:54:39 +00:00
|
|
|
void FinishPath(RgbaColor strokeRgb, double lineWidth,
|
2016-04-12 23:57:49 +00:00
|
|
|
bool filled, RgbaColor fillRgb, hStyle hs);
|
2009-03-17 16:33:46 +00:00
|
|
|
void Triangle(STriangle *tr);
|
2009-10-30 10:38:34 +00:00
|
|
|
void Bezier(SBezier *sb);
|
2009-01-14 05:10:42 +00:00
|
|
|
void StartFile(void);
|
|
|
|
void FinishAndCloseFile(void);
|
2010-01-14 05:24:32 +00:00
|
|
|
bool HasCanvasSize(void) { return false; }
|
2009-01-14 05:10:42 +00:00
|
|
|
};
|
2009-06-11 05:57:23 +00:00
|
|
|
class Step2dFileWriter : public VectorFileWriter {
|
|
|
|
StepFileWriter sfw;
|
2015-07-10 11:54:39 +00:00
|
|
|
void StartPath( RgbaColor strokeRgb, double lineWidth,
|
2016-04-12 23:57:49 +00:00
|
|
|
bool filled, RgbaColor fillRgb, hStyle hs);
|
2015-07-10 11:54:39 +00:00
|
|
|
void FinishPath(RgbaColor strokeRgb, double lineWidth,
|
2016-04-12 23:57:49 +00:00
|
|
|
bool filled, RgbaColor fillRgb, hStyle hs);
|
2009-06-11 05:57:23 +00:00
|
|
|
void Triangle(STriangle *tr);
|
2009-10-30 10:38:34 +00:00
|
|
|
void Bezier(SBezier *sb);
|
2009-06-11 05:57:23 +00:00
|
|
|
void StartFile(void);
|
|
|
|
void FinishAndCloseFile(void);
|
2010-01-14 05:24:32 +00:00
|
|
|
bool HasCanvasSize(void) { return false; }
|
2009-06-08 06:50:16 +00:00
|
|
|
};
|
2010-01-14 04:47:17 +00:00
|
|
|
class GCodeFileWriter : public VectorFileWriter {
|
|
|
|
public:
|
|
|
|
SEdgeList sel;
|
2015-07-10 11:54:39 +00:00
|
|
|
void StartPath( RgbaColor strokeRgb, double lineWidth,
|
2016-04-12 23:57:49 +00:00
|
|
|
bool filled, RgbaColor fillRgb, hStyle hs);
|
2015-07-10 11:54:39 +00:00
|
|
|
void FinishPath(RgbaColor strokeRgb, double lineWidth,
|
2016-04-12 23:57:49 +00:00
|
|
|
bool filled, RgbaColor fillRgb, hStyle hs);
|
2010-01-14 04:47:17 +00:00
|
|
|
void Triangle(STriangle *tr);
|
|
|
|
void Bezier(SBezier *sb);
|
|
|
|
void StartFile(void);
|
|
|
|
void FinishAndCloseFile(void);
|
2010-01-14 05:24:32 +00:00
|
|
|
bool HasCanvasSize(void) { return false; }
|
2010-01-14 04:47:17 +00:00
|
|
|
};
|
2009-06-08 06:50:16 +00:00
|
|
|
|
2009-04-20 07:30:09 +00:00
|
|
|
#ifdef LIBRARY
|
|
|
|
# define ENTITY EntityBase
|
|
|
|
# define CONSTRAINT ConstraintBase
|
|
|
|
#else
|
|
|
|
# define ENTITY Entity
|
|
|
|
# define CONSTRAINT Constraint
|
|
|
|
#endif
|
2009-04-19 05:53:16 +00:00
|
|
|
class Sketch {
|
2008-03-28 10:00:37 +00:00
|
|
|
public:
|
2009-04-19 05:53:16 +00:00
|
|
|
// These are user-editable, and define the sketch.
|
2008-04-14 10:28:32 +00:00
|
|
|
IdList<Group,hGroup> group;
|
2016-02-17 10:03:07 +00:00
|
|
|
List<hGroup> groupOrder;
|
2009-04-20 07:30:09 +00:00
|
|
|
IdList<CONSTRAINT,hConstraint> constraint;
|
2009-04-19 05:53:16 +00:00
|
|
|
IdList<Request,hRequest> request;
|
2009-09-17 07:32:36 +00:00
|
|
|
IdList<Style,hStyle> style;
|
2008-04-14 10:28:32 +00:00
|
|
|
|
2009-04-19 05:53:16 +00:00
|
|
|
// These are generated from the above.
|
2009-04-20 07:30:09 +00:00
|
|
|
IdList<ENTITY,hEntity> entity;
|
2008-04-14 10:28:32 +00:00
|
|
|
IdList<Param,hParam> param;
|
|
|
|
|
2009-04-20 07:30:09 +00:00
|
|
|
inline CONSTRAINT *GetConstraint(hConstraint h)
|
2008-04-14 10:28:32 +00:00
|
|
|
{ return constraint.FindById(h); }
|
2009-04-20 07:30:09 +00:00
|
|
|
inline ENTITY *GetEntity (hEntity h) { return entity. FindById(h); }
|
2008-04-14 10:28:32 +00:00
|
|
|
inline Param *GetParam (hParam h) { return param. FindById(h); }
|
2009-04-19 05:53:16 +00:00
|
|
|
inline Request *GetRequest(hRequest h) { return request.FindById(h); }
|
2008-04-20 11:35:10 +00:00
|
|
|
inline Group *GetGroup (hGroup h) { return group. FindById(h); }
|
2009-09-17 07:32:36 +00:00
|
|
|
// Styles are handled a bit differently.
|
2013-09-19 04:33:12 +00:00
|
|
|
|
|
|
|
void Clear(void);
|
2016-01-23 08:05:02 +00:00
|
|
|
|
|
|
|
BBox CalculateEntityBBox(bool includingInvisible);
|
2016-04-10 11:25:26 +00:00
|
|
|
Group *GetRunningMeshGroupFor(hGroup h);
|
2009-04-19 05:53:16 +00:00
|
|
|
};
|
2009-09-17 07:32:36 +00:00
|
|
|
#undef ENTITY
|
|
|
|
#undef CONSTRAINT
|
2009-04-19 05:53:16 +00:00
|
|
|
|
2015-03-23 17:49:04 +00:00
|
|
|
class SolveSpaceUI {
|
2009-04-19 05:53:16 +00:00
|
|
|
public:
|
|
|
|
TextWindow TW;
|
|
|
|
GraphicsWindow GW;
|
2008-04-13 14:28:35 +00:00
|
|
|
|
2008-06-04 10:22:30 +00:00
|
|
|
// The state for undo/redo
|
|
|
|
typedef struct {
|
|
|
|
IdList<Group,hGroup> group;
|
2016-02-17 10:03:07 +00:00
|
|
|
List<hGroup> groupOrder;
|
2008-06-04 10:22:30 +00:00
|
|
|
IdList<Request,hRequest> request;
|
|
|
|
IdList<Constraint,hConstraint> constraint;
|
|
|
|
IdList<Param,hParam> param;
|
2009-09-17 07:32:36 +00:00
|
|
|
IdList<Style,hStyle> style;
|
2008-06-04 10:22:30 +00:00
|
|
|
hGroup activeGroup;
|
2013-09-19 04:33:12 +00:00
|
|
|
|
|
|
|
void Clear(void) {
|
|
|
|
group.Clear();
|
|
|
|
request.Clear();
|
|
|
|
constraint.Clear();
|
|
|
|
param.Clear();
|
|
|
|
style.Clear();
|
|
|
|
}
|
2008-06-04 10:22:30 +00:00
|
|
|
} UndoState;
|
2013-09-09 19:50:32 +00:00
|
|
|
enum { MAX_UNDO = 16 };
|
2008-06-04 10:22:30 +00:00
|
|
|
typedef struct {
|
|
|
|
UndoState d[MAX_UNDO];
|
|
|
|
int cnt;
|
|
|
|
int write;
|
|
|
|
} UndoStack;
|
|
|
|
UndoStack undo;
|
|
|
|
UndoStack redo;
|
|
|
|
void UndoEnableMenus(void);
|
|
|
|
void UndoRemember(void);
|
|
|
|
void UndoUndo(void);
|
|
|
|
void UndoRedo(void);
|
|
|
|
void PushFromCurrentOnto(UndoStack *uk);
|
|
|
|
void PopOntoCurrentFrom(UndoStack *uk);
|
|
|
|
void UndoClearState(UndoState *ut);
|
|
|
|
void UndoClearStack(UndoStack *uk);
|
|
|
|
|
2008-06-11 04:22:52 +00:00
|
|
|
// Little bits of extra configuration state
|
2013-09-09 19:50:32 +00:00
|
|
|
enum { MODEL_COLORS = 8 };
|
2015-07-10 11:54:39 +00:00
|
|
|
RgbaColor modelColor[MODEL_COLORS];
|
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 05:45:13 +00:00
|
|
|
Vector lightDir[2];
|
|
|
|
double lightIntensity[2];
|
|
|
|
double ambientIntensity;
|
|
|
|
double chordTol;
|
Use relative chord tolerance instead of absolute.
Commit 89eb208 has improved the overall situation with chord
tolerance, but it changed the display chord tolerance to use
an absolute value in millimeters as a stopgap measure.
This commit changes the display chord tolerance to be specified
in percents of entity bounding box instead of millimeters.
As a result, the linearized curves are both zoom level and sketch
scale independent.
In order to compute the bounding box, all entities are generated
twice. However, this shouldn't result in a noticeable slowdown,
since the bounding box calculation does not need the expensive
triangle mesh generation and the solver will converge immediately
on the second run.
Since the meaning of the preference has changed, a new name is
used (ChordTolerancePct instead of ChordTolerance), so that it
would be reset to the default value after updating SolveSpace.
The default value, 0.5%, was selected using trial and error by
judging whether cylinders of moderate dimensions were looking
aesthetically pleasing enough.
After this change, the only real function of the spacebar
shortcut is to reload imported groups, since manual regeneration
should not change anything anymore unless there is a bug.
2016-01-29 10:33:56 +00:00
|
|
|
double chordTolCalculated;
|
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 05:45:13 +00:00
|
|
|
int maxSegments;
|
2016-01-27 04:07:54 +00:00
|
|
|
double exportChordTol;
|
|
|
|
int exportMaxSegments;
|
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 05:45:13 +00:00
|
|
|
double cameraTangent;
|
|
|
|
float gridSpacing;
|
|
|
|
float exportScale;
|
|
|
|
float exportOffset;
|
|
|
|
bool fixExportColors;
|
|
|
|
bool drawBackFaces;
|
|
|
|
bool checkClosedContour;
|
|
|
|
bool showToolbar;
|
2015-07-10 11:54:39 +00:00
|
|
|
RgbaColor backgroundColor;
|
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 05:45:13 +00:00
|
|
|
bool exportShadedTriangles;
|
|
|
|
bool exportPwlCurves;
|
|
|
|
bool exportCanvasSizeAuto;
|
2016-01-27 04:07:54 +00:00
|
|
|
bool exportMode;
|
2009-09-03 08:13:09 +00:00
|
|
|
struct {
|
|
|
|
float left;
|
|
|
|
float right;
|
|
|
|
float bottom;
|
|
|
|
float top;
|
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 05:45:13 +00:00
|
|
|
} exportMargin;
|
2009-09-03 08:13:09 +00:00
|
|
|
struct {
|
|
|
|
float width;
|
|
|
|
float height;
|
|
|
|
float dx;
|
|
|
|
float dy;
|
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 05:45:13 +00:00
|
|
|
} exportCanvas;
|
2010-01-14 04:47:17 +00:00
|
|
|
struct {
|
|
|
|
float depth;
|
|
|
|
int passes;
|
|
|
|
float feed;
|
|
|
|
float plungeFeed;
|
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 05:45:13 +00:00
|
|
|
} gCode;
|
2008-07-06 07:56:24 +00:00
|
|
|
|
2008-06-14 09:51:25 +00:00
|
|
|
typedef enum {
|
|
|
|
UNIT_MM = 0,
|
2013-08-26 20:54:04 +00:00
|
|
|
UNIT_INCHES
|
2008-06-14 09:51:25 +00:00
|
|
|
} Unit;
|
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 05:45:13 +00:00
|
|
|
Unit viewUnits;
|
|
|
|
int afterDecimalMm;
|
|
|
|
int afterDecimalInch;
|
2015-03-29 04:46:57 +00:00
|
|
|
int autosaveInterval; // in minutes
|
2010-09-24 02:58:34 +00:00
|
|
|
|
2015-11-06 08:40:12 +00:00
|
|
|
std::string MmToString(double v);
|
2008-06-14 09:51:25 +00:00
|
|
|
double ExprToMm(Expr *e);
|
2015-11-06 08:40:12 +00:00
|
|
|
double StringToMm(const std::string &s);
|
2013-08-26 18:58:35 +00:00
|
|
|
const char *UnitName(void);
|
2010-01-04 00:35:28 +00:00
|
|
|
double MmPerUnit(void);
|
2010-09-24 02:58:34 +00:00
|
|
|
int UnitDigitsAfterDecimal(void);
|
|
|
|
void SetUnitDigitsAfterDecimal(int v);
|
2009-03-08 10:59:57 +00:00
|
|
|
double ChordTolMm(void);
|
2016-01-27 04:07:54 +00:00
|
|
|
double ExportChordTolMm(void);
|
|
|
|
int GetMaxSegments(void);
|
2010-05-03 05:15:28 +00:00
|
|
|
bool usePerspectiveProj;
|
2009-09-29 11:35:19 +00:00
|
|
|
double CameraTangent(void);
|
2008-06-14 09:51:25 +00:00
|
|
|
|
2010-05-16 16:36:23 +00:00
|
|
|
// Some stuff relating to the tangent arcs created non-parametrically
|
|
|
|
// as special requests.
|
|
|
|
double tangentArcRadius;
|
|
|
|
bool tangentArcManual;
|
|
|
|
bool tangentArcDeleteOld;
|
|
|
|
|
2008-06-14 09:51:25 +00:00
|
|
|
// The platform-dependent code calls this before entering the msg loop
|
2015-03-24 06:45:53 +00:00
|
|
|
void Init(void);
|
2015-12-27 01:03:24 +00:00
|
|
|
bool OpenFile(const std::string &filename);
|
2008-06-11 04:22:52 +00:00
|
|
|
void Exit(void);
|
|
|
|
|
2008-06-04 10:22:30 +00:00
|
|
|
// File load/save routines, including the additional files that get
|
|
|
|
// loaded when we have import groups.
|
2008-04-18 11:11:48 +00:00
|
|
|
FILE *fh;
|
2008-05-28 10:10:31 +00:00
|
|
|
void AfterNewFile(void);
|
2015-12-27 01:03:24 +00:00
|
|
|
static void RemoveFromRecentList(const std::string &filename);
|
|
|
|
static void AddToRecentList(const std::string &filename);
|
|
|
|
std::string saveFile;
|
|
|
|
bool fileLoadError;
|
|
|
|
bool unsaved;
|
2008-04-24 06:22:16 +00:00
|
|
|
typedef struct {
|
2013-08-26 18:58:35 +00:00
|
|
|
char type;
|
|
|
|
const char *desc;
|
|
|
|
char fmt;
|
|
|
|
void *ptr;
|
2008-04-24 06:22:16 +00:00
|
|
|
} SaveTable;
|
|
|
|
static const SaveTable SAVED[];
|
|
|
|
void SaveUsingTable(int type);
|
2008-04-27 10:01:23 +00:00
|
|
|
void LoadUsingTable(char *key, char *val);
|
2008-04-24 06:22:16 +00:00
|
|
|
struct {
|
|
|
|
Group g;
|
|
|
|
Request r;
|
|
|
|
Entity e;
|
|
|
|
Param p;
|
|
|
|
Constraint c;
|
2009-09-17 07:32:36 +00:00
|
|
|
Style s;
|
2008-04-24 06:22:16 +00:00
|
|
|
} sv;
|
2008-04-18 11:11:48 +00:00
|
|
|
static void MenuFile(int id);
|
2015-03-29 04:46:57 +00:00
|
|
|
bool Autosave();
|
|
|
|
void RemoveAutosave();
|
2008-06-03 18:28:41 +00:00
|
|
|
bool GetFilenameAndSave(bool saveAs);
|
|
|
|
bool OkayToStartNewFile(void);
|
2008-06-02 11:43:27 +00:00
|
|
|
hGroup CreateDefaultDrawingGroup(void);
|
2008-07-08 08:02:22 +00:00
|
|
|
void UpdateWindowTitle(void);
|
2010-02-28 19:23:01 +00:00
|
|
|
void ClearExisting(void);
|
2008-04-24 06:22:16 +00:00
|
|
|
void NewFile(void);
|
2015-12-27 01:03:24 +00:00
|
|
|
bool SaveToFile(const std::string &filename);
|
|
|
|
bool LoadAutosaveFor(const std::string &filename);
|
|
|
|
bool LoadFromFile(const std::string &filename);
|
|
|
|
bool LoadEntitiesFromFile(const std::string &filename, EntityList *le,
|
2015-03-18 17:02:11 +00:00
|
|
|
SMesh *m, SShell *sh);
|
2016-01-11 12:18:18 +00:00
|
|
|
bool ReloadAllImported(bool canCancel=false);
|
2008-07-06 09:24:31 +00:00
|
|
|
// And the various export options
|
2015-12-27 01:03:24 +00:00
|
|
|
void ExportAsPngTo(const std::string &filename);
|
|
|
|
void ExportMeshTo(const std::string &filename);
|
2009-10-12 11:34:43 +00:00
|
|
|
void ExportMeshAsStlTo(FILE *f, SMesh *sm);
|
|
|
|
void ExportMeshAsObjTo(FILE *f, SMesh *sm);
|
2016-01-11 10:53:04 +00:00
|
|
|
void ExportMeshAsThreeJsTo(FILE *f, const std::string &filename,
|
|
|
|
SMesh *sm, SEdgeList *sel);
|
2015-12-27 01:03:24 +00:00
|
|
|
void ExportViewOrWireframeTo(const std::string &filename, bool wireframe);
|
|
|
|
void ExportSectionTo(const std::string &filename);
|
2009-10-12 10:40:48 +00:00
|
|
|
void ExportWireframeCurves(SEdgeList *sel, SBezierList *sbl,
|
|
|
|
VectorFileWriter *out);
|
2009-04-14 04:19:23 +00:00
|
|
|
void ExportLinesAndMesh(SEdgeList *sel, SBezierList *sbl, SMesh *sm,
|
2009-03-17 16:33:46 +00:00
|
|
|
Vector u, Vector v, Vector n, Vector origin,
|
|
|
|
double cameraTan,
|
|
|
|
VectorFileWriter *out);
|
2008-04-20 11:35:10 +00:00
|
|
|
|
2008-07-20 11:27:22 +00:00
|
|
|
static void MenuAnalyze(int id);
|
2009-11-08 01:11:38 +00:00
|
|
|
|
|
|
|
// Additional display stuff
|
2008-07-20 11:27:22 +00:00
|
|
|
struct {
|
|
|
|
SContour path;
|
|
|
|
hEntity point;
|
|
|
|
} traced;
|
2009-01-25 09:19:59 +00:00
|
|
|
SEdgeList nakedEdges;
|
2010-01-04 00:35:28 +00:00
|
|
|
struct {
|
|
|
|
bool draw;
|
|
|
|
Vector ptA;
|
|
|
|
Vector ptB;
|
|
|
|
} extraLine;
|
2009-11-08 01:11:38 +00:00
|
|
|
struct {
|
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 05:45:13 +00:00
|
|
|
uint8_t *fromFile;
|
2009-11-08 01:11:38 +00:00
|
|
|
int w, h;
|
|
|
|
int rw, rh;
|
|
|
|
double scale; // pixels per mm
|
|
|
|
Vector origin;
|
|
|
|
} bgImage;
|
2010-01-14 05:24:32 +00:00
|
|
|
struct {
|
2016-01-27 04:07:54 +00:00
|
|
|
bool draw, showOrigin;
|
2010-01-14 05:24:32 +00:00
|
|
|
Vector pt, u, v;
|
|
|
|
} justExportedInfo;
|
2008-07-20 11:27:22 +00:00
|
|
|
|
2009-12-04 08:08:41 +00:00
|
|
|
class Clipboard {
|
2015-12-30 12:36:31 +00:00
|
|
|
public:
|
2009-12-04 08:08:41 +00:00
|
|
|
List<ClipboardRequest> r;
|
|
|
|
List<Constraint> c;
|
|
|
|
|
|
|
|
void Clear(void);
|
|
|
|
bool ContainsEntity(hEntity old);
|
|
|
|
hEntity NewEntityFor(hEntity old);
|
|
|
|
};
|
|
|
|
Clipboard clipboard;
|
|
|
|
|
2008-06-02 09:31:26 +00:00
|
|
|
void MarkGroupDirty(hGroup hg);
|
2008-06-02 11:43:27 +00:00
|
|
|
void MarkGroupDirtyByEntity(hEntity he);
|
2008-06-02 09:31:26 +00:00
|
|
|
|
2008-06-04 10:22:30 +00:00
|
|
|
// Consistency checking on the sketch: stuff with missing dependencies
|
|
|
|
// will get deleted automatically.
|
2008-05-17 06:04:55 +00:00
|
|
|
struct {
|
|
|
|
int requests;
|
|
|
|
int groups;
|
|
|
|
int constraints;
|
2009-01-03 12:27:33 +00:00
|
|
|
int nonTrivialConstraints;
|
2008-05-17 06:04:55 +00:00
|
|
|
} deleted;
|
|
|
|
bool GroupExists(hGroup hg);
|
|
|
|
bool PruneOrphans(void);
|
|
|
|
bool EntityExists(hEntity he);
|
|
|
|
bool GroupsInOrder(hGroup before, hGroup after);
|
|
|
|
bool PruneGroups(hGroup hg);
|
|
|
|
bool PruneRequests(hGroup hg);
|
|
|
|
bool PruneConstraints(hGroup hg);
|
2008-04-27 09:03:01 +00:00
|
|
|
|
2016-01-27 09:09:45 +00:00
|
|
|
enum GenerateType {
|
2016-02-17 10:03:07 +00:00
|
|
|
GENERATE_DIRTY,
|
2016-01-27 09:09:45 +00:00
|
|
|
GENERATE_ALL,
|
|
|
|
GENERATE_REGEN,
|
|
|
|
GENERATE_UNTIL_ACTIVE,
|
|
|
|
};
|
Rewrite TTF to Bezier conversion using Freetype.
Benefits:
* Much simpler code.
* Handles the entire TTF spec, not just a small subset that
only really worked well on Windows fonts.
* Handles all character sets as well as accented characters.
* Much faster parsing, since Freetype lazily loads and
caches glyphs.
* Support for basically every kind of font that was invented,
not just TTF.
Note that OpenType features, e.g. ligatures, are not yet supported.
This means that Arabic and Devanagari scripts, among others, will
not be rendered in their proper form.
RTL scripts are not supported either, neither in TTF nor in
the text window. Adding RTL support is comparatively easy, but
given that Arabic would not be legibly rendered anyway, this is not
done so far.
2016-01-30 01:42:44 +00:00
|
|
|
|
2016-02-17 10:03:07 +00:00
|
|
|
void GenerateAll(GenerateType type = GENERATE_DIRTY, bool andFindFree = false,
|
|
|
|
bool genForBBox = false);
|
2009-01-04 12:01:46 +00:00
|
|
|
void SolveGroup(hGroup hg, bool andFindFree);
|
2009-04-20 07:30:09 +00:00
|
|
|
void MarkDraggedParams(void);
|
2008-04-27 09:03:01 +00:00
|
|
|
void ForceReferences(void);
|
|
|
|
|
Only consider groups until active when checking for solver failure.
After commit 2f734d9, inactive groups are no longer regenerated
for trivial changes, e.g. changing parameters, so it's possible to
switch to an earlier group and work on it without incurring
the computational (slowdown) and cognitive (annoyance by red
background) overhead of later groups failing to solve.
However, if a group--any group anywhere--was not solved OK,
the interface reacted accordingly, which diminished usefulness of
the change, especially given that, if we have groups A and B with
B depending on A, if B is broken by a change in A and we activate A
and fix it, B will not be regenerated.
After this commit, only active groups are considered when deciding
if generating the entire sketch would fail.
2016-02-13 22:14:02 +00:00
|
|
|
bool ActiveGroupsOkay(void);
|
2008-07-20 11:27:22 +00:00
|
|
|
|
2008-04-20 11:35:10 +00:00
|
|
|
// The system to be solved.
|
|
|
|
System sys;
|
2008-06-03 18:28:41 +00:00
|
|
|
|
2008-06-30 09:09:17 +00:00
|
|
|
// All the TrueType fonts in memory
|
|
|
|
TtfFontList fonts;
|
|
|
|
|
2008-06-25 05:14:49 +00:00
|
|
|
// Everything has been pruned, so we know there's no dangling references
|
|
|
|
// to entities that don't exist. Before that, we mustn't try to display
|
|
|
|
// the sketch!
|
|
|
|
bool allConsistent;
|
|
|
|
|
2008-06-03 18:28:41 +00:00
|
|
|
struct {
|
2015-03-18 17:02:11 +00:00
|
|
|
bool scheduled;
|
2008-06-03 18:28:41 +00:00
|
|
|
bool showTW;
|
|
|
|
bool generateAll;
|
|
|
|
} later;
|
2015-03-18 17:02:11 +00:00
|
|
|
void ScheduleShowTW();
|
|
|
|
void ScheduleGenerateAll();
|
2008-06-03 18:28:41 +00:00
|
|
|
void DoLater(void);
|
2008-02-09 13:52:01 +00:00
|
|
|
|
|
|
|
static void MenuHelp(int id);
|
2013-09-19 04:33:12 +00:00
|
|
|
|
|
|
|
void Clear(void);
|
2008-03-28 10:00:37 +00:00
|
|
|
};
|
2008-03-25 10:02:13 +00:00
|
|
|
|
2015-03-23 17:49:04 +00:00
|
|
|
extern SolveSpaceUI SS;
|
2009-04-19 05:53:16 +00:00
|
|
|
extern Sketch SK;
|
2008-03-25 10:02:13 +00:00
|
|
|
|
2015-03-23 17:49:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#ifndef __OBJC__
|
|
|
|
using namespace SolveSpace;
|
|
|
|
#endif
|
|
|
|
|
2008-03-25 10:02:13 +00:00
|
|
|
#endif
|