2013-07-28 22:08:34 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Declarations relating to our user interface, in both the graphics and
|
|
|
|
// text browser window.
|
|
|
|
//
|
|
|
|
// Copyright 2008-2013 Jonathan Westhues.
|
|
|
|
//-----------------------------------------------------------------------------
|
2008-03-25 10:02:13 +00:00
|
|
|
|
|
|
|
#ifndef __UI_H
|
|
|
|
#define __UI_H
|
|
|
|
|
2017-01-04 15:39:27 +00:00
|
|
|
class Locale {
|
|
|
|
public:
|
|
|
|
std::string language;
|
|
|
|
std::string region;
|
|
|
|
uint16_t lcid;
|
|
|
|
std::string displayName;
|
|
|
|
|
|
|
|
std::string Culture() const {
|
|
|
|
return language + "-" + region;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct LocaleLess {
|
2017-01-05 10:39:08 +00:00
|
|
|
bool operator()(const Locale &a, const Locale &b) const {
|
2017-01-04 15:39:27 +00:00
|
|
|
return a.language < b.language ||
|
|
|
|
(a.language == b.language && a.region < b.region);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const std::set<Locale, LocaleLess> &Locales();
|
|
|
|
bool SetLocale(const std::string &name);
|
|
|
|
bool SetLocale(uint16_t lcid);
|
|
|
|
|
|
|
|
const std::string &Translate(const char *msgid);
|
2017-01-07 06:41:13 +00:00
|
|
|
const std::string &Translate(const char *msgctxt, const char *msgid);
|
2017-01-04 15:39:27 +00:00
|
|
|
const std::string &TranslatePlural(const char *msgid, unsigned n);
|
2017-01-07 06:41:13 +00:00
|
|
|
const std::string &TranslatePlural(const char *msgctxt, const char *msgid, unsigned n);
|
2017-01-04 15:39:27 +00:00
|
|
|
|
2017-01-07 06:41:13 +00:00
|
|
|
inline const char *N_(const char *msgid) {
|
|
|
|
return msgid;
|
|
|
|
}
|
|
|
|
inline const char *CN_(const char *msgctxt, const char *msgid) {
|
|
|
|
return msgid;
|
|
|
|
}
|
|
|
|
#if defined(LIBRARY)
|
|
|
|
inline const char *_(const char *msgid) {
|
|
|
|
return msgid;
|
|
|
|
}
|
|
|
|
inline const char *C_(const char *msgctxt, const char *msgid) {
|
|
|
|
return msgid;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
inline const char *_(const char *msgid) {
|
|
|
|
return Translate(msgid).c_str();
|
|
|
|
}
|
|
|
|
inline const char *C_(const char *msgctxt, const char *msgid) {
|
|
|
|
return Translate(msgctxt, msgid).c_str();
|
|
|
|
}
|
|
|
|
#endif
|
2017-01-04 15:39:27 +00:00
|
|
|
|
2017-01-11 02:44:29 +00:00
|
|
|
// Filters for the file formats that we support.
|
|
|
|
struct FileFilter {
|
|
|
|
const char *name;
|
|
|
|
const char *patterns[3];
|
|
|
|
};
|
|
|
|
|
|
|
|
// SolveSpace native file format
|
|
|
|
const FileFilter SlvsFileFilter[] = {
|
|
|
|
{ N_("SolveSpace models"), { "slvs" } },
|
|
|
|
{ NULL, {} }
|
|
|
|
};
|
|
|
|
// PNG format bitmap
|
2016-11-29 16:49:20 +00:00
|
|
|
const FileFilter RasterFileFilter[] = {
|
2017-01-11 02:44:29 +00:00
|
|
|
{ N_("PNG file"), { "png" } },
|
|
|
|
{ NULL, {} }
|
|
|
|
};
|
|
|
|
// Triangle mesh
|
|
|
|
const FileFilter MeshFileFilter[] = {
|
|
|
|
{ N_("STL mesh"), { "stl" } },
|
|
|
|
{ N_("Wavefront OBJ mesh"), { "obj" } },
|
|
|
|
{ N_("Three.js-compatible mesh, with viewer"), { "html" } },
|
|
|
|
{ N_("Three.js-compatible mesh, mesh only"), { "js" } },
|
|
|
|
{ NULL, {} }
|
|
|
|
};
|
|
|
|
// NURBS surfaces
|
|
|
|
const FileFilter SurfaceFileFilter[] = {
|
|
|
|
{ N_("STEP file"), { "step", "stp" } },
|
|
|
|
{ NULL, {} }
|
|
|
|
};
|
|
|
|
// 2d vector (lines and curves) format
|
|
|
|
const FileFilter VectorFileFilter[] = {
|
|
|
|
{ N_("PDF file"), { "pdf" } },
|
|
|
|
{ N_("Encapsulated PostScript"), { "eps", "ps" } },
|
|
|
|
{ N_("Scalable Vector Graphics"), { "svg" } },
|
|
|
|
{ N_("STEP file"), { "step", "stp" } },
|
|
|
|
{ N_("DXF file (AutoCAD 2007)"), { "dxf" } },
|
|
|
|
{ N_("HPGL file"), { "plt", "hpgl" } },
|
|
|
|
{ N_("G Code"), { "ngc", "txt" } },
|
|
|
|
{ NULL, {} }
|
|
|
|
};
|
|
|
|
// 3d vector (wireframe lines and curves) format
|
|
|
|
const FileFilter Vector3dFileFilter[] = {
|
|
|
|
{ N_("STEP file"), { "step", "stp" } },
|
|
|
|
{ N_("DXF file (AutoCAD 2007)"), { "dxf" } },
|
|
|
|
{ NULL, {} }
|
|
|
|
};
|
|
|
|
// All Importable formats
|
|
|
|
const FileFilter ImportableFileFilter[] = {
|
|
|
|
{ N_("AutoCAD DXF and DWG files"), { "dxf", "dwg" } },
|
|
|
|
{ NULL, {} }
|
|
|
|
};
|
|
|
|
// Comma-separated value, like a spreadsheet would use
|
|
|
|
const FileFilter CsvFileFilter[] = {
|
|
|
|
{ N_("Comma-separated values"), { "csv" } },
|
|
|
|
{ NULL, {} }
|
|
|
|
};
|
|
|
|
|
Convert all enumerations to use `enum class`.
Specifically, take the old code that looks like this:
class Foo {
enum { X = 1, Y = 2 };
int kind;
}
... foo.kind = Foo::X; ...
and convert it to this:
class Foo {
enum class Kind : uint32_t { X = 1, Y = 2 };
Kind kind;
}
... foo.kind = Foo::Kind::X;
(In some cases the enumeration would not be in the class namespace,
such as when it is generally useful.)
The benefits are as follows:
* The type of the field gives a clear indication of intent, both
to humans and tools (such as binding generators).
* The compiler is able to automatically warn when a switch is not
exhaustive; but this is currently suppressed by the
default: ssassert(false, ...)
idiom.
* Integers and plain enums are weakly type checked: they implicitly
convert into each other. This can hide bugs where type conversion
is performed but not intended. Enum classes are strongly type
checked.
* Plain enums pollute parent namespaces; enum classes do not.
Almost every defined enum we have already has a kind of ad-hoc
namespacing via `NAMESPACE_`, which is now explicit.
* Plain enums do not have a well-defined ABI size, which is
important for bindings. Enum classes can have it, if specified.
We specify the base type for all enums as uint32_t, which is
a safe choice and allows us to not change the numeric values
of any variants.
This commit introduces absolutely no functional change to the code,
just renaming and change of types. It handles almost all cases,
except GraphicsWindow::pending.operation, which needs minor
functional change.
2016-05-20 08:31:20 +00:00
|
|
|
// This table describes the top-level menus in the graphics winodw.
|
|
|
|
enum class Command : uint32_t {
|
|
|
|
NONE = 0,
|
|
|
|
// File
|
|
|
|
NEW = 100,
|
|
|
|
OPEN,
|
|
|
|
OPEN_RECENT,
|
|
|
|
SAVE,
|
|
|
|
SAVE_AS,
|
|
|
|
EXPORT_PNG,
|
|
|
|
EXPORT_MESH,
|
|
|
|
EXPORT_SURFACES,
|
|
|
|
EXPORT_VIEW,
|
|
|
|
EXPORT_SECTION,
|
|
|
|
EXPORT_WIREFRAME,
|
|
|
|
IMPORT,
|
|
|
|
EXIT,
|
|
|
|
// View
|
|
|
|
ZOOM_IN,
|
|
|
|
ZOOM_OUT,
|
|
|
|
ZOOM_TO_FIT,
|
|
|
|
SHOW_GRID,
|
|
|
|
PERSPECTIVE_PROJ,
|
|
|
|
ONTO_WORKPLANE,
|
|
|
|
NEAREST_ORTHO,
|
|
|
|
NEAREST_ISO,
|
|
|
|
CENTER_VIEW,
|
|
|
|
SHOW_TOOLBAR,
|
|
|
|
SHOW_TEXT_WND,
|
|
|
|
UNITS_INCHES,
|
|
|
|
UNITS_MM,
|
|
|
|
FULL_SCREEN,
|
|
|
|
// Edit
|
|
|
|
UNDO,
|
|
|
|
REDO,
|
|
|
|
CUT,
|
|
|
|
COPY,
|
|
|
|
PASTE,
|
|
|
|
PASTE_TRANSFORM,
|
|
|
|
DELETE,
|
|
|
|
SELECT_CHAIN,
|
|
|
|
SELECT_ALL,
|
|
|
|
SNAP_TO_GRID,
|
|
|
|
ROTATE_90,
|
|
|
|
UNSELECT_ALL,
|
|
|
|
REGEN_ALL,
|
|
|
|
// Request
|
|
|
|
SEL_WORKPLANE,
|
|
|
|
FREE_IN_3D,
|
|
|
|
DATUM_POINT,
|
|
|
|
WORKPLANE,
|
|
|
|
LINE_SEGMENT,
|
|
|
|
CONSTR_SEGMENT,
|
|
|
|
CIRCLE,
|
|
|
|
ARC,
|
|
|
|
RECTANGLE,
|
|
|
|
CUBIC,
|
|
|
|
TTF_TEXT,
|
2016-11-29 16:49:20 +00:00
|
|
|
IMAGE,
|
Convert all enumerations to use `enum class`.
Specifically, take the old code that looks like this:
class Foo {
enum { X = 1, Y = 2 };
int kind;
}
... foo.kind = Foo::X; ...
and convert it to this:
class Foo {
enum class Kind : uint32_t { X = 1, Y = 2 };
Kind kind;
}
... foo.kind = Foo::Kind::X;
(In some cases the enumeration would not be in the class namespace,
such as when it is generally useful.)
The benefits are as follows:
* The type of the field gives a clear indication of intent, both
to humans and tools (such as binding generators).
* The compiler is able to automatically warn when a switch is not
exhaustive; but this is currently suppressed by the
default: ssassert(false, ...)
idiom.
* Integers and plain enums are weakly type checked: they implicitly
convert into each other. This can hide bugs where type conversion
is performed but not intended. Enum classes are strongly type
checked.
* Plain enums pollute parent namespaces; enum classes do not.
Almost every defined enum we have already has a kind of ad-hoc
namespacing via `NAMESPACE_`, which is now explicit.
* Plain enums do not have a well-defined ABI size, which is
important for bindings. Enum classes can have it, if specified.
We specify the base type for all enums as uint32_t, which is
a safe choice and allows us to not change the numeric values
of any variants.
This commit introduces absolutely no functional change to the code,
just renaming and change of types. It handles almost all cases,
except GraphicsWindow::pending.operation, which needs minor
functional change.
2016-05-20 08:31:20 +00:00
|
|
|
SPLIT_CURVES,
|
|
|
|
TANGENT_ARC,
|
|
|
|
CONSTRUCTION,
|
|
|
|
// Group
|
|
|
|
GROUP_3D,
|
|
|
|
GROUP_WRKPL,
|
|
|
|
GROUP_EXTRUDE,
|
|
|
|
GROUP_LATHE,
|
|
|
|
GROUP_ROT,
|
|
|
|
GROUP_TRANS,
|
|
|
|
GROUP_LINK,
|
|
|
|
GROUP_RECENT,
|
|
|
|
// Constrain
|
|
|
|
DISTANCE_DIA,
|
|
|
|
REF_DISTANCE,
|
|
|
|
ANGLE,
|
|
|
|
REF_ANGLE,
|
|
|
|
OTHER_ANGLE,
|
|
|
|
REFERENCE,
|
|
|
|
EQUAL,
|
|
|
|
RATIO,
|
|
|
|
DIFFERENCE,
|
|
|
|
ON_ENTITY,
|
|
|
|
SYMMETRIC,
|
|
|
|
AT_MIDPOINT,
|
|
|
|
HORIZONTAL,
|
|
|
|
VERTICAL,
|
|
|
|
PARALLEL,
|
|
|
|
PERPENDICULAR,
|
|
|
|
ORIENTED_SAME,
|
|
|
|
WHERE_DRAGGED,
|
|
|
|
COMMENT,
|
|
|
|
// Analyze
|
|
|
|
VOLUME,
|
|
|
|
AREA,
|
2016-08-01 13:18:58 +00:00
|
|
|
PERIMETER,
|
Convert all enumerations to use `enum class`.
Specifically, take the old code that looks like this:
class Foo {
enum { X = 1, Y = 2 };
int kind;
}
... foo.kind = Foo::X; ...
and convert it to this:
class Foo {
enum class Kind : uint32_t { X = 1, Y = 2 };
Kind kind;
}
... foo.kind = Foo::Kind::X;
(In some cases the enumeration would not be in the class namespace,
such as when it is generally useful.)
The benefits are as follows:
* The type of the field gives a clear indication of intent, both
to humans and tools (such as binding generators).
* The compiler is able to automatically warn when a switch is not
exhaustive; but this is currently suppressed by the
default: ssassert(false, ...)
idiom.
* Integers and plain enums are weakly type checked: they implicitly
convert into each other. This can hide bugs where type conversion
is performed but not intended. Enum classes are strongly type
checked.
* Plain enums pollute parent namespaces; enum classes do not.
Almost every defined enum we have already has a kind of ad-hoc
namespacing via `NAMESPACE_`, which is now explicit.
* Plain enums do not have a well-defined ABI size, which is
important for bindings. Enum classes can have it, if specified.
We specify the base type for all enums as uint32_t, which is
a safe choice and allows us to not change the numeric values
of any variants.
This commit introduces absolutely no functional change to the code,
just renaming and change of types. It handles almost all cases,
except GraphicsWindow::pending.operation, which needs minor
functional change.
2016-05-20 08:31:20 +00:00
|
|
|
INTERFERENCE,
|
|
|
|
NAKED_EDGES,
|
|
|
|
SHOW_DOF,
|
2017-01-17 16:57:27 +00:00
|
|
|
CENTER_OF_MASS,
|
Convert all enumerations to use `enum class`.
Specifically, take the old code that looks like this:
class Foo {
enum { X = 1, Y = 2 };
int kind;
}
... foo.kind = Foo::X; ...
and convert it to this:
class Foo {
enum class Kind : uint32_t { X = 1, Y = 2 };
Kind kind;
}
... foo.kind = Foo::Kind::X;
(In some cases the enumeration would not be in the class namespace,
such as when it is generally useful.)
The benefits are as follows:
* The type of the field gives a clear indication of intent, both
to humans and tools (such as binding generators).
* The compiler is able to automatically warn when a switch is not
exhaustive; but this is currently suppressed by the
default: ssassert(false, ...)
idiom.
* Integers and plain enums are weakly type checked: they implicitly
convert into each other. This can hide bugs where type conversion
is performed but not intended. Enum classes are strongly type
checked.
* Plain enums pollute parent namespaces; enum classes do not.
Almost every defined enum we have already has a kind of ad-hoc
namespacing via `NAMESPACE_`, which is now explicit.
* Plain enums do not have a well-defined ABI size, which is
important for bindings. Enum classes can have it, if specified.
We specify the base type for all enums as uint32_t, which is
a safe choice and allows us to not change the numeric values
of any variants.
This commit introduces absolutely no functional change to the code,
just renaming and change of types. It handles almost all cases,
except GraphicsWindow::pending.operation, which needs minor
functional change.
2016-05-20 08:31:20 +00:00
|
|
|
TRACE_PT,
|
|
|
|
STOP_TRACING,
|
|
|
|
STEP_DIM,
|
|
|
|
// Help
|
|
|
|
WEBSITE,
|
|
|
|
ABOUT,
|
|
|
|
// Recent
|
|
|
|
RECENT_OPEN = 0xf000,
|
|
|
|
RECENT_LINK = 0xf100,
|
2017-01-05 10:39:08 +00:00
|
|
|
// Locale
|
|
|
|
LOCALE = 0xf200,
|
Convert all enumerations to use `enum class`.
Specifically, take the old code that looks like this:
class Foo {
enum { X = 1, Y = 2 };
int kind;
}
... foo.kind = Foo::X; ...
and convert it to this:
class Foo {
enum class Kind : uint32_t { X = 1, Y = 2 };
Kind kind;
}
... foo.kind = Foo::Kind::X;
(In some cases the enumeration would not be in the class namespace,
such as when it is generally useful.)
The benefits are as follows:
* The type of the field gives a clear indication of intent, both
to humans and tools (such as binding generators).
* The compiler is able to automatically warn when a switch is not
exhaustive; but this is currently suppressed by the
default: ssassert(false, ...)
idiom.
* Integers and plain enums are weakly type checked: they implicitly
convert into each other. This can hide bugs where type conversion
is performed but not intended. Enum classes are strongly type
checked.
* Plain enums pollute parent namespaces; enum classes do not.
Almost every defined enum we have already has a kind of ad-hoc
namespacing via `NAMESPACE_`, which is now explicit.
* Plain enums do not have a well-defined ABI size, which is
important for bindings. Enum classes can have it, if specified.
We specify the base type for all enums as uint32_t, which is
a safe choice and allows us to not change the numeric values
of any variants.
This commit introduces absolutely no functional change to the code,
just renaming and change of types. It handles almost all cases,
except GraphicsWindow::pending.operation, which needs minor
functional change.
2016-05-20 08:31:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum class ContextCommand : uint32_t {
|
2016-10-09 22:08:22 +00:00
|
|
|
CANCELLED,
|
|
|
|
SUBMENU,
|
|
|
|
SEPARATOR,
|
|
|
|
UNSELECT_ALL,
|
|
|
|
UNSELECT_HOVERED,
|
|
|
|
CUT_SEL,
|
|
|
|
COPY_SEL,
|
|
|
|
PASTE,
|
|
|
|
PASTE_XFRM,
|
|
|
|
DELETE_SEL,
|
|
|
|
SELECT_CHAIN,
|
|
|
|
NEW_CUSTOM_STYLE,
|
|
|
|
NO_STYLE,
|
|
|
|
GROUP_INFO,
|
|
|
|
STYLE_INFO,
|
|
|
|
REFERENCE_DIM,
|
|
|
|
OTHER_ANGLE,
|
|
|
|
DEL_COINCIDENT,
|
|
|
|
SNAP_TO_GRID,
|
|
|
|
REMOVE_SPLINE_PT,
|
|
|
|
ADD_SPLINE_PT,
|
2016-10-09 22:13:01 +00:00
|
|
|
CONSTRUCTION,
|
2016-10-09 22:26:36 +00:00
|
|
|
ZOOM_TO_FIT,
|
2016-10-09 22:26:25 +00:00
|
|
|
SELECT_ALL,
|
Convert all enumerations to use `enum class`.
Specifically, take the old code that looks like this:
class Foo {
enum { X = 1, Y = 2 };
int kind;
}
... foo.kind = Foo::X; ...
and convert it to this:
class Foo {
enum class Kind : uint32_t { X = 1, Y = 2 };
Kind kind;
}
... foo.kind = Foo::Kind::X;
(In some cases the enumeration would not be in the class namespace,
such as when it is generally useful.)
The benefits are as follows:
* The type of the field gives a clear indication of intent, both
to humans and tools (such as binding generators).
* The compiler is able to automatically warn when a switch is not
exhaustive; but this is currently suppressed by the
default: ssassert(false, ...)
idiom.
* Integers and plain enums are weakly type checked: they implicitly
convert into each other. This can hide bugs where type conversion
is performed but not intended. Enum classes are strongly type
checked.
* Plain enums pollute parent namespaces; enum classes do not.
Almost every defined enum we have already has a kind of ad-hoc
namespacing via `NAMESPACE_`, which is now explicit.
* Plain enums do not have a well-defined ABI size, which is
important for bindings. Enum classes can have it, if specified.
We specify the base type for all enums as uint32_t, which is
a safe choice and allows us to not change the numeric values
of any variants.
This commit introduces absolutely no functional change to the code,
just renaming and change of types. It handles almost all cases,
except GraphicsWindow::pending.operation, which needs minor
functional change.
2016-05-20 08:31:20 +00:00
|
|
|
FIRST_STYLE = 0x40000000
|
|
|
|
};
|
|
|
|
|
2016-08-13 06:46:54 +00:00
|
|
|
class Button;
|
|
|
|
|
2008-03-28 10:00:37 +00:00
|
|
|
class TextWindow {
|
|
|
|
public:
|
2013-09-09 19:50:32 +00:00
|
|
|
enum {
|
|
|
|
MAX_COLS = 100,
|
|
|
|
MIN_COLS = 45,
|
|
|
|
MAX_ROWS = 2000
|
|
|
|
};
|
2008-03-25 10:02:13 +00:00
|
|
|
|
2008-03-28 10:00:37 +00:00
|
|
|
typedef struct {
|
2015-07-10 11:54:39 +00:00
|
|
|
char c;
|
|
|
|
RgbaColor color;
|
2008-03-28 10:00:37 +00:00
|
|
|
} Color;
|
2008-04-28 07:18:39 +00:00
|
|
|
static const Color fgColors[];
|
|
|
|
static const Color bgColors[];
|
2008-03-25 10:02:13 +00:00
|
|
|
|
2010-04-26 07:52:49 +00:00
|
|
|
float bgColorTable[256*3];
|
|
|
|
float fgColorTable[256*3];
|
|
|
|
|
2013-09-09 19:50:32 +00:00
|
|
|
enum {
|
2017-04-06 06:54:07 +00:00
|
|
|
CHAR_WIDTH_ = 9,
|
2013-09-09 19:50:32 +00:00
|
|
|
CHAR_HEIGHT = 16,
|
|
|
|
LINE_HEIGHT = 20,
|
|
|
|
LEFT_MARGIN = 6,
|
|
|
|
};
|
2010-05-09 01:20:02 +00:00
|
|
|
|
2015-11-05 19:39:27 +00:00
|
|
|
#define CHECK_FALSE "\xEE\x80\x80" // U+E000
|
|
|
|
#define CHECK_TRUE "\xEE\x80\x81"
|
|
|
|
#define RADIO_FALSE "\xEE\x80\x82"
|
|
|
|
#define RADIO_TRUE "\xEE\x80\x83"
|
|
|
|
|
2010-04-26 07:52:49 +00:00
|
|
|
int scrollPos; // The scrollbar position, in half-row units
|
|
|
|
int halfRows; // The height of our window, in half-row units
|
|
|
|
|
2015-11-05 19:39:27 +00:00
|
|
|
uint32_t text[MAX_ROWS][MAX_COLS];
|
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
|
|
|
typedef void LinkFunction(int link, uint32_t v);
|
2013-09-09 19:50:32 +00:00
|
|
|
enum { NOT_A_LINK = 0 };
|
2008-03-25 10:02:13 +00:00
|
|
|
struct {
|
2008-04-28 07:18:39 +00:00
|
|
|
char fg;
|
Replaced RGB-color integers with dedicated data structure
RGB colors were represented using a uint32_t with the red, green and blue
values stuffed into the lower three octets (i.e. 0x00BBGGRR), like
Microsoft's COLORREF. This approach did not lend itself to type safety,
however, so this change replaces it with an RgbColor class that provides
the same infomation plus a handful of useful methods to work with it. (Note
that sizeof(RgbColor) == sizeof(uint32_t), so this change should not lead
to memory bloat.)
Some of the new methods/fields replace what were previously macro calls;
e.g. RED(c) is now c.red, REDf(c) is now c.redF(). The .Equals() method is
now used instead of == to compare colors.
RGB colors still need to be represented as packed integers in file I/O and
preferences, so the methods .FromPackedInt() and .ToPackedInt() are
provided. Also implemented are Cnf{Freeze,Thaw}Color(), type-safe wrappers
around Cnf{Freeze,Thaw}Int() that facilitate I/O with preferences.
(Cnf{Freeze,Thaw}Color() are defined outside of the system-dependent code
to minimize the footprint of the latter; because the same can be done with
Cnf{Freeze,Thaw}Bool(), those are also moved out of the system code with
this commit.)
Color integers were being OR'ed with 0x80000000 in some places for two
distinct purposes: One, to indicate use of a default color in
glxFillMesh(); this has been replaced by use of the .UseDefault() method.
Two, to indicate to TextWindow::Printf() that the format argument of a
"%Bp"/"%Fp" specifier is an RGB color rather than a color "code" from
TextWindow::bgColors[] or TextWindow::fgColors[] (as the specifier can
accept either); instead, we define a new flag "z" (as in "%Bz" or "%Fz") to
indicate an RGBcolor pointer, leaving "%Bp"/"%Fp" to indicate a color code
exclusively.
(This also allows TextWindow::meta[][].bg to be a char instead of an int,
partly compensating for the new .bgRgb field added immediately after.)
In array declarations, RGB colors could previously be specified as 0 (often
in a terminating element). As that no longer works, we define NULL_COLOR,
which serves much the same purpose for RgbColor variables as NULL serves
for pointers.
2013-10-16 20:00:58 +00:00
|
|
|
char bg;
|
2015-07-10 11:54:39 +00:00
|
|
|
RgbaColor bgRgb;
|
2008-03-28 10:00:37 +00:00
|
|
|
int link;
|
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 data;
|
2008-03-28 10:00:37 +00:00
|
|
|
LinkFunction *f;
|
2008-05-26 09:56:50 +00:00
|
|
|
LinkFunction *h;
|
2008-03-25 10:02:13 +00:00
|
|
|
} meta[MAX_ROWS][MAX_COLS];
|
2010-05-03 05:04:42 +00:00
|
|
|
int hoveredRow, hoveredCol;
|
|
|
|
|
|
|
|
int top[MAX_ROWS]; // in half-line units, or -1 for unused
|
2008-04-09 09:35:09 +00:00
|
|
|
int rows;
|
2010-04-26 07:52:49 +00:00
|
|
|
|
2016-06-28 08:48:06 +00:00
|
|
|
std::shared_ptr<ViewportCanvas> canvas;
|
|
|
|
|
Abstract all (ex-OpenGL) drawing operations into a Canvas interface.
This has several desirable consequences:
* It is now possible to port SolveSpace to a later version of
OpenGL, such as OpenGLES 2, so that it runs on platforms that
only have that OpenGL version;
* The majority of geometry is now rendered without references to
the camera in C++ code, so a renderer can now submit it to
the video card once and re-rasterize with a different projection
matrix every time the projection is changed, avoiding expensive
reuploads;
* The DOGD (draw or get distance) interface is now
a straightforward Canvas implementation;
* There are no more direct references to SS.GW.(projection)
in sketch rendering code, which allows rendering to multiple
viewports;
* There are no more unnecessary framebuffer flips on CPU on Cocoa
and GTK;
* The platform-dependent GL code is now confined to rendergl1.cpp.
* The Microsoft and Apple headers required by it that are prone to
identifier conflicts are no longer included globally;
* The rendergl1.cpp implementation can now be omitted from
compilation to run SolveSpace headless or with a different
OpenGL version.
Note these implementation details of Canvas:
* GetCamera currently always returns a reference to the field
`Camera camera;`. This is so that a future renderer that caches
geometry in the video memory can define it as asserting, which
would provide assurance against code that could accidentally
put something projection-dependent in the cache;
* Line and triangle rendering is specified through a level of
indirection, hStroke and hFill. This is so that a future renderer
that batches geometry could cheaply group identical styles.
* DrawPixmap and DrawVectorText accept a (o,u,v) and not a matrix.
This is so that a future renderer into an output format that
uses 2d transforms (e.g. SVG) could easily derive those.
Some additional internal changes were required to enable this:
* Pixmap is now always passed as std::shared_ptr<{const ,}Pixmap>.
This is so that the renderer could cache uploaded textures
between API calls, which requires it to capture a (weak)
reference.
* The PlatformPathEqual function was properly extracted into
platform-specific code. This is so that the <windows.h> header
could be included only where needed (in platform/w32* as well
as rendergl1.cpp).
* The SBsp{2,3}::DebugDraw functions were removed. They can be
rewritten using the Canvas API if they are ever needed.
While no visual changes were originally intended, some minor fixes
happened anyway:
* The "emphasis" yellow line from top-left corner is now correctly
rendered much wider.
* The marquee rectangle is now pixel grid aligned.
* The hidden entities now do not clobber the depth buffer, removing
some minor artifacts.
* The workplane "tab" now scales with the font used to render
the workplane name.
* The workplane name font is now taken from the normals style.
* Workplane and constraint line stipple is insignificantly
different. This is so that it can reuse the existing stipple
codepaths; rendering of workplanes and constraints predates
those.
Some debug functionality was added:
* In graphics window, an fps counter that becomes red when
rendering under 60fps is drawn.
2016-05-31 00:55:13 +00:00
|
|
|
void Draw(Canvas *canvas);
|
|
|
|
|
2010-04-26 07:52:49 +00:00
|
|
|
// These are called by the platform-specific code.
|
2016-05-05 05:54:05 +00:00
|
|
|
void Paint();
|
2010-07-21 05:04:03 +00:00
|
|
|
void MouseEvent(bool isClick, bool leftDown, double x, double y);
|
2010-04-26 07:52:49 +00:00
|
|
|
void MouseScroll(double x, double y, int delta);
|
2016-05-05 05:54:05 +00:00
|
|
|
void MouseLeave();
|
2010-04-26 07:52:49 +00:00
|
|
|
void ScrollbarEvent(int newPos);
|
2010-05-03 05:04:42 +00:00
|
|
|
|
Convert all enumerations to use `enum class`.
Specifically, take the old code that looks like this:
class Foo {
enum { X = 1, Y = 2 };
int kind;
}
... foo.kind = Foo::X; ...
and convert it to this:
class Foo {
enum class Kind : uint32_t { X = 1, Y = 2 };
Kind kind;
}
... foo.kind = Foo::Kind::X;
(In some cases the enumeration would not be in the class namespace,
such as when it is generally useful.)
The benefits are as follows:
* The type of the field gives a clear indication of intent, both
to humans and tools (such as binding generators).
* The compiler is able to automatically warn when a switch is not
exhaustive; but this is currently suppressed by the
default: ssassert(false, ...)
idiom.
* Integers and plain enums are weakly type checked: they implicitly
convert into each other. This can hide bugs where type conversion
is performed but not intended. Enum classes are strongly type
checked.
* Plain enums pollute parent namespaces; enum classes do not.
Almost every defined enum we have already has a kind of ad-hoc
namespacing via `NAMESPACE_`, which is now explicit.
* Plain enums do not have a well-defined ABI size, which is
important for bindings. Enum classes can have it, if specified.
We specify the base type for all enums as uint32_t, which is
a safe choice and allows us to not change the numeric values
of any variants.
This commit introduces absolutely no functional change to the code,
just renaming and change of types. It handles almost all cases,
except GraphicsWindow::pending.operation, which needs minor
functional change.
2016-05-20 08:31:20 +00:00
|
|
|
enum DrawOrHitHow : uint32_t {
|
2013-09-09 19:50:32 +00:00
|
|
|
PAINT = 0,
|
|
|
|
HOVER = 1,
|
|
|
|
CLICK = 2
|
|
|
|
};
|
Abstract all (ex-OpenGL) drawing operations into a Canvas interface.
This has several desirable consequences:
* It is now possible to port SolveSpace to a later version of
OpenGL, such as OpenGLES 2, so that it runs on platforms that
only have that OpenGL version;
* The majority of geometry is now rendered without references to
the camera in C++ code, so a renderer can now submit it to
the video card once and re-rasterize with a different projection
matrix every time the projection is changed, avoiding expensive
reuploads;
* The DOGD (draw or get distance) interface is now
a straightforward Canvas implementation;
* There are no more direct references to SS.GW.(projection)
in sketch rendering code, which allows rendering to multiple
viewports;
* There are no more unnecessary framebuffer flips on CPU on Cocoa
and GTK;
* The platform-dependent GL code is now confined to rendergl1.cpp.
* The Microsoft and Apple headers required by it that are prone to
identifier conflicts are no longer included globally;
* The rendergl1.cpp implementation can now be omitted from
compilation to run SolveSpace headless or with a different
OpenGL version.
Note these implementation details of Canvas:
* GetCamera currently always returns a reference to the field
`Camera camera;`. This is so that a future renderer that caches
geometry in the video memory can define it as asserting, which
would provide assurance against code that could accidentally
put something projection-dependent in the cache;
* Line and triangle rendering is specified through a level of
indirection, hStroke and hFill. This is so that a future renderer
that batches geometry could cheaply group identical styles.
* DrawPixmap and DrawVectorText accept a (o,u,v) and not a matrix.
This is so that a future renderer into an output format that
uses 2d transforms (e.g. SVG) could easily derive those.
Some additional internal changes were required to enable this:
* Pixmap is now always passed as std::shared_ptr<{const ,}Pixmap>.
This is so that the renderer could cache uploaded textures
between API calls, which requires it to capture a (weak)
reference.
* The PlatformPathEqual function was properly extracted into
platform-specific code. This is so that the <windows.h> header
could be included only where needed (in platform/w32* as well
as rendergl1.cpp).
* The SBsp{2,3}::DebugDraw functions were removed. They can be
rewritten using the Canvas API if they are ever needed.
While no visual changes were originally intended, some minor fixes
happened anyway:
* The "emphasis" yellow line from top-left corner is now correctly
rendered much wider.
* The marquee rectangle is now pixel grid aligned.
* The hidden entities now do not clobber the depth buffer, removing
some minor artifacts.
* The workplane "tab" now scales with the font used to render
the workplane name.
* The workplane name font is now taken from the normals style.
* Workplane and constraint line stipple is insignificantly
different. This is so that it can reuse the existing stipple
codepaths; rendering of workplanes and constraints predates
those.
Some debug functionality was added:
* In graphics window, an fps counter that becomes red when
rendering under 60fps is drawn.
2016-05-31 00:55:13 +00:00
|
|
|
void DrawOrHitTestIcons(UiCanvas *canvas, DrawOrHitHow how,
|
|
|
|
double mx, double my);
|
2016-05-05 05:54:05 +00:00
|
|
|
void TimerCallback();
|
2010-05-03 05:04:42 +00:00
|
|
|
Point2d oldMousePos;
|
2016-08-13 06:46:54 +00:00
|
|
|
Button *hoveredButton, *tooltippedButton;
|
2010-07-21 05:04:03 +00:00
|
|
|
|
|
|
|
Vector HsvToRgb(Vector hsv);
|
Abstract all (ex-OpenGL) drawing operations into a Canvas interface.
This has several desirable consequences:
* It is now possible to port SolveSpace to a later version of
OpenGL, such as OpenGLES 2, so that it runs on platforms that
only have that OpenGL version;
* The majority of geometry is now rendered without references to
the camera in C++ code, so a renderer can now submit it to
the video card once and re-rasterize with a different projection
matrix every time the projection is changed, avoiding expensive
reuploads;
* The DOGD (draw or get distance) interface is now
a straightforward Canvas implementation;
* There are no more direct references to SS.GW.(projection)
in sketch rendering code, which allows rendering to multiple
viewports;
* There are no more unnecessary framebuffer flips on CPU on Cocoa
and GTK;
* The platform-dependent GL code is now confined to rendergl1.cpp.
* The Microsoft and Apple headers required by it that are prone to
identifier conflicts are no longer included globally;
* The rendergl1.cpp implementation can now be omitted from
compilation to run SolveSpace headless or with a different
OpenGL version.
Note these implementation details of Canvas:
* GetCamera currently always returns a reference to the field
`Camera camera;`. This is so that a future renderer that caches
geometry in the video memory can define it as asserting, which
would provide assurance against code that could accidentally
put something projection-dependent in the cache;
* Line and triangle rendering is specified through a level of
indirection, hStroke and hFill. This is so that a future renderer
that batches geometry could cheaply group identical styles.
* DrawPixmap and DrawVectorText accept a (o,u,v) and not a matrix.
This is so that a future renderer into an output format that
uses 2d transforms (e.g. SVG) could easily derive those.
Some additional internal changes were required to enable this:
* Pixmap is now always passed as std::shared_ptr<{const ,}Pixmap>.
This is so that the renderer could cache uploaded textures
between API calls, which requires it to capture a (weak)
reference.
* The PlatformPathEqual function was properly extracted into
platform-specific code. This is so that the <windows.h> header
could be included only where needed (in platform/w32* as well
as rendergl1.cpp).
* The SBsp{2,3}::DebugDraw functions were removed. They can be
rewritten using the Canvas API if they are ever needed.
While no visual changes were originally intended, some minor fixes
happened anyway:
* The "emphasis" yellow line from top-left corner is now correctly
rendered much wider.
* The marquee rectangle is now pixel grid aligned.
* The hidden entities now do not clobber the depth buffer, removing
some minor artifacts.
* The workplane "tab" now scales with the font used to render
the workplane name.
* The workplane name font is now taken from the normals style.
* Workplane and constraint line stipple is insignificantly
different. This is so that it can reuse the existing stipple
codepaths; rendering of workplanes and constraints predates
those.
Some debug functionality was added:
* In graphics window, an fps counter that becomes red when
rendering under 60fps is drawn.
2016-05-31 00:55:13 +00:00
|
|
|
std::shared_ptr<Pixmap> HsvPattern2d(int w, int h);
|
|
|
|
std::shared_ptr<Pixmap> HsvPattern1d(double hue, double sat, int w, int h);
|
2016-05-05 05:54:05 +00:00
|
|
|
void ColorPickerDone();
|
Abstract all (ex-OpenGL) drawing operations into a Canvas interface.
This has several desirable consequences:
* It is now possible to port SolveSpace to a later version of
OpenGL, such as OpenGLES 2, so that it runs on platforms that
only have that OpenGL version;
* The majority of geometry is now rendered without references to
the camera in C++ code, so a renderer can now submit it to
the video card once and re-rasterize with a different projection
matrix every time the projection is changed, avoiding expensive
reuploads;
* The DOGD (draw or get distance) interface is now
a straightforward Canvas implementation;
* There are no more direct references to SS.GW.(projection)
in sketch rendering code, which allows rendering to multiple
viewports;
* There are no more unnecessary framebuffer flips on CPU on Cocoa
and GTK;
* The platform-dependent GL code is now confined to rendergl1.cpp.
* The Microsoft and Apple headers required by it that are prone to
identifier conflicts are no longer included globally;
* The rendergl1.cpp implementation can now be omitted from
compilation to run SolveSpace headless or with a different
OpenGL version.
Note these implementation details of Canvas:
* GetCamera currently always returns a reference to the field
`Camera camera;`. This is so that a future renderer that caches
geometry in the video memory can define it as asserting, which
would provide assurance against code that could accidentally
put something projection-dependent in the cache;
* Line and triangle rendering is specified through a level of
indirection, hStroke and hFill. This is so that a future renderer
that batches geometry could cheaply group identical styles.
* DrawPixmap and DrawVectorText accept a (o,u,v) and not a matrix.
This is so that a future renderer into an output format that
uses 2d transforms (e.g. SVG) could easily derive those.
Some additional internal changes were required to enable this:
* Pixmap is now always passed as std::shared_ptr<{const ,}Pixmap>.
This is so that the renderer could cache uploaded textures
between API calls, which requires it to capture a (weak)
reference.
* The PlatformPathEqual function was properly extracted into
platform-specific code. This is so that the <windows.h> header
could be included only where needed (in platform/w32* as well
as rendergl1.cpp).
* The SBsp{2,3}::DebugDraw functions were removed. They can be
rewritten using the Canvas API if they are ever needed.
While no visual changes were originally intended, some minor fixes
happened anyway:
* The "emphasis" yellow line from top-left corner is now correctly
rendered much wider.
* The marquee rectangle is now pixel grid aligned.
* The hidden entities now do not clobber the depth buffer, removing
some minor artifacts.
* The workplane "tab" now scales with the font used to render
the workplane name.
* The workplane name font is now taken from the normals style.
* Workplane and constraint line stipple is insignificantly
different. This is so that it can reuse the existing stipple
codepaths; rendering of workplanes and constraints predates
those.
Some debug functionality was added:
* In graphics window, an fps counter that becomes red when
rendering under 60fps is drawn.
2016-05-31 00:55:13 +00:00
|
|
|
bool DrawOrHitTestColorPicker(UiCanvas *canvas, DrawOrHitHow how,
|
|
|
|
bool leftDown, double x, double y);
|
2015-03-29 00:30:52 +00:00
|
|
|
|
2016-05-05 05:54:05 +00:00
|
|
|
void Init();
|
2010-04-26 07:52:49 +00:00
|
|
|
void MakeColorTable(const Color *in, float *out);
|
2013-08-26 18:58:35 +00:00
|
|
|
void Printf(bool half, const char *fmt, ...);
|
2016-05-05 05:54:05 +00:00
|
|
|
void ClearScreen();
|
2015-03-29 00:30:52 +00:00
|
|
|
|
2016-05-05 05:54:05 +00:00
|
|
|
void Show();
|
2008-04-11 12:47:14 +00:00
|
|
|
|
2008-04-12 14:12:26 +00:00
|
|
|
// State for the screen that we are showing in the text window.
|
Convert all enumerations to use `enum class`.
Specifically, take the old code that looks like this:
class Foo {
enum { X = 1, Y = 2 };
int kind;
}
... foo.kind = Foo::X; ...
and convert it to this:
class Foo {
enum class Kind : uint32_t { X = 1, Y = 2 };
Kind kind;
}
... foo.kind = Foo::Kind::X;
(In some cases the enumeration would not be in the class namespace,
such as when it is generally useful.)
The benefits are as follows:
* The type of the field gives a clear indication of intent, both
to humans and tools (such as binding generators).
* The compiler is able to automatically warn when a switch is not
exhaustive; but this is currently suppressed by the
default: ssassert(false, ...)
idiom.
* Integers and plain enums are weakly type checked: they implicitly
convert into each other. This can hide bugs where type conversion
is performed but not intended. Enum classes are strongly type
checked.
* Plain enums pollute parent namespaces; enum classes do not.
Almost every defined enum we have already has a kind of ad-hoc
namespacing via `NAMESPACE_`, which is now explicit.
* Plain enums do not have a well-defined ABI size, which is
important for bindings. Enum classes can have it, if specified.
We specify the base type for all enums as uint32_t, which is
a safe choice and allows us to not change the numeric values
of any variants.
This commit introduces absolutely no functional change to the code,
just renaming and change of types. It handles almost all cases,
except GraphicsWindow::pending.operation, which needs minor
functional change.
2016-05-20 08:31:20 +00:00
|
|
|
enum class Screen : uint32_t {
|
|
|
|
LIST_OF_GROUPS = 0,
|
|
|
|
GROUP_INFO = 1,
|
|
|
|
GROUP_SOLVE_INFO = 2,
|
|
|
|
CONFIGURATION = 3,
|
|
|
|
STEP_DIMENSION = 4,
|
|
|
|
LIST_OF_STYLES = 5,
|
|
|
|
STYLE_INFO = 6,
|
|
|
|
PASTE_TRANSFORMED = 7,
|
|
|
|
EDIT_VIEW = 8,
|
|
|
|
TANGENT_ARC = 9
|
2013-09-09 19:50:32 +00:00
|
|
|
};
|
2008-04-12 14:12:26 +00:00
|
|
|
typedef struct {
|
Convert all enumerations to use `enum class`.
Specifically, take the old code that looks like this:
class Foo {
enum { X = 1, Y = 2 };
int kind;
}
... foo.kind = Foo::X; ...
and convert it to this:
class Foo {
enum class Kind : uint32_t { X = 1, Y = 2 };
Kind kind;
}
... foo.kind = Foo::Kind::X;
(In some cases the enumeration would not be in the class namespace,
such as when it is generally useful.)
The benefits are as follows:
* The type of the field gives a clear indication of intent, both
to humans and tools (such as binding generators).
* The compiler is able to automatically warn when a switch is not
exhaustive; but this is currently suppressed by the
default: ssassert(false, ...)
idiom.
* Integers and plain enums are weakly type checked: they implicitly
convert into each other. This can hide bugs where type conversion
is performed but not intended. Enum classes are strongly type
checked.
* Plain enums pollute parent namespaces; enum classes do not.
Almost every defined enum we have already has a kind of ad-hoc
namespacing via `NAMESPACE_`, which is now explicit.
* Plain enums do not have a well-defined ABI size, which is
important for bindings. Enum classes can have it, if specified.
We specify the base type for all enums as uint32_t, which is
a safe choice and allows us to not change the numeric values
of any variants.
This commit introduces absolutely no functional change to the code,
just renaming and change of types. It handles almost all cases,
except GraphicsWindow::pending.operation, which needs minor
functional change.
2016-05-20 08:31:20 +00:00
|
|
|
Screen screen;
|
2008-07-20 11:27:22 +00:00
|
|
|
|
2008-04-25 08:26:15 +00:00
|
|
|
hGroup group;
|
2009-09-18 08:14:15 +00:00
|
|
|
hStyle style;
|
2008-07-20 11:27:22 +00:00
|
|
|
|
|
|
|
hConstraint constraint;
|
|
|
|
bool dimIsDistance;
|
|
|
|
double dimFinish;
|
|
|
|
int dimSteps;
|
2009-12-15 12:26:22 +00:00
|
|
|
|
|
|
|
struct {
|
|
|
|
int times;
|
|
|
|
Vector trans;
|
|
|
|
double theta;
|
|
|
|
Vector origin;
|
|
|
|
double scale;
|
|
|
|
} paste;
|
2008-04-12 14:12:26 +00:00
|
|
|
} ShownState;
|
2008-07-10 06:11:56 +00:00
|
|
|
ShownState shown;
|
2008-04-12 14:12:26 +00:00
|
|
|
|
Convert all enumerations to use `enum class`.
Specifically, take the old code that looks like this:
class Foo {
enum { X = 1, Y = 2 };
int kind;
}
... foo.kind = Foo::X; ...
and convert it to this:
class Foo {
enum class Kind : uint32_t { X = 1, Y = 2 };
Kind kind;
}
... foo.kind = Foo::Kind::X;
(In some cases the enumeration would not be in the class namespace,
such as when it is generally useful.)
The benefits are as follows:
* The type of the field gives a clear indication of intent, both
to humans and tools (such as binding generators).
* The compiler is able to automatically warn when a switch is not
exhaustive; but this is currently suppressed by the
default: ssassert(false, ...)
idiom.
* Integers and plain enums are weakly type checked: they implicitly
convert into each other. This can hide bugs where type conversion
is performed but not intended. Enum classes are strongly type
checked.
* Plain enums pollute parent namespaces; enum classes do not.
Almost every defined enum we have already has a kind of ad-hoc
namespacing via `NAMESPACE_`, which is now explicit.
* Plain enums do not have a well-defined ABI size, which is
important for bindings. Enum classes can have it, if specified.
We specify the base type for all enums as uint32_t, which is
a safe choice and allows us to not change the numeric values
of any variants.
This commit introduces absolutely no functional change to the code,
just renaming and change of types. It handles almost all cases,
except GraphicsWindow::pending.operation, which needs minor
functional change.
2016-05-20 08:31:20 +00:00
|
|
|
enum class Edit : uint32_t {
|
|
|
|
NOTHING = 0,
|
2013-09-09 19:50:32 +00:00
|
|
|
// For multiple groups
|
Convert all enumerations to use `enum class`.
Specifically, take the old code that looks like this:
class Foo {
enum { X = 1, Y = 2 };
int kind;
}
... foo.kind = Foo::X; ...
and convert it to this:
class Foo {
enum class Kind : uint32_t { X = 1, Y = 2 };
Kind kind;
}
... foo.kind = Foo::Kind::X;
(In some cases the enumeration would not be in the class namespace,
such as when it is generally useful.)
The benefits are as follows:
* The type of the field gives a clear indication of intent, both
to humans and tools (such as binding generators).
* The compiler is able to automatically warn when a switch is not
exhaustive; but this is currently suppressed by the
default: ssassert(false, ...)
idiom.
* Integers and plain enums are weakly type checked: they implicitly
convert into each other. This can hide bugs where type conversion
is performed but not intended. Enum classes are strongly type
checked.
* Plain enums pollute parent namespaces; enum classes do not.
Almost every defined enum we have already has a kind of ad-hoc
namespacing via `NAMESPACE_`, which is now explicit.
* Plain enums do not have a well-defined ABI size, which is
important for bindings. Enum classes can have it, if specified.
We specify the base type for all enums as uint32_t, which is
a safe choice and allows us to not change the numeric values
of any variants.
This commit introduces absolutely no functional change to the code,
just renaming and change of types. It handles almost all cases,
except GraphicsWindow::pending.operation, which needs minor
functional change.
2016-05-20 08:31:20 +00:00
|
|
|
TIMES_REPEATED = 1,
|
|
|
|
GROUP_NAME = 2,
|
|
|
|
GROUP_SCALE = 3,
|
|
|
|
GROUP_COLOR = 4,
|
|
|
|
GROUP_OPACITY = 5,
|
2013-09-09 19:50:32 +00:00
|
|
|
// For the configuraiton screen
|
Convert all enumerations to use `enum class`.
Specifically, take the old code that looks like this:
class Foo {
enum { X = 1, Y = 2 };
int kind;
}
... foo.kind = Foo::X; ...
and convert it to this:
class Foo {
enum class Kind : uint32_t { X = 1, Y = 2 };
Kind kind;
}
... foo.kind = Foo::Kind::X;
(In some cases the enumeration would not be in the class namespace,
such as when it is generally useful.)
The benefits are as follows:
* The type of the field gives a clear indication of intent, both
to humans and tools (such as binding generators).
* The compiler is able to automatically warn when a switch is not
exhaustive; but this is currently suppressed by the
default: ssassert(false, ...)
idiom.
* Integers and plain enums are weakly type checked: they implicitly
convert into each other. This can hide bugs where type conversion
is performed but not intended. Enum classes are strongly type
checked.
* Plain enums pollute parent namespaces; enum classes do not.
Almost every defined enum we have already has a kind of ad-hoc
namespacing via `NAMESPACE_`, which is now explicit.
* Plain enums do not have a well-defined ABI size, which is
important for bindings. Enum classes can have it, if specified.
We specify the base type for all enums as uint32_t, which is
a safe choice and allows us to not change the numeric values
of any variants.
This commit introduces absolutely no functional change to the code,
just renaming and change of types. It handles almost all cases,
except GraphicsWindow::pending.operation, which needs minor
functional change.
2016-05-20 08:31:20 +00:00
|
|
|
LIGHT_DIRECTION = 100,
|
|
|
|
LIGHT_INTENSITY = 101,
|
|
|
|
COLOR = 102,
|
|
|
|
CHORD_TOLERANCE = 103,
|
|
|
|
MAX_SEGMENTS = 104,
|
|
|
|
CAMERA_TANGENT = 105,
|
|
|
|
GRID_SPACING = 106,
|
|
|
|
DIGITS_AFTER_DECIMAL = 107,
|
|
|
|
EXPORT_SCALE = 108,
|
|
|
|
EXPORT_OFFSET = 109,
|
|
|
|
CANVAS_SIZE = 110,
|
|
|
|
G_CODE_DEPTH = 120,
|
|
|
|
G_CODE_PASSES = 121,
|
|
|
|
G_CODE_FEED = 122,
|
|
|
|
G_CODE_PLUNGE_FEED = 123,
|
|
|
|
AUTOSAVE_INTERVAL = 124,
|
2013-09-09 19:50:32 +00:00
|
|
|
// For TTF text
|
Convert all enumerations to use `enum class`.
Specifically, take the old code that looks like this:
class Foo {
enum { X = 1, Y = 2 };
int kind;
}
... foo.kind = Foo::X; ...
and convert it to this:
class Foo {
enum class Kind : uint32_t { X = 1, Y = 2 };
Kind kind;
}
... foo.kind = Foo::Kind::X;
(In some cases the enumeration would not be in the class namespace,
such as when it is generally useful.)
The benefits are as follows:
* The type of the field gives a clear indication of intent, both
to humans and tools (such as binding generators).
* The compiler is able to automatically warn when a switch is not
exhaustive; but this is currently suppressed by the
default: ssassert(false, ...)
idiom.
* Integers and plain enums are weakly type checked: they implicitly
convert into each other. This can hide bugs where type conversion
is performed but not intended. Enum classes are strongly type
checked.
* Plain enums pollute parent namespaces; enum classes do not.
Almost every defined enum we have already has a kind of ad-hoc
namespacing via `NAMESPACE_`, which is now explicit.
* Plain enums do not have a well-defined ABI size, which is
important for bindings. Enum classes can have it, if specified.
We specify the base type for all enums as uint32_t, which is
a safe choice and allows us to not change the numeric values
of any variants.
This commit introduces absolutely no functional change to the code,
just renaming and change of types. It handles almost all cases,
except GraphicsWindow::pending.operation, which needs minor
functional change.
2016-05-20 08:31:20 +00:00
|
|
|
TTF_TEXT = 300,
|
2013-09-09 19:50:32 +00:00
|
|
|
// For the step dimension screen
|
Convert all enumerations to use `enum class`.
Specifically, take the old code that looks like this:
class Foo {
enum { X = 1, Y = 2 };
int kind;
}
... foo.kind = Foo::X; ...
and convert it to this:
class Foo {
enum class Kind : uint32_t { X = 1, Y = 2 };
Kind kind;
}
... foo.kind = Foo::Kind::X;
(In some cases the enumeration would not be in the class namespace,
such as when it is generally useful.)
The benefits are as follows:
* The type of the field gives a clear indication of intent, both
to humans and tools (such as binding generators).
* The compiler is able to automatically warn when a switch is not
exhaustive; but this is currently suppressed by the
default: ssassert(false, ...)
idiom.
* Integers and plain enums are weakly type checked: they implicitly
convert into each other. This can hide bugs where type conversion
is performed but not intended. Enum classes are strongly type
checked.
* Plain enums pollute parent namespaces; enum classes do not.
Almost every defined enum we have already has a kind of ad-hoc
namespacing via `NAMESPACE_`, which is now explicit.
* Plain enums do not have a well-defined ABI size, which is
important for bindings. Enum classes can have it, if specified.
We specify the base type for all enums as uint32_t, which is
a safe choice and allows us to not change the numeric values
of any variants.
This commit introduces absolutely no functional change to the code,
just renaming and change of types. It handles almost all cases,
except GraphicsWindow::pending.operation, which needs minor
functional change.
2016-05-20 08:31:20 +00:00
|
|
|
STEP_DIM_FINISH = 400,
|
|
|
|
STEP_DIM_STEPS = 401,
|
2013-09-09 19:50:32 +00:00
|
|
|
// For the styles stuff
|
Convert all enumerations to use `enum class`.
Specifically, take the old code that looks like this:
class Foo {
enum { X = 1, Y = 2 };
int kind;
}
... foo.kind = Foo::X; ...
and convert it to this:
class Foo {
enum class Kind : uint32_t { X = 1, Y = 2 };
Kind kind;
}
... foo.kind = Foo::Kind::X;
(In some cases the enumeration would not be in the class namespace,
such as when it is generally useful.)
The benefits are as follows:
* The type of the field gives a clear indication of intent, both
to humans and tools (such as binding generators).
* The compiler is able to automatically warn when a switch is not
exhaustive; but this is currently suppressed by the
default: ssassert(false, ...)
idiom.
* Integers and plain enums are weakly type checked: they implicitly
convert into each other. This can hide bugs where type conversion
is performed but not intended. Enum classes are strongly type
checked.
* Plain enums pollute parent namespaces; enum classes do not.
Almost every defined enum we have already has a kind of ad-hoc
namespacing via `NAMESPACE_`, which is now explicit.
* Plain enums do not have a well-defined ABI size, which is
important for bindings. Enum classes can have it, if specified.
We specify the base type for all enums as uint32_t, which is
a safe choice and allows us to not change the numeric values
of any variants.
This commit introduces absolutely no functional change to the code,
just renaming and change of types. It handles almost all cases,
except GraphicsWindow::pending.operation, which needs minor
functional change.
2016-05-20 08:31:20 +00:00
|
|
|
STYLE_WIDTH = 500,
|
|
|
|
STYLE_TEXT_HEIGHT = 501,
|
|
|
|
STYLE_TEXT_ANGLE = 502,
|
|
|
|
STYLE_COLOR = 503,
|
|
|
|
STYLE_FILL_COLOR = 504,
|
|
|
|
STYLE_NAME = 505,
|
|
|
|
BACKGROUND_COLOR = 506,
|
|
|
|
STYLE_STIPPLE_PERIOD = 508,
|
2013-09-09 19:50:32 +00:00
|
|
|
// For paste transforming
|
Convert all enumerations to use `enum class`.
Specifically, take the old code that looks like this:
class Foo {
enum { X = 1, Y = 2 };
int kind;
}
... foo.kind = Foo::X; ...
and convert it to this:
class Foo {
enum class Kind : uint32_t { X = 1, Y = 2 };
Kind kind;
}
... foo.kind = Foo::Kind::X;
(In some cases the enumeration would not be in the class namespace,
such as when it is generally useful.)
The benefits are as follows:
* The type of the field gives a clear indication of intent, both
to humans and tools (such as binding generators).
* The compiler is able to automatically warn when a switch is not
exhaustive; but this is currently suppressed by the
default: ssassert(false, ...)
idiom.
* Integers and plain enums are weakly type checked: they implicitly
convert into each other. This can hide bugs where type conversion
is performed but not intended. Enum classes are strongly type
checked.
* Plain enums pollute parent namespaces; enum classes do not.
Almost every defined enum we have already has a kind of ad-hoc
namespacing via `NAMESPACE_`, which is now explicit.
* Plain enums do not have a well-defined ABI size, which is
important for bindings. Enum classes can have it, if specified.
We specify the base type for all enums as uint32_t, which is
a safe choice and allows us to not change the numeric values
of any variants.
This commit introduces absolutely no functional change to the code,
just renaming and change of types. It handles almost all cases,
except GraphicsWindow::pending.operation, which needs minor
functional change.
2016-05-20 08:31:20 +00:00
|
|
|
PASTE_TIMES_REPEATED = 600,
|
|
|
|
PASTE_ANGLE = 601,
|
|
|
|
PASTE_SCALE = 602,
|
2013-09-09 19:50:32 +00:00
|
|
|
// For view
|
Convert all enumerations to use `enum class`.
Specifically, take the old code that looks like this:
class Foo {
enum { X = 1, Y = 2 };
int kind;
}
... foo.kind = Foo::X; ...
and convert it to this:
class Foo {
enum class Kind : uint32_t { X = 1, Y = 2 };
Kind kind;
}
... foo.kind = Foo::Kind::X;
(In some cases the enumeration would not be in the class namespace,
such as when it is generally useful.)
The benefits are as follows:
* The type of the field gives a clear indication of intent, both
to humans and tools (such as binding generators).
* The compiler is able to automatically warn when a switch is not
exhaustive; but this is currently suppressed by the
default: ssassert(false, ...)
idiom.
* Integers and plain enums are weakly type checked: they implicitly
convert into each other. This can hide bugs where type conversion
is performed but not intended. Enum classes are strongly type
checked.
* Plain enums pollute parent namespaces; enum classes do not.
Almost every defined enum we have already has a kind of ad-hoc
namespacing via `NAMESPACE_`, which is now explicit.
* Plain enums do not have a well-defined ABI size, which is
important for bindings. Enum classes can have it, if specified.
We specify the base type for all enums as uint32_t, which is
a safe choice and allows us to not change the numeric values
of any variants.
This commit introduces absolutely no functional change to the code,
just renaming and change of types. It handles almost all cases,
except GraphicsWindow::pending.operation, which needs minor
functional change.
2016-05-20 08:31:20 +00:00
|
|
|
VIEW_SCALE = 700,
|
|
|
|
VIEW_ORIGIN = 701,
|
|
|
|
VIEW_PROJ_RIGHT = 702,
|
|
|
|
VIEW_PROJ_UP = 703,
|
2013-09-09 19:50:32 +00:00
|
|
|
// For tangent arc
|
Convert all enumerations to use `enum class`.
Specifically, take the old code that looks like this:
class Foo {
enum { X = 1, Y = 2 };
int kind;
}
... foo.kind = Foo::X; ...
and convert it to this:
class Foo {
enum class Kind : uint32_t { X = 1, Y = 2 };
Kind kind;
}
... foo.kind = Foo::Kind::X;
(In some cases the enumeration would not be in the class namespace,
such as when it is generally useful.)
The benefits are as follows:
* The type of the field gives a clear indication of intent, both
to humans and tools (such as binding generators).
* The compiler is able to automatically warn when a switch is not
exhaustive; but this is currently suppressed by the
default: ssassert(false, ...)
idiom.
* Integers and plain enums are weakly type checked: they implicitly
convert into each other. This can hide bugs where type conversion
is performed but not intended. Enum classes are strongly type
checked.
* Plain enums pollute parent namespaces; enum classes do not.
Almost every defined enum we have already has a kind of ad-hoc
namespacing via `NAMESPACE_`, which is now explicit.
* Plain enums do not have a well-defined ABI size, which is
important for bindings. Enum classes can have it, if specified.
We specify the base type for all enums as uint32_t, which is
a safe choice and allows us to not change the numeric values
of any variants.
This commit introduces absolutely no functional change to the code,
just renaming and change of types. It handles almost all cases,
except GraphicsWindow::pending.operation, which needs minor
functional change.
2016-05-20 08:31:20 +00:00
|
|
|
TANGENT_ARC_RADIUS = 800
|
2013-09-09 19:50:32 +00:00
|
|
|
};
|
2008-05-27 06:36:59 +00:00
|
|
|
struct {
|
2010-01-04 00:35:28 +00:00
|
|
|
bool showAgain;
|
Convert all enumerations to use `enum class`.
Specifically, take the old code that looks like this:
class Foo {
enum { X = 1, Y = 2 };
int kind;
}
... foo.kind = Foo::X; ...
and convert it to this:
class Foo {
enum class Kind : uint32_t { X = 1, Y = 2 };
Kind kind;
}
... foo.kind = Foo::Kind::X;
(In some cases the enumeration would not be in the class namespace,
such as when it is generally useful.)
The benefits are as follows:
* The type of the field gives a clear indication of intent, both
to humans and tools (such as binding generators).
* The compiler is able to automatically warn when a switch is not
exhaustive; but this is currently suppressed by the
default: ssassert(false, ...)
idiom.
* Integers and plain enums are weakly type checked: they implicitly
convert into each other. This can hide bugs where type conversion
is performed but not intended. Enum classes are strongly type
checked.
* Plain enums pollute parent namespaces; enum classes do not.
Almost every defined enum we have already has a kind of ad-hoc
namespacing via `NAMESPACE_`, which is now explicit.
* Plain enums do not have a well-defined ABI size, which is
important for bindings. Enum classes can have it, if specified.
We specify the base type for all enums as uint32_t, which is
a safe choice and allows us to not change the numeric values
of any variants.
This commit introduces absolutely no functional change to the code,
just renaming and change of types. It handles almost all cases,
except GraphicsWindow::pending.operation, which needs minor
functional change.
2016-05-20 08:31:20 +00:00
|
|
|
Edit meaning;
|
2008-06-30 09:09:17 +00:00
|
|
|
int i;
|
|
|
|
hGroup group;
|
|
|
|
hRequest request;
|
2009-09-18 08:14:15 +00:00
|
|
|
hStyle style;
|
2008-05-27 06:36:59 +00:00
|
|
|
} edit;
|
|
|
|
|
2008-05-26 09:56:50 +00:00
|
|
|
static void ReportHowGroupSolved(hGroup hg);
|
|
|
|
|
2010-07-12 07:51:12 +00:00
|
|
|
struct {
|
|
|
|
int halfRow;
|
|
|
|
int col;
|
|
|
|
|
2010-07-21 05:04:03 +00:00
|
|
|
struct {
|
2015-07-10 11:54:39 +00:00
|
|
|
RgbaColor rgb;
|
|
|
|
double h, s, v;
|
|
|
|
bool show;
|
|
|
|
bool picker1dActive;
|
|
|
|
bool picker2dActive;
|
2010-07-21 05:04:03 +00:00
|
|
|
} colorPicker;
|
2010-07-12 07:51:12 +00:00
|
|
|
} editControl;
|
|
|
|
|
2016-05-05 05:54:05 +00:00
|
|
|
void HideEditControl();
|
2016-01-26 11:19:52 +00:00
|
|
|
void ShowEditControl(int col, const std::string &str, int halfRow = -1);
|
|
|
|
void ShowEditControlWithColorPicker(int col, RgbaColor rgb);
|
2010-07-12 07:51:12 +00:00
|
|
|
|
2016-05-05 05:54:05 +00:00
|
|
|
void ClearSuper();
|
2008-06-01 00:26:41 +00:00
|
|
|
|
|
|
|
void ShowHeader(bool withNav);
|
2008-04-08 12:54:53 +00:00
|
|
|
// These are self-contained screens, that show some information about
|
|
|
|
// the sketch.
|
2016-05-05 05:54:05 +00:00
|
|
|
void ShowListOfGroups();
|
|
|
|
void ShowGroupInfo();
|
|
|
|
void ShowGroupSolveInfo();
|
|
|
|
void ShowConfiguration();
|
|
|
|
void ShowListOfStyles();
|
|
|
|
void ShowStyleInfo();
|
|
|
|
void ShowStepDimension();
|
|
|
|
void ShowPasteTransformed();
|
|
|
|
void ShowEditView();
|
|
|
|
void ShowTangentArc();
|
2008-06-01 00:26:41 +00:00
|
|
|
// Special screen, based on selection
|
2016-05-05 05:54:05 +00:00
|
|
|
void DescribeSelection();
|
2008-04-18 07:06:37 +00:00
|
|
|
|
Convert all enumerations to use `enum class`.
Specifically, take the old code that looks like this:
class Foo {
enum { X = 1, Y = 2 };
int kind;
}
... foo.kind = Foo::X; ...
and convert it to this:
class Foo {
enum class Kind : uint32_t { X = 1, Y = 2 };
Kind kind;
}
... foo.kind = Foo::Kind::X;
(In some cases the enumeration would not be in the class namespace,
such as when it is generally useful.)
The benefits are as follows:
* The type of the field gives a clear indication of intent, both
to humans and tools (such as binding generators).
* The compiler is able to automatically warn when a switch is not
exhaustive; but this is currently suppressed by the
default: ssassert(false, ...)
idiom.
* Integers and plain enums are weakly type checked: they implicitly
convert into each other. This can hide bugs where type conversion
is performed but not intended. Enum classes are strongly type
checked.
* Plain enums pollute parent namespaces; enum classes do not.
Almost every defined enum we have already has a kind of ad-hoc
namespacing via `NAMESPACE_`, which is now explicit.
* Plain enums do not have a well-defined ABI size, which is
important for bindings. Enum classes can have it, if specified.
We specify the base type for all enums as uint32_t, which is
a safe choice and allows us to not change the numeric values
of any variants.
This commit introduces absolutely no functional change to the code,
just renaming and change of types. It handles almost all cases,
except GraphicsWindow::pending.operation, which needs minor
functional change.
2016-05-20 08:31:20 +00:00
|
|
|
void GoToScreen(Screen screen);
|
2008-05-27 06:36:59 +00:00
|
|
|
|
2008-06-30 09:09:17 +00:00
|
|
|
// All of these are callbacks from the GUI code; first from when
|
|
|
|
// we're describing an entity
|
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
|
|
|
static void ScreenEditTtfText(int link, uint32_t v);
|
|
|
|
static void ScreenSetTtfFont(int link, uint32_t v);
|
|
|
|
static void ScreenUnselectAll(int link, uint32_t v);
|
2008-06-30 09:09:17 +00:00
|
|
|
|
2015-03-22 13:07:49 +00:00
|
|
|
// when we're describing a constraint
|
|
|
|
static void ScreenConstraintShowAsRadius(int link, uint32_t v);
|
|
|
|
|
2008-06-30 09:09:17 +00:00
|
|
|
// and the rest from the stuff in textscreens.cpp
|
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
|
|
|
static void ScreenSelectGroup(int link, uint32_t v);
|
|
|
|
static void ScreenActivateGroup(int link, uint32_t v);
|
|
|
|
static void ScreenToggleGroupShown(int link, uint32_t v);
|
|
|
|
static void ScreenHowGroupSolved(int link, uint32_t v);
|
|
|
|
static void ScreenShowGroupsSpecial(int link, uint32_t v);
|
|
|
|
static void ScreenDeleteGroup(int link, uint32_t v);
|
|
|
|
|
|
|
|
static void ScreenHoverConstraint(int link, uint32_t v);
|
|
|
|
static void ScreenHoverRequest(int link, uint32_t v);
|
|
|
|
static void ScreenSelectRequest(int link, uint32_t v);
|
|
|
|
static void ScreenSelectConstraint(int link, uint32_t v);
|
|
|
|
|
|
|
|
static void ScreenChangeGroupOption(int link, uint32_t v);
|
|
|
|
static void ScreenColor(int link, uint32_t v);
|
2015-03-26 10:30:12 +00:00
|
|
|
static void ScreenOpacity(int link, uint32_t v);
|
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
|
|
|
|
|
|
|
static void ScreenShowListOfStyles(int link, uint32_t v);
|
|
|
|
static void ScreenShowStyleInfo(int link, uint32_t v);
|
|
|
|
static void ScreenDeleteStyle(int link, uint32_t v);
|
2016-02-23 18:00:39 +00:00
|
|
|
static void ScreenChangeStylePatternType(int link, uint32_t v);
|
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
|
|
|
static void ScreenChangeStyleYesNo(int link, uint32_t v);
|
|
|
|
static void ScreenCreateCustomStyle(int link, uint32_t v);
|
|
|
|
static void ScreenLoadFactoryDefaultStyles(int link, uint32_t v);
|
|
|
|
static void ScreenAssignSelectionToStyle(int link, uint32_t v);
|
|
|
|
|
|
|
|
static void ScreenShowConfiguration(int link, uint32_t v);
|
|
|
|
static void ScreenShowEditView(int link, uint32_t v);
|
|
|
|
static void ScreenGoToWebsite(int link, uint32_t v);
|
|
|
|
|
|
|
|
static void ScreenChangeFixExportColors(int link, uint32_t v);
|
|
|
|
static void ScreenChangeBackFaces(int link, uint32_t v);
|
2017-03-30 14:39:42 +00:00
|
|
|
static void ScreenChangeShowContourAreas(int link, uint32_t v);
|
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
|
|
|
static void ScreenChangeCheckClosedContour(int link, uint32_t v);
|
|
|
|
static void ScreenChangePwlCurves(int link, uint32_t v);
|
|
|
|
static void ScreenChangeCanvasSizeAuto(int link, uint32_t v);
|
|
|
|
static void ScreenChangeCanvasSize(int link, uint32_t v);
|
|
|
|
static void ScreenChangeShadedTriangles(int link, uint32_t v);
|
|
|
|
|
2016-01-21 15:01:43 +00:00
|
|
|
static void ScreenAllowRedundant(int link, uint32_t v);
|
|
|
|
|
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
|
|
|
static void ScreenStepDimSteps(int link, uint32_t v);
|
|
|
|
static void ScreenStepDimFinish(int link, uint32_t v);
|
|
|
|
static void ScreenStepDimGo(int link, uint32_t v);
|
|
|
|
|
|
|
|
static void ScreenChangeTangentArc(int link, uint32_t v);
|
|
|
|
|
|
|
|
static void ScreenPasteTransformed(int link, uint32_t v);
|
|
|
|
|
|
|
|
static void ScreenHome(int link, uint32_t v);
|
2008-06-02 05:38:12 +00:00
|
|
|
|
2008-05-27 09:52:36 +00:00
|
|
|
// These ones do stuff with the edit control
|
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
|
|
|
static void ScreenChangeExprA(int link, uint32_t v);
|
|
|
|
static void ScreenChangeGroupName(int link, uint32_t v);
|
|
|
|
static void ScreenChangeGroupScale(int link, uint32_t v);
|
|
|
|
static void ScreenChangeLightDirection(int link, uint32_t v);
|
|
|
|
static void ScreenChangeLightIntensity(int link, uint32_t v);
|
|
|
|
static void ScreenChangeColor(int link, uint32_t v);
|
|
|
|
static void ScreenChangeChordTolerance(int link, uint32_t v);
|
|
|
|
static void ScreenChangeMaxSegments(int link, uint32_t v);
|
2016-01-27 04:07:54 +00:00
|
|
|
static void ScreenChangeExportChordTolerance(int link, uint32_t v);
|
|
|
|
static void ScreenChangeExportMaxSegments(int link, uint32_t v);
|
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
|
|
|
static void ScreenChangeCameraTangent(int link, uint32_t v);
|
|
|
|
static void ScreenChangeGridSpacing(int link, uint32_t v);
|
|
|
|
static void ScreenChangeDigitsAfterDecimal(int link, uint32_t v);
|
|
|
|
static void ScreenChangeExportScale(int link, uint32_t v);
|
|
|
|
static void ScreenChangeExportOffset(int link, uint32_t v);
|
|
|
|
static void ScreenChangeGCodeParameter(int link, uint32_t v);
|
2015-03-29 04:46:57 +00:00
|
|
|
static void ScreenChangeAutosaveInterval(int link, uint32_t v);
|
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
|
|
|
static void ScreenChangeStyleName(int link, uint32_t v);
|
2016-02-23 18:00:39 +00:00
|
|
|
static void ScreenChangeStyleMetric(int link, uint32_t v);
|
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
|
|
|
static void ScreenChangeStyleTextAngle(int link, uint32_t v);
|
|
|
|
static void ScreenChangeStyleColor(int link, uint32_t v);
|
|
|
|
static void ScreenChangeBackgroundColor(int link, uint32_t v);
|
|
|
|
static void ScreenChangePasteTransformed(int link, uint32_t v);
|
|
|
|
static void ScreenChangeViewScale(int link, uint32_t v);
|
2016-08-01 13:44:38 +00:00
|
|
|
static void ScreenChangeViewToFullScale(int link, uint32_t v);
|
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
|
|
|
static void ScreenChangeViewOrigin(int link, uint32_t v);
|
|
|
|
static void ScreenChangeViewProjection(int link, uint32_t v);
|
2008-05-17 08:02:39 +00:00
|
|
|
|
2013-09-16 19:51:20 +00:00
|
|
|
bool EditControlDoneForStyles(const char *s);
|
|
|
|
bool EditControlDoneForConfiguration(const char *s);
|
|
|
|
bool EditControlDoneForPaste(const char *s);
|
|
|
|
bool EditControlDoneForView(const char *s);
|
|
|
|
void EditControlDone(const char *s);
|
2008-03-28 10:00:37 +00:00
|
|
|
};
|
2008-03-25 10:02:13 +00:00
|
|
|
|
2008-03-28 10:00:37 +00:00
|
|
|
class GraphicsWindow {
|
|
|
|
public:
|
2016-05-05 05:54:05 +00:00
|
|
|
void Init();
|
2008-04-12 15:17:58 +00:00
|
|
|
|
Convert all enumerations to use `enum class`.
Specifically, take the old code that looks like this:
class Foo {
enum { X = 1, Y = 2 };
int kind;
}
... foo.kind = Foo::X; ...
and convert it to this:
class Foo {
enum class Kind : uint32_t { X = 1, Y = 2 };
Kind kind;
}
... foo.kind = Foo::Kind::X;
(In some cases the enumeration would not be in the class namespace,
such as when it is generally useful.)
The benefits are as follows:
* The type of the field gives a clear indication of intent, both
to humans and tools (such as binding generators).
* The compiler is able to automatically warn when a switch is not
exhaustive; but this is currently suppressed by the
default: ssassert(false, ...)
idiom.
* Integers and plain enums are weakly type checked: they implicitly
convert into each other. This can hide bugs where type conversion
is performed but not intended. Enum classes are strongly type
checked.
* Plain enums pollute parent namespaces; enum classes do not.
Almost every defined enum we have already has a kind of ad-hoc
namespacing via `NAMESPACE_`, which is now explicit.
* Plain enums do not have a well-defined ABI size, which is
important for bindings. Enum classes can have it, if specified.
We specify the base type for all enums as uint32_t, which is
a safe choice and allows us to not change the numeric values
of any variants.
This commit introduces absolutely no functional change to the code,
just renaming and change of types. It handles almost all cases,
except GraphicsWindow::pending.operation, which needs minor
functional change.
2016-05-20 08:31:20 +00:00
|
|
|
typedef void MenuHandler(Command id);
|
2013-09-20 17:54:57 +00:00
|
|
|
enum {
|
|
|
|
ESCAPE_KEY = 27,
|
|
|
|
DELETE_KEY = 127,
|
|
|
|
FUNCTION_KEY_BASE = 0xf0
|
|
|
|
};
|
|
|
|
enum {
|
|
|
|
SHIFT_MASK = 0x100,
|
|
|
|
CTRL_MASK = 0x200
|
|
|
|
};
|
Convert all enumerations to use `enum class`.
Specifically, take the old code that looks like this:
class Foo {
enum { X = 1, Y = 2 };
int kind;
}
... foo.kind = Foo::X; ...
and convert it to this:
class Foo {
enum class Kind : uint32_t { X = 1, Y = 2 };
Kind kind;
}
... foo.kind = Foo::Kind::X;
(In some cases the enumeration would not be in the class namespace,
such as when it is generally useful.)
The benefits are as follows:
* The type of the field gives a clear indication of intent, both
to humans and tools (such as binding generators).
* The compiler is able to automatically warn when a switch is not
exhaustive; but this is currently suppressed by the
default: ssassert(false, ...)
idiom.
* Integers and plain enums are weakly type checked: they implicitly
convert into each other. This can hide bugs where type conversion
is performed but not intended. Enum classes are strongly type
checked.
* Plain enums pollute parent namespaces; enum classes do not.
Almost every defined enum we have already has a kind of ad-hoc
namespacing via `NAMESPACE_`, which is now explicit.
* Plain enums do not have a well-defined ABI size, which is
important for bindings. Enum classes can have it, if specified.
We specify the base type for all enums as uint32_t, which is
a safe choice and allows us to not change the numeric values
of any variants.
This commit introduces absolutely no functional change to the code,
just renaming and change of types. It handles almost all cases,
except GraphicsWindow::pending.operation, which needs minor
functional change.
2016-05-20 08:31:20 +00:00
|
|
|
enum class MenuKind : uint32_t {
|
|
|
|
NORMAL = 0,
|
|
|
|
CHECK,
|
|
|
|
RADIO
|
2015-03-18 17:02:11 +00:00
|
|
|
};
|
2008-03-26 09:18:12 +00:00
|
|
|
typedef struct {
|
2015-03-18 17:02:11 +00:00
|
|
|
int level; // 0 == on menu bar, 1 == one level down
|
|
|
|
const char *label; // or NULL for a separator
|
Convert all enumerations to use `enum class`.
Specifically, take the old code that looks like this:
class Foo {
enum { X = 1, Y = 2 };
int kind;
}
... foo.kind = Foo::X; ...
and convert it to this:
class Foo {
enum class Kind : uint32_t { X = 1, Y = 2 };
Kind kind;
}
... foo.kind = Foo::Kind::X;
(In some cases the enumeration would not be in the class namespace,
such as when it is generally useful.)
The benefits are as follows:
* The type of the field gives a clear indication of intent, both
to humans and tools (such as binding generators).
* The compiler is able to automatically warn when a switch is not
exhaustive; but this is currently suppressed by the
default: ssassert(false, ...)
idiom.
* Integers and plain enums are weakly type checked: they implicitly
convert into each other. This can hide bugs where type conversion
is performed but not intended. Enum classes are strongly type
checked.
* Plain enums pollute parent namespaces; enum classes do not.
Almost every defined enum we have already has a kind of ad-hoc
namespacing via `NAMESPACE_`, which is now explicit.
* Plain enums do not have a well-defined ABI size, which is
important for bindings. Enum classes can have it, if specified.
We specify the base type for all enums as uint32_t, which is
a safe choice and allows us to not change the numeric values
of any variants.
This commit introduces absolutely no functional change to the code,
just renaming and change of types. It handles almost all cases,
except GraphicsWindow::pending.operation, which needs minor
functional change.
2016-05-20 08:31:20 +00:00
|
|
|
Command id; // unique ID
|
2015-03-18 17:02:11 +00:00
|
|
|
int accel; // keyboard accelerator
|
Convert all enumerations to use `enum class`.
Specifically, take the old code that looks like this:
class Foo {
enum { X = 1, Y = 2 };
int kind;
}
... foo.kind = Foo::X; ...
and convert it to this:
class Foo {
enum class Kind : uint32_t { X = 1, Y = 2 };
Kind kind;
}
... foo.kind = Foo::Kind::X;
(In some cases the enumeration would not be in the class namespace,
such as when it is generally useful.)
The benefits are as follows:
* The type of the field gives a clear indication of intent, both
to humans and tools (such as binding generators).
* The compiler is able to automatically warn when a switch is not
exhaustive; but this is currently suppressed by the
default: ssassert(false, ...)
idiom.
* Integers and plain enums are weakly type checked: they implicitly
convert into each other. This can hide bugs where type conversion
is performed but not intended. Enum classes are strongly type
checked.
* Plain enums pollute parent namespaces; enum classes do not.
Almost every defined enum we have already has a kind of ad-hoc
namespacing via `NAMESPACE_`, which is now explicit.
* Plain enums do not have a well-defined ABI size, which is
important for bindings. Enum classes can have it, if specified.
We specify the base type for all enums as uint32_t, which is
a safe choice and allows us to not change the numeric values
of any variants.
This commit introduces absolutely no functional change to the code,
just renaming and change of types. It handles almost all cases,
except GraphicsWindow::pending.operation, which needs minor
functional change.
2016-05-20 08:31:20 +00:00
|
|
|
MenuKind kind;
|
2015-03-18 17:02:11 +00:00
|
|
|
MenuHandler *fn;
|
2008-03-26 09:18:12 +00:00
|
|
|
} MenuEntry;
|
|
|
|
static const MenuEntry menu[];
|
Convert all enumerations to use `enum class`.
Specifically, take the old code that looks like this:
class Foo {
enum { X = 1, Y = 2 };
int kind;
}
... foo.kind = Foo::X; ...
and convert it to this:
class Foo {
enum class Kind : uint32_t { X = 1, Y = 2 };
Kind kind;
}
... foo.kind = Foo::Kind::X;
(In some cases the enumeration would not be in the class namespace,
such as when it is generally useful.)
The benefits are as follows:
* The type of the field gives a clear indication of intent, both
to humans and tools (such as binding generators).
* The compiler is able to automatically warn when a switch is not
exhaustive; but this is currently suppressed by the
default: ssassert(false, ...)
idiom.
* Integers and plain enums are weakly type checked: they implicitly
convert into each other. This can hide bugs where type conversion
is performed but not intended. Enum classes are strongly type
checked.
* Plain enums pollute parent namespaces; enum classes do not.
Almost every defined enum we have already has a kind of ad-hoc
namespacing via `NAMESPACE_`, which is now explicit.
* Plain enums do not have a well-defined ABI size, which is
important for bindings. Enum classes can have it, if specified.
We specify the base type for all enums as uint32_t, which is
a safe choice and allows us to not change the numeric values
of any variants.
This commit introduces absolutely no functional change to the code,
just renaming and change of types. It handles almost all cases,
except GraphicsWindow::pending.operation, which needs minor
functional change.
2016-05-20 08:31:20 +00:00
|
|
|
static void MenuView(Command id);
|
|
|
|
static void MenuEdit(Command id);
|
|
|
|
static void MenuRequest(Command id);
|
2016-05-05 05:54:05 +00:00
|
|
|
void DeleteSelection();
|
|
|
|
void CopySelection();
|
2009-12-15 12:26:22 +00:00
|
|
|
void PasteClipboard(Vector trans, double theta, double scale);
|
Convert all enumerations to use `enum class`.
Specifically, take the old code that looks like this:
class Foo {
enum { X = 1, Y = 2 };
int kind;
}
... foo.kind = Foo::X; ...
and convert it to this:
class Foo {
enum class Kind : uint32_t { X = 1, Y = 2 };
Kind kind;
}
... foo.kind = Foo::Kind::X;
(In some cases the enumeration would not be in the class namespace,
such as when it is generally useful.)
The benefits are as follows:
* The type of the field gives a clear indication of intent, both
to humans and tools (such as binding generators).
* The compiler is able to automatically warn when a switch is not
exhaustive; but this is currently suppressed by the
default: ssassert(false, ...)
idiom.
* Integers and plain enums are weakly type checked: they implicitly
convert into each other. This can hide bugs where type conversion
is performed but not intended. Enum classes are strongly type
checked.
* Plain enums pollute parent namespaces; enum classes do not.
Almost every defined enum we have already has a kind of ad-hoc
namespacing via `NAMESPACE_`, which is now explicit.
* Plain enums do not have a well-defined ABI size, which is
important for bindings. Enum classes can have it, if specified.
We specify the base type for all enums as uint32_t, which is
a safe choice and allows us to not change the numeric values
of any variants.
This commit introduces absolutely no functional change to the code,
just renaming and change of types. It handles almost all cases,
except GraphicsWindow::pending.operation, which needs minor
functional change.
2016-05-20 08:31:20 +00:00
|
|
|
static void MenuClipboard(Command id);
|
2008-04-12 14:12:26 +00:00
|
|
|
|
2016-06-28 08:48:06 +00:00
|
|
|
std::shared_ptr<ViewportCanvas> canvas;
|
2016-06-30 15:54:35 +00:00
|
|
|
std::shared_ptr<BatchCanvas> persistentCanvas;
|
|
|
|
bool persistentDirty;
|
2016-06-28 08:48:06 +00:00
|
|
|
|
2008-04-01 10:48:44 +00:00
|
|
|
// The width and height (in pixels) of the window.
|
|
|
|
double width, height;
|
2008-03-25 10:02:13 +00:00
|
|
|
// These parameters define the map from 2d screen coordinates to the
|
|
|
|
// coordinates of the 3d sketch points. We will use an axonometric
|
|
|
|
// projection.
|
|
|
|
Vector offset;
|
|
|
|
Vector projRight;
|
2008-04-12 15:17:58 +00:00
|
|
|
Vector projUp;
|
2008-03-27 09:53:51 +00:00
|
|
|
double scale;
|
|
|
|
struct {
|
2009-11-08 01:11:38 +00:00
|
|
|
bool mouseDown;
|
2008-03-27 09:53:51 +00:00
|
|
|
Vector offset;
|
|
|
|
Vector projRight;
|
2008-04-12 15:17:58 +00:00
|
|
|
Vector projUp;
|
2008-03-27 09:53:51 +00:00
|
|
|
Point2d mouse;
|
2009-11-03 18:54:49 +00:00
|
|
|
Point2d mouseOnButtonDown;
|
2009-11-04 07:52:58 +00:00
|
|
|
Vector marqueePoint;
|
2009-09-23 10:59:59 +00:00
|
|
|
bool startedMoving;
|
2008-03-27 09:53:51 +00:00
|
|
|
} orig;
|
2016-03-05 15:09:11 +00:00
|
|
|
// We need to detect when the projection is changed to invalidate
|
|
|
|
// caches for drawn items.
|
|
|
|
struct {
|
|
|
|
Vector offset;
|
|
|
|
Vector projRight;
|
|
|
|
Vector projUp;
|
|
|
|
double scale;
|
|
|
|
} cached;
|
2008-03-27 09:53:51 +00:00
|
|
|
|
2010-07-12 06:47:14 +00:00
|
|
|
// Most recent mouse position, updated every time the mouse moves.
|
|
|
|
Point2d currentMousePosition;
|
|
|
|
|
2008-04-28 09:40:02 +00:00
|
|
|
// When the user is dragging a point, don't solve multiple times without
|
|
|
|
// allowing a paint in between. The extra solves are wasted if they're
|
|
|
|
// not displayed.
|
|
|
|
bool havePainted;
|
|
|
|
|
2009-09-23 10:59:59 +00:00
|
|
|
// Some state for the context menu.
|
|
|
|
struct {
|
|
|
|
bool active;
|
|
|
|
} context;
|
|
|
|
|
Abstract all (ex-OpenGL) drawing operations into a Canvas interface.
This has several desirable consequences:
* It is now possible to port SolveSpace to a later version of
OpenGL, such as OpenGLES 2, so that it runs on platforms that
only have that OpenGL version;
* The majority of geometry is now rendered without references to
the camera in C++ code, so a renderer can now submit it to
the video card once and re-rasterize with a different projection
matrix every time the projection is changed, avoiding expensive
reuploads;
* The DOGD (draw or get distance) interface is now
a straightforward Canvas implementation;
* There are no more direct references to SS.GW.(projection)
in sketch rendering code, which allows rendering to multiple
viewports;
* There are no more unnecessary framebuffer flips on CPU on Cocoa
and GTK;
* The platform-dependent GL code is now confined to rendergl1.cpp.
* The Microsoft and Apple headers required by it that are prone to
identifier conflicts are no longer included globally;
* The rendergl1.cpp implementation can now be omitted from
compilation to run SolveSpace headless or with a different
OpenGL version.
Note these implementation details of Canvas:
* GetCamera currently always returns a reference to the field
`Camera camera;`. This is so that a future renderer that caches
geometry in the video memory can define it as asserting, which
would provide assurance against code that could accidentally
put something projection-dependent in the cache;
* Line and triangle rendering is specified through a level of
indirection, hStroke and hFill. This is so that a future renderer
that batches geometry could cheaply group identical styles.
* DrawPixmap and DrawVectorText accept a (o,u,v) and not a matrix.
This is so that a future renderer into an output format that
uses 2d transforms (e.g. SVG) could easily derive those.
Some additional internal changes were required to enable this:
* Pixmap is now always passed as std::shared_ptr<{const ,}Pixmap>.
This is so that the renderer could cache uploaded textures
between API calls, which requires it to capture a (weak)
reference.
* The PlatformPathEqual function was properly extracted into
platform-specific code. This is so that the <windows.h> header
could be included only where needed (in platform/w32* as well
as rendergl1.cpp).
* The SBsp{2,3}::DebugDraw functions were removed. They can be
rewritten using the Canvas API if they are ever needed.
While no visual changes were originally intended, some minor fixes
happened anyway:
* The "emphasis" yellow line from top-left corner is now correctly
rendered much wider.
* The marquee rectangle is now pixel grid aligned.
* The hidden entities now do not clobber the depth buffer, removing
some minor artifacts.
* The workplane "tab" now scales with the font used to render
the workplane name.
* The workplane name font is now taken from the normals style.
* Workplane and constraint line stipple is insignificantly
different. This is so that it can reuse the existing stipple
codepaths; rendering of workplanes and constraints predates
those.
Some debug functionality was added:
* In graphics window, an fps counter that becomes red when
rendering under 60fps is drawn.
2016-05-31 00:55:13 +00:00
|
|
|
Camera GetCamera() const;
|
|
|
|
Lighting GetLighting() const;
|
|
|
|
|
2016-05-05 05:54:05 +00:00
|
|
|
void NormalizeProjectionVectors();
|
2008-04-12 14:12:26 +00:00
|
|
|
Point2d ProjectPoint(Vector p);
|
2008-06-17 19:12:25 +00:00
|
|
|
Vector ProjectPoint3(Vector p);
|
|
|
|
Vector ProjectPoint4(Vector p, double *w);
|
2009-11-04 07:52:58 +00:00
|
|
|
Vector UnProjectPoint(Point2d p);
|
2016-04-05 11:12:14 +00:00
|
|
|
Vector UnProjectPoint3(Vector p);
|
2009-01-02 04:06:47 +00:00
|
|
|
void AnimateOnto(Quaternion quatf, Vector offsetf);
|
2016-05-05 05:54:05 +00:00
|
|
|
void AnimateOntoWorkplane();
|
2008-06-11 04:22:52 +00:00
|
|
|
Vector VectorFromProjs(Vector rightUpForward);
|
2008-06-17 19:12:25 +00:00
|
|
|
void HandlePointForZoomToFit(Vector p, Point2d *pmax, Point2d *pmin,
|
2016-01-30 10:38:38 +00:00
|
|
|
double *wmin, bool usePerspective);
|
2016-08-01 14:00:00 +00:00
|
|
|
void LoopOverPoints(const std::vector<Entity *> &entities,
|
|
|
|
const std::vector<Constraint *> &constraints,
|
|
|
|
const std::vector<hEntity> &faces,
|
|
|
|
Point2d *pmax, Point2d *pmin,
|
2016-01-30 10:38:38 +00:00
|
|
|
double *wmin, bool usePerspective, bool includeMesh);
|
|
|
|
void ZoomToFit(bool includingInvisibles, bool useSelection = false);
|
2008-04-13 10:57:41 +00:00
|
|
|
|
|
|
|
hGroup activeGroup;
|
2016-05-05 05:54:05 +00:00
|
|
|
void EnsureValidActives();
|
|
|
|
bool LockedInWorkplane();
|
|
|
|
void SetWorkplaneFreeIn3d();
|
|
|
|
hEntity ActiveWorkplane();
|
|
|
|
void ForceTextWindowShown();
|
2008-04-13 10:57:41 +00:00
|
|
|
|
|
|
|
// Operations that must be completed by doing something with the mouse
|
2016-05-23 10:15:38 +00:00
|
|
|
// are noted here.
|
|
|
|
enum class Pending : uint32_t {
|
|
|
|
NONE = 0,
|
|
|
|
COMMAND = 1,
|
|
|
|
DRAGGING_POINTS = 2,
|
|
|
|
DRAGGING_NEW_POINT = 3,
|
|
|
|
DRAGGING_NEW_LINE_POINT = 4,
|
|
|
|
DRAGGING_NEW_CUBIC_POINT = 5,
|
|
|
|
DRAGGING_NEW_ARC_POINT = 6,
|
|
|
|
DRAGGING_CONSTRAINT = 7,
|
|
|
|
DRAGGING_RADIUS = 8,
|
|
|
|
DRAGGING_NORMAL = 9,
|
|
|
|
DRAGGING_NEW_RADIUS = 10,
|
|
|
|
DRAGGING_MARQUEE = 11,
|
2013-09-09 19:50:32 +00:00
|
|
|
};
|
2016-04-02 08:29:32 +00:00
|
|
|
|
2008-05-05 06:18:01 +00:00
|
|
|
struct {
|
2016-05-23 10:15:38 +00:00
|
|
|
Pending operation;
|
|
|
|
Command command;
|
2008-05-05 06:18:01 +00:00
|
|
|
|
2016-04-02 08:29:32 +00:00
|
|
|
hRequest request;
|
|
|
|
hEntity point;
|
|
|
|
List<hEntity> points;
|
2017-01-09 16:54:24 +00:00
|
|
|
List<hRequest> requests;
|
2016-04-02 08:29:32 +00:00
|
|
|
hEntity circle;
|
|
|
|
hEntity normal;
|
|
|
|
hConstraint constraint;
|
2015-03-29 00:30:52 +00:00
|
|
|
|
2016-04-02 08:29:32 +00:00
|
|
|
const char *description;
|
2016-11-29 16:49:20 +00:00
|
|
|
Platform::Path filename;
|
2016-04-02 08:29:32 +00:00
|
|
|
|
Enable exhaustive switch coverage warnings as an error, and use them.
Specifically, this enables -Wswitch=error on GCC/Clang and its MSVC
equivalent; the exact way it is handled varies slightly, but what
they all have in common is that in a switch statement over an
enumeration, any enumerand that is not explicitly (via case:) or
implicitly (via default:) handled in the switch triggers an error.
Moreover, we also change the switch statements in three ways:
* Switch statements that ought to be extended every time a new
enumerand is added (e.g. Entity::DrawOrGetDistance(), are changed
to explicitly list every single enumerand, and not have a
default: branch.
Note that the assertions are kept because it is legal for
a enumeration to have a value unlike any of its defined
enumerands, and we can e.g. read garbage from a file, or
an uninitialized variable. This requires some rearranging if
a default: branch is undesired.
* Switch statements that ought to only ever see a few select
enumerands, are changed to always assert in the default: branch.
* Switch statements that do something meaningful for a few
enumerands, and ignore everything else, are changed to do nothing
in a default: branch, under the assumption that changing them
every time an enumerand is added or removed would just result
in noise and catch no bugs.
This commit also removes the {Request,Entity,Constraint}::UNKNOWN and
Entity::DATUM_POINT enumerands, as those were just fancy names for
zeroes. They mess up switch exhaustiveness checks and most of the time
were not the best way to implement what they did anyway.
2016-05-25 06:55:50 +00:00
|
|
|
bool hasSuggestion;
|
|
|
|
Constraint::Type suggestion;
|
2008-05-05 06:18:01 +00:00
|
|
|
} pending;
|
2016-05-05 05:54:05 +00:00
|
|
|
void ClearPending();
|
2017-01-09 16:54:24 +00:00
|
|
|
bool IsFromPending(hRequest r);
|
|
|
|
void AddToPending(hRequest r);
|
2017-01-24 16:54:10 +00:00
|
|
|
void ReplacePending(hRequest before, hRequest after);
|
2017-01-09 16:54:24 +00:00
|
|
|
|
2008-04-21 10:12:04 +00:00
|
|
|
// The constraint that is being edited with the on-screen textbox.
|
|
|
|
hConstraint constraintBeingEdited;
|
2008-05-05 06:18:01 +00:00
|
|
|
|
Enable exhaustive switch coverage warnings as an error, and use them.
Specifically, this enables -Wswitch=error on GCC/Clang and its MSVC
equivalent; the exact way it is handled varies slightly, but what
they all have in common is that in a switch statement over an
enumeration, any enumerand that is not explicitly (via case:) or
implicitly (via default:) handled in the switch triggers an error.
Moreover, we also change the switch statements in three ways:
* Switch statements that ought to be extended every time a new
enumerand is added (e.g. Entity::DrawOrGetDistance(), are changed
to explicitly list every single enumerand, and not have a
default: branch.
Note that the assertions are kept because it is legal for
a enumeration to have a value unlike any of its defined
enumerands, and we can e.g. read garbage from a file, or
an uninitialized variable. This requires some rearranging if
a default: branch is undesired.
* Switch statements that ought to only ever see a few select
enumerands, are changed to always assert in the default: branch.
* Switch statements that do something meaningful for a few
enumerands, and ignore everything else, are changed to do nothing
in a default: branch, under the assumption that changing them
every time an enumerand is added or removed would just result
in noise and catch no bugs.
This commit also removes the {Request,Entity,Constraint}::UNKNOWN and
Entity::DATUM_POINT enumerands, as those were just fancy names for
zeroes. They mess up switch exhaustiveness checks and most of the time
were not the best way to implement what they did anyway.
2016-05-25 06:55:50 +00:00
|
|
|
bool SuggestLineConstraint(hRequest lineSegment, ConstraintBase::Type *type);
|
2015-03-29 22:26:07 +00:00
|
|
|
|
2009-09-29 11:35:19 +00:00
|
|
|
Vector SnapToGrid(Vector p);
|
2017-02-02 03:48:54 +00:00
|
|
|
Vector SnapToEntityByScreenPoint(Point2d pp, hEntity he);
|
|
|
|
bool ConstrainPointByHovered(hEntity pt, const Point2d *projected = NULL);
|
2016-05-05 05:54:05 +00:00
|
|
|
void DeleteTaggedRequests();
|
Convert all enumerations to use `enum class`.
Specifically, take the old code that looks like this:
class Foo {
enum { X = 1, Y = 2 };
int kind;
}
... foo.kind = Foo::X; ...
and convert it to this:
class Foo {
enum class Kind : uint32_t { X = 1, Y = 2 };
Kind kind;
}
... foo.kind = Foo::Kind::X;
(In some cases the enumeration would not be in the class namespace,
such as when it is generally useful.)
The benefits are as follows:
* The type of the field gives a clear indication of intent, both
to humans and tools (such as binding generators).
* The compiler is able to automatically warn when a switch is not
exhaustive; but this is currently suppressed by the
default: ssassert(false, ...)
idiom.
* Integers and plain enums are weakly type checked: they implicitly
convert into each other. This can hide bugs where type conversion
is performed but not intended. Enum classes are strongly type
checked.
* Plain enums pollute parent namespaces; enum classes do not.
Almost every defined enum we have already has a kind of ad-hoc
namespacing via `NAMESPACE_`, which is now explicit.
* Plain enums do not have a well-defined ABI size, which is
important for bindings. Enum classes can have it, if specified.
We specify the base type for all enums as uint32_t, which is
a safe choice and allows us to not change the numeric values
of any variants.
This commit introduces absolutely no functional change to the code,
just renaming and change of types. It handles almost all cases,
except GraphicsWindow::pending.operation, which needs minor
functional change.
2016-05-20 08:31:20 +00:00
|
|
|
hRequest AddRequest(Request::Type type, bool rememberForUndo);
|
|
|
|
hRequest AddRequest(Request::Type type);
|
2009-01-03 12:27:33 +00:00
|
|
|
|
2010-05-16 16:36:23 +00:00
|
|
|
class ParametricCurve {
|
|
|
|
public:
|
|
|
|
bool isLine; // else circle
|
|
|
|
Vector p0, p1;
|
|
|
|
Vector u, v;
|
|
|
|
double r, theta0, theta1, dtheta;
|
2015-03-29 00:30:52 +00:00
|
|
|
|
2010-05-16 16:36:23 +00:00
|
|
|
void MakeFromEntity(hEntity he, bool reverse);
|
|
|
|
Vector PointAt(double t);
|
|
|
|
Vector TangentAt(double t);
|
2016-05-05 05:54:05 +00:00
|
|
|
double LengthForAuto();
|
2010-05-16 16:36:23 +00:00
|
|
|
|
|
|
|
hRequest CreateRequestTrimmedTo(double t, bool extraConstraints,
|
|
|
|
hEntity orig, hEntity arc, bool arcFinish);
|
|
|
|
void ConstrainPointIfCoincident(hEntity hpt);
|
|
|
|
};
|
2016-05-05 05:54:05 +00:00
|
|
|
void MakeTangentArc();
|
|
|
|
void SplitLinesOrCurves();
|
2009-07-07 08:21:59 +00:00
|
|
|
hEntity SplitEntity(hEntity he, Vector pinter);
|
|
|
|
hEntity SplitLine(hEntity he, Vector pinter);
|
|
|
|
hEntity SplitCircle(hEntity he, Vector pinter);
|
|
|
|
hEntity SplitCubic(hEntity he, Vector pinter);
|
2009-01-03 12:27:33 +00:00
|
|
|
void ReplacePointInConstraints(hEntity oldpt, hEntity newpt);
|
2016-04-07 14:44:56 +00:00
|
|
|
void RemoveConstraintsForPointBeingDeleted(hEntity hpt);
|
2009-07-08 09:36:18 +00:00
|
|
|
void FixConstraintsForRequestBeingDeleted(hRequest hr);
|
|
|
|
void FixConstraintsForPointBeingDeleted(hEntity hpt);
|
2015-03-29 00:30:52 +00:00
|
|
|
|
2016-07-21 17:58:18 +00:00
|
|
|
// A selected entity.
|
2008-04-12 14:12:26 +00:00
|
|
|
class Selection {
|
|
|
|
public:
|
2009-11-03 18:54:49 +00:00
|
|
|
int tag;
|
|
|
|
|
2008-04-12 14:12:26 +00:00
|
|
|
hEntity entity;
|
2008-04-14 10:28:32 +00:00
|
|
|
hConstraint constraint;
|
2008-05-26 09:56:50 +00:00
|
|
|
bool emphasized;
|
2008-04-12 14:12:26 +00:00
|
|
|
|
Abstract all (ex-OpenGL) drawing operations into a Canvas interface.
This has several desirable consequences:
* It is now possible to port SolveSpace to a later version of
OpenGL, such as OpenGLES 2, so that it runs on platforms that
only have that OpenGL version;
* The majority of geometry is now rendered without references to
the camera in C++ code, so a renderer can now submit it to
the video card once and re-rasterize with a different projection
matrix every time the projection is changed, avoiding expensive
reuploads;
* The DOGD (draw or get distance) interface is now
a straightforward Canvas implementation;
* There are no more direct references to SS.GW.(projection)
in sketch rendering code, which allows rendering to multiple
viewports;
* There are no more unnecessary framebuffer flips on CPU on Cocoa
and GTK;
* The platform-dependent GL code is now confined to rendergl1.cpp.
* The Microsoft and Apple headers required by it that are prone to
identifier conflicts are no longer included globally;
* The rendergl1.cpp implementation can now be omitted from
compilation to run SolveSpace headless or with a different
OpenGL version.
Note these implementation details of Canvas:
* GetCamera currently always returns a reference to the field
`Camera camera;`. This is so that a future renderer that caches
geometry in the video memory can define it as asserting, which
would provide assurance against code that could accidentally
put something projection-dependent in the cache;
* Line and triangle rendering is specified through a level of
indirection, hStroke and hFill. This is so that a future renderer
that batches geometry could cheaply group identical styles.
* DrawPixmap and DrawVectorText accept a (o,u,v) and not a matrix.
This is so that a future renderer into an output format that
uses 2d transforms (e.g. SVG) could easily derive those.
Some additional internal changes were required to enable this:
* Pixmap is now always passed as std::shared_ptr<{const ,}Pixmap>.
This is so that the renderer could cache uploaded textures
between API calls, which requires it to capture a (weak)
reference.
* The PlatformPathEqual function was properly extracted into
platform-specific code. This is so that the <windows.h> header
could be included only where needed (in platform/w32* as well
as rendergl1.cpp).
* The SBsp{2,3}::DebugDraw functions were removed. They can be
rewritten using the Canvas API if they are ever needed.
While no visual changes were originally intended, some minor fixes
happened anyway:
* The "emphasis" yellow line from top-left corner is now correctly
rendered much wider.
* The marquee rectangle is now pixel grid aligned.
* The hidden entities now do not clobber the depth buffer, removing
some minor artifacts.
* The workplane "tab" now scales with the font used to render
the workplane name.
* The workplane name font is now taken from the normals style.
* Workplane and constraint line stipple is insignificantly
different. This is so that it can reuse the existing stipple
codepaths; rendering of workplanes and constraints predates
those.
Some debug functionality was added:
* In graphics window, an fps counter that becomes red when
rendering under 60fps is drawn.
2016-05-31 00:55:13 +00:00
|
|
|
void Draw(bool isHovered, Canvas *canvas);
|
2008-04-12 14:12:26 +00:00
|
|
|
|
2016-05-05 05:54:05 +00:00
|
|
|
void Clear();
|
|
|
|
bool IsEmpty();
|
2008-04-12 14:12:26 +00:00
|
|
|
bool Equals(Selection *b);
|
2016-05-05 05:54:05 +00:00
|
|
|
bool HasEndpoints();
|
2008-04-12 14:12:26 +00:00
|
|
|
};
|
2016-07-21 17:58:18 +00:00
|
|
|
|
|
|
|
// A hovered entity, with its location relative to the cursor.
|
|
|
|
class Hover {
|
|
|
|
public:
|
|
|
|
int zIndex;
|
|
|
|
double distance;
|
|
|
|
Selection selection;
|
|
|
|
};
|
|
|
|
|
|
|
|
List<Hover> hoverList;
|
2008-04-12 14:12:26 +00:00
|
|
|
Selection hover;
|
2010-01-03 10:26:15 +00:00
|
|
|
bool hoverWasSelectedOnMousedown;
|
2009-11-03 18:54:49 +00:00
|
|
|
List<Selection> selection;
|
2016-07-21 17:58:18 +00:00
|
|
|
|
|
|
|
Selection ChooseFromHoverToSelect();
|
|
|
|
Selection ChooseFromHoverToDrag();
|
2008-04-23 07:29:19 +00:00
|
|
|
void HitTestMakeSelection(Point2d mp);
|
2016-05-05 05:54:05 +00:00
|
|
|
void ClearSelection();
|
|
|
|
void ClearNonexistentSelectionItems();
|
2008-04-12 15:17:58 +00:00
|
|
|
struct {
|
2016-08-13 05:20:43 +00:00
|
|
|
std::vector<hEntity> point;
|
|
|
|
std::vector<hEntity> entity;
|
|
|
|
std::vector<hEntity> anyNormal;
|
|
|
|
std::vector<hEntity> vector;
|
|
|
|
std::vector<hEntity> face;
|
|
|
|
std::vector<hConstraint> constraint;
|
2008-04-12 15:17:58 +00:00
|
|
|
int points;
|
|
|
|
int entities;
|
2008-04-27 03:26:27 +00:00
|
|
|
int workplanes;
|
2008-06-01 00:26:41 +00:00
|
|
|
int faces;
|
2008-04-14 10:28:32 +00:00
|
|
|
int lineSegments;
|
2008-05-07 08:19:37 +00:00
|
|
|
int circlesOrArcs;
|
2008-07-13 12:44:05 +00:00
|
|
|
int arcs;
|
|
|
|
int cubics;
|
2009-11-10 03:57:24 +00:00
|
|
|
int periodicCubics;
|
2008-05-09 05:33:23 +00:00
|
|
|
int anyNormals;
|
|
|
|
int vectors;
|
2008-05-17 11:15:14 +00:00
|
|
|
int constraints;
|
2009-09-24 15:52:48 +00:00
|
|
|
int stylables;
|
2016-04-18 06:40:42 +00:00
|
|
|
int constraintLabels;
|
2009-11-03 18:54:49 +00:00
|
|
|
int withEndpoints;
|
2008-04-12 15:17:58 +00:00
|
|
|
int n;
|
|
|
|
} gs;
|
2016-05-05 05:54:05 +00:00
|
|
|
void GroupSelection();
|
2010-01-03 10:26:15 +00:00
|
|
|
bool IsSelected(Selection *s);
|
|
|
|
bool IsSelected(hEntity he);
|
|
|
|
void MakeSelected(hEntity he);
|
2016-05-20 14:19:50 +00:00
|
|
|
void MakeSelected(hConstraint hc);
|
2010-01-03 10:26:15 +00:00
|
|
|
void MakeSelected(Selection *s);
|
|
|
|
void MakeUnselected(hEntity he, bool coincidentPointTrick);
|
|
|
|
void MakeUnselected(Selection *s, bool coincidentPointTrick);
|
2016-05-05 05:54:05 +00:00
|
|
|
void SelectByMarquee();
|
|
|
|
void ClearSuper();
|
2008-05-17 11:15:14 +00:00
|
|
|
|
2016-05-05 05:54:05 +00:00
|
|
|
void ContextMenuListStyles();
|
2013-10-28 04:28:39 +00:00
|
|
|
int64_t contextMenuCancelTime;
|
2009-09-23 10:59:59 +00:00
|
|
|
|
2009-01-02 10:38:36 +00:00
|
|
|
// The toolbar, in toolbar.cpp
|
Abstract all (ex-OpenGL) drawing operations into a Canvas interface.
This has several desirable consequences:
* It is now possible to port SolveSpace to a later version of
OpenGL, such as OpenGLES 2, so that it runs on platforms that
only have that OpenGL version;
* The majority of geometry is now rendered without references to
the camera in C++ code, so a renderer can now submit it to
the video card once and re-rasterize with a different projection
matrix every time the projection is changed, avoiding expensive
reuploads;
* The DOGD (draw or get distance) interface is now
a straightforward Canvas implementation;
* There are no more direct references to SS.GW.(projection)
in sketch rendering code, which allows rendering to multiple
viewports;
* There are no more unnecessary framebuffer flips on CPU on Cocoa
and GTK;
* The platform-dependent GL code is now confined to rendergl1.cpp.
* The Microsoft and Apple headers required by it that are prone to
identifier conflicts are no longer included globally;
* The rendergl1.cpp implementation can now be omitted from
compilation to run SolveSpace headless or with a different
OpenGL version.
Note these implementation details of Canvas:
* GetCamera currently always returns a reference to the field
`Camera camera;`. This is so that a future renderer that caches
geometry in the video memory can define it as asserting, which
would provide assurance against code that could accidentally
put something projection-dependent in the cache;
* Line and triangle rendering is specified through a level of
indirection, hStroke and hFill. This is so that a future renderer
that batches geometry could cheaply group identical styles.
* DrawPixmap and DrawVectorText accept a (o,u,v) and not a matrix.
This is so that a future renderer into an output format that
uses 2d transforms (e.g. SVG) could easily derive those.
Some additional internal changes were required to enable this:
* Pixmap is now always passed as std::shared_ptr<{const ,}Pixmap>.
This is so that the renderer could cache uploaded textures
between API calls, which requires it to capture a (weak)
reference.
* The PlatformPathEqual function was properly extracted into
platform-specific code. This is so that the <windows.h> header
could be included only where needed (in platform/w32* as well
as rendergl1.cpp).
* The SBsp{2,3}::DebugDraw functions were removed. They can be
rewritten using the Canvas API if they are ever needed.
While no visual changes were originally intended, some minor fixes
happened anyway:
* The "emphasis" yellow line from top-left corner is now correctly
rendered much wider.
* The marquee rectangle is now pixel grid aligned.
* The hidden entities now do not clobber the depth buffer, removing
some minor artifacts.
* The workplane "tab" now scales with the font used to render
the workplane name.
* The workplane name font is now taken from the normals style.
* Workplane and constraint line stipple is insignificantly
different. This is so that it can reuse the existing stipple
codepaths; rendering of workplanes and constraints predates
those.
Some debug functionality was added:
* In graphics window, an fps counter that becomes red when
rendering under 60fps is drawn.
2016-05-31 00:55:13 +00:00
|
|
|
bool ToolbarDrawOrHitTest(int x, int y, UiCanvas *canvas, Command *menuHit);
|
|
|
|
void ToolbarDraw(UiCanvas *canvas);
|
2009-01-02 10:38:36 +00:00
|
|
|
bool ToolbarMouseMoved(int x, int y);
|
|
|
|
bool ToolbarMouseDown(int x, int y);
|
2016-05-05 05:54:05 +00:00
|
|
|
static void TimerCallback();
|
Convert all enumerations to use `enum class`.
Specifically, take the old code that looks like this:
class Foo {
enum { X = 1, Y = 2 };
int kind;
}
... foo.kind = Foo::X; ...
and convert it to this:
class Foo {
enum class Kind : uint32_t { X = 1, Y = 2 };
Kind kind;
}
... foo.kind = Foo::Kind::X;
(In some cases the enumeration would not be in the class namespace,
such as when it is generally useful.)
The benefits are as follows:
* The type of the field gives a clear indication of intent, both
to humans and tools (such as binding generators).
* The compiler is able to automatically warn when a switch is not
exhaustive; but this is currently suppressed by the
default: ssassert(false, ...)
idiom.
* Integers and plain enums are weakly type checked: they implicitly
convert into each other. This can hide bugs where type conversion
is performed but not intended. Enum classes are strongly type
checked.
* Plain enums pollute parent namespaces; enum classes do not.
Almost every defined enum we have already has a kind of ad-hoc
namespacing via `NAMESPACE_`, which is now explicit.
* Plain enums do not have a well-defined ABI size, which is
important for bindings. Enum classes can have it, if specified.
We specify the base type for all enums as uint32_t, which is
a safe choice and allows us to not change the numeric values
of any variants.
This commit introduces absolutely no functional change to the code,
just renaming and change of types. It handles almost all cases,
except GraphicsWindow::pending.operation, which needs minor
functional change.
2016-05-20 08:31:20 +00:00
|
|
|
Command toolbarHovered;
|
|
|
|
Command toolbarTooltipped;
|
2009-01-02 10:38:36 +00:00
|
|
|
int toolbarMouseX, toolbarMouseY;
|
|
|
|
|
2008-04-11 12:47:14 +00:00
|
|
|
// This sets what gets displayed.
|
2008-04-27 03:26:27 +00:00
|
|
|
bool showWorkplanes;
|
2008-05-05 06:18:01 +00:00
|
|
|
bool showNormals;
|
2008-04-11 12:47:14 +00:00
|
|
|
bool showPoints;
|
|
|
|
bool showConstraints;
|
2008-04-27 05:00:12 +00:00
|
|
|
bool showTextWindow;
|
2008-05-28 10:34:55 +00:00
|
|
|
bool showShaded;
|
2009-03-18 04:26:04 +00:00
|
|
|
bool showEdges;
|
2016-03-14 16:14:24 +00:00
|
|
|
bool showOutlines;
|
2008-06-02 05:38:12 +00:00
|
|
|
bool showFaces;
|
2008-05-28 10:34:55 +00:00
|
|
|
bool showMesh;
|
2010-05-03 05:04:42 +00:00
|
|
|
void ToggleBool(bool *v);
|
2008-03-25 10:02:13 +00:00
|
|
|
|
2016-08-13 09:02:12 +00:00
|
|
|
enum class DrawOccludedAs { INVISIBLE, STIPPLED, VISIBLE };
|
|
|
|
DrawOccludedAs drawOccludedAs;
|
|
|
|
|
2009-09-29 11:35:19 +00:00
|
|
|
bool showSnapGrid;
|
Abstract all (ex-OpenGL) drawing operations into a Canvas interface.
This has several desirable consequences:
* It is now possible to port SolveSpace to a later version of
OpenGL, such as OpenGLES 2, so that it runs on platforms that
only have that OpenGL version;
* The majority of geometry is now rendered without references to
the camera in C++ code, so a renderer can now submit it to
the video card once and re-rasterize with a different projection
matrix every time the projection is changed, avoiding expensive
reuploads;
* The DOGD (draw or get distance) interface is now
a straightforward Canvas implementation;
* There are no more direct references to SS.GW.(projection)
in sketch rendering code, which allows rendering to multiple
viewports;
* There are no more unnecessary framebuffer flips on CPU on Cocoa
and GTK;
* The platform-dependent GL code is now confined to rendergl1.cpp.
* The Microsoft and Apple headers required by it that are prone to
identifier conflicts are no longer included globally;
* The rendergl1.cpp implementation can now be omitted from
compilation to run SolveSpace headless or with a different
OpenGL version.
Note these implementation details of Canvas:
* GetCamera currently always returns a reference to the field
`Camera camera;`. This is so that a future renderer that caches
geometry in the video memory can define it as asserting, which
would provide assurance against code that could accidentally
put something projection-dependent in the cache;
* Line and triangle rendering is specified through a level of
indirection, hStroke and hFill. This is so that a future renderer
that batches geometry could cheaply group identical styles.
* DrawPixmap and DrawVectorText accept a (o,u,v) and not a matrix.
This is so that a future renderer into an output format that
uses 2d transforms (e.g. SVG) could easily derive those.
Some additional internal changes were required to enable this:
* Pixmap is now always passed as std::shared_ptr<{const ,}Pixmap>.
This is so that the renderer could cache uploaded textures
between API calls, which requires it to capture a (weak)
reference.
* The PlatformPathEqual function was properly extracted into
platform-specific code. This is so that the <windows.h> header
could be included only where needed (in platform/w32* as well
as rendergl1.cpp).
* The SBsp{2,3}::DebugDraw functions were removed. They can be
rewritten using the Canvas API if they are ever needed.
While no visual changes were originally intended, some minor fixes
happened anyway:
* The "emphasis" yellow line from top-left corner is now correctly
rendered much wider.
* The marquee rectangle is now pixel grid aligned.
* The hidden entities now do not clobber the depth buffer, removing
some minor artifacts.
* The workplane "tab" now scales with the font used to render
the workplane name.
* The workplane name font is now taken from the normals style.
* Workplane and constraint line stipple is insignificantly
different. This is so that it can reuse the existing stipple
codepaths; rendering of workplanes and constraints predates
those.
Some debug functionality was added:
* In graphics window, an fps counter that becomes red when
rendering under 60fps is drawn.
2016-05-31 00:55:13 +00:00
|
|
|
void DrawSnapGrid(Canvas *canvas);
|
2009-09-29 11:35:19 +00:00
|
|
|
|
2009-11-03 18:54:49 +00:00
|
|
|
void AddPointToDraggedList(hEntity hp);
|
|
|
|
void StartDraggingByEntity(hEntity he);
|
2016-05-05 05:54:05 +00:00
|
|
|
void StartDraggingBySelection();
|
2008-05-05 06:18:01 +00:00
|
|
|
void UpdateDraggedNum(Vector *pos, double mx, double my);
|
|
|
|
void UpdateDraggedPoint(hEntity hp, double mx, double my);
|
2008-04-13 10:57:41 +00:00
|
|
|
|
2016-06-30 15:54:35 +00:00
|
|
|
void DrawEntities(Canvas *canvas, bool persistent);
|
Abstract all (ex-OpenGL) drawing operations into a Canvas interface.
This has several desirable consequences:
* It is now possible to port SolveSpace to a later version of
OpenGL, such as OpenGLES 2, so that it runs on platforms that
only have that OpenGL version;
* The majority of geometry is now rendered without references to
the camera in C++ code, so a renderer can now submit it to
the video card once and re-rasterize with a different projection
matrix every time the projection is changed, avoiding expensive
reuploads;
* The DOGD (draw or get distance) interface is now
a straightforward Canvas implementation;
* There are no more direct references to SS.GW.(projection)
in sketch rendering code, which allows rendering to multiple
viewports;
* There are no more unnecessary framebuffer flips on CPU on Cocoa
and GTK;
* The platform-dependent GL code is now confined to rendergl1.cpp.
* The Microsoft and Apple headers required by it that are prone to
identifier conflicts are no longer included globally;
* The rendergl1.cpp implementation can now be omitted from
compilation to run SolveSpace headless or with a different
OpenGL version.
Note these implementation details of Canvas:
* GetCamera currently always returns a reference to the field
`Camera camera;`. This is so that a future renderer that caches
geometry in the video memory can define it as asserting, which
would provide assurance against code that could accidentally
put something projection-dependent in the cache;
* Line and triangle rendering is specified through a level of
indirection, hStroke and hFill. This is so that a future renderer
that batches geometry could cheaply group identical styles.
* DrawPixmap and DrawVectorText accept a (o,u,v) and not a matrix.
This is so that a future renderer into an output format that
uses 2d transforms (e.g. SVG) could easily derive those.
Some additional internal changes were required to enable this:
* Pixmap is now always passed as std::shared_ptr<{const ,}Pixmap>.
This is so that the renderer could cache uploaded textures
between API calls, which requires it to capture a (weak)
reference.
* The PlatformPathEqual function was properly extracted into
platform-specific code. This is so that the <windows.h> header
could be included only where needed (in platform/w32* as well
as rendergl1.cpp).
* The SBsp{2,3}::DebugDraw functions were removed. They can be
rewritten using the Canvas API if they are ever needed.
While no visual changes were originally intended, some minor fixes
happened anyway:
* The "emphasis" yellow line from top-left corner is now correctly
rendered much wider.
* The marquee rectangle is now pixel grid aligned.
* The hidden entities now do not clobber the depth buffer, removing
some minor artifacts.
* The workplane "tab" now scales with the font used to render
the workplane name.
* The workplane name font is now taken from the normals style.
* Workplane and constraint line stipple is insignificantly
different. This is so that it can reuse the existing stipple
codepaths; rendering of workplanes and constraints predates
those.
Some debug functionality was added:
* In graphics window, an fps counter that becomes red when
rendering under 60fps is drawn.
2016-05-31 00:55:13 +00:00
|
|
|
void DrawPersistent(Canvas *canvas);
|
|
|
|
void Draw(Canvas *canvas);
|
|
|
|
|
2008-03-25 10:02:13 +00:00
|
|
|
// These are called by the platform-specific code.
|
2016-05-05 05:54:05 +00:00
|
|
|
void Paint();
|
2008-03-25 10:02:13 +00:00
|
|
|
void MouseMoved(double x, double y, bool leftDown, bool middleDown,
|
2008-03-27 09:53:51 +00:00
|
|
|
bool rightDown, bool shiftDown, bool ctrlDown);
|
|
|
|
void MouseLeftDown(double x, double y);
|
2008-04-22 10:53:42 +00:00
|
|
|
void MouseLeftUp(double x, double y);
|
2008-03-25 10:02:13 +00:00
|
|
|
void MouseLeftDoubleClick(double x, double y);
|
2008-07-06 07:56:24 +00:00
|
|
|
void MouseMiddleOrRightDown(double x, double y);
|
2009-09-23 10:59:59 +00:00
|
|
|
void MouseRightUp(double x, double y);
|
2008-04-01 10:48:44 +00:00
|
|
|
void MouseScroll(double x, double y, int delta);
|
2016-05-05 05:54:05 +00:00
|
|
|
void MouseLeave();
|
2009-09-28 10:01:34 +00:00
|
|
|
bool KeyDown(int c);
|
2013-09-16 19:51:20 +00:00
|
|
|
void EditControlDone(const char *s);
|
2009-07-20 19:05:33 +00:00
|
|
|
|
2013-10-28 04:28:39 +00:00
|
|
|
int64_t lastSpaceNavigatorTime;
|
2009-07-20 19:05:33 +00:00
|
|
|
hGroup lastSpaceNavigatorGroup;
|
|
|
|
void SpaceNavigatorMoved(double tx, double ty, double tz,
|
|
|
|
double rx, double ry, double rz, bool shiftDown);
|
2016-05-05 05:54:05 +00:00
|
|
|
void SpaceNavigatorButtonUp();
|
2008-03-28 10:00:37 +00:00
|
|
|
};
|
2008-03-25 10:02:13 +00:00
|
|
|
|
2008-03-26 09:18:12 +00:00
|
|
|
|
2008-03-25 10:02:13 +00:00
|
|
|
#endif
|