2009-09-29 13:14:47 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// For the configuration screen, setup items that are not specific to the
|
|
|
|
// file being edited right now.
|
2013-07-28 22:08:34 +00:00
|
|
|
//
|
|
|
|
// Copyright 2008-2013 Jonathan Westhues.
|
2009-09-29 13:14:47 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
#include "solvespace.h"
|
|
|
|
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenChangeLightDirection(int link, uint32_t v) {
|
2016-01-26 11:19:52 +00:00
|
|
|
SS.TW.ShowEditControl(8, ssprintf("%.2f, %.2f, %.2f", CO(SS.lightDir[v])));
|
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
|
|
|
SS.TW.edit.meaning = Edit::LIGHT_DIRECTION;
|
2009-09-29 13:14:47 +00:00
|
|
|
SS.TW.edit.i = 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
|
|
|
void TextWindow::ScreenChangeLightIntensity(int link, uint32_t v) {
|
2016-01-26 11:19:52 +00:00
|
|
|
SS.TW.ShowEditControl(31, ssprintf("%.2f", SS.lightIntensity[v]));
|
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
|
|
|
SS.TW.edit.meaning = Edit::LIGHT_INTENSITY;
|
2009-09-29 13:14:47 +00:00
|
|
|
SS.TW.edit.i = v;
|
|
|
|
}
|
|
|
|
|
2020-07-17 20:59:17 +00:00
|
|
|
void TextWindow::ScreenChangeLightAmbient(int link, uint32_t v) {
|
|
|
|
SS.TW.ShowEditControl(31, ssprintf("%.2f", SS.ambientIntensity));
|
|
|
|
SS.TW.edit.meaning = Edit::LIGHT_AMBIENT;
|
|
|
|
SS.TW.edit.i = 0;
|
|
|
|
}
|
|
|
|
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenChangeColor(int link, uint32_t v) {
|
2016-01-26 11:19:52 +00:00
|
|
|
SS.TW.ShowEditControlWithColorPicker(13, SS.modelColor[v]);
|
2010-07-21 05:04:03 +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
|
|
|
SS.TW.edit.meaning = Edit::COLOR;
|
2009-09-29 13:14:47 +00:00
|
|
|
SS.TW.edit.i = 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
|
|
|
void TextWindow::ScreenChangeChordTolerance(int link, uint32_t v) {
|
2016-01-27 04:07:54 +00:00
|
|
|
SS.TW.ShowEditControl(3, ssprintf("%lg", SS.chordTol));
|
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
|
|
|
SS.TW.edit.meaning = Edit::CHORD_TOLERANCE;
|
2016-01-27 04:07:54 +00:00
|
|
|
SS.TW.edit.i = 0;
|
2009-09-29 13:14:47 +00:00
|
|
|
}
|
|
|
|
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenChangeMaxSegments(int link, uint32_t v) {
|
2016-01-26 11:19:52 +00:00
|
|
|
SS.TW.ShowEditControl(3, ssprintf("%d", SS.maxSegments));
|
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
|
|
|
SS.TW.edit.meaning = Edit::MAX_SEGMENTS;
|
2016-01-27 04:07:54 +00:00
|
|
|
SS.TW.edit.i = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TextWindow::ScreenChangeExportChordTolerance(int link, uint32_t v) {
|
|
|
|
SS.TW.ShowEditControl(3, ssprintf("%lg", SS.exportChordTol));
|
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
|
|
|
SS.TW.edit.meaning = Edit::CHORD_TOLERANCE;
|
2016-01-27 04:07:54 +00:00
|
|
|
SS.TW.edit.i = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TextWindow::ScreenChangeExportMaxSegments(int link, uint32_t v) {
|
|
|
|
SS.TW.ShowEditControl(3, ssprintf("%d", SS.exportMaxSegments));
|
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
|
|
|
SS.TW.edit.meaning = Edit::MAX_SEGMENTS;
|
2016-01-27 04:07:54 +00:00
|
|
|
SS.TW.edit.i = 1;
|
2009-09-29 13:14:47 +00:00
|
|
|
}
|
|
|
|
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenChangeCameraTangent(int link, uint32_t v) {
|
2016-01-26 11:19:52 +00:00
|
|
|
SS.TW.ShowEditControl(3, ssprintf("%.3f", 1000*SS.cameraTangent));
|
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
|
|
|
SS.TW.edit.meaning = Edit::CAMERA_TANGENT;
|
2009-09-29 13:14:47 +00:00
|
|
|
}
|
|
|
|
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenChangeGridSpacing(int link, uint32_t v) {
|
2016-01-26 11:19:52 +00:00
|
|
|
SS.TW.ShowEditControl(3, SS.MmToString(SS.gridSpacing));
|
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
|
|
|
SS.TW.edit.meaning = Edit::GRID_SPACING;
|
2009-09-29 13:14:47 +00:00
|
|
|
}
|
|
|
|
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenChangeDigitsAfterDecimal(int link, uint32_t v) {
|
2019-05-23 17:19:37 +00:00
|
|
|
SS.TW.ShowEditControl(14, ssprintf("%d", SS.UnitDigitsAfterDecimal()));
|
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
|
|
|
SS.TW.edit.meaning = Edit::DIGITS_AFTER_DECIMAL;
|
2010-09-24 02:58:34 +00:00
|
|
|
}
|
|
|
|
|
2019-05-23 17:19:37 +00:00
|
|
|
void TextWindow::ScreenChangeDigitsAfterDecimalDegree(int link, uint32_t v) {
|
|
|
|
SS.TW.ShowEditControl(14, ssprintf("%d", SS.afterDecimalDegree));
|
|
|
|
SS.TW.edit.meaning = Edit::DIGITS_AFTER_DECIMAL_DEGREE;
|
|
|
|
}
|
|
|
|
|
Add a setting to format constraint labels using SI prefixes.
Supported metric units: km, m, cm, mm, µm, nm.
Supported USCS units: in, mil, µin.
Also, use the newly introduced unit formatting machinery in tools for
measuring perimeter, area and volume, so that e.g. volume is not
displayed in millions of cubic millimeters.
2017-04-04 17:03:32 +00:00
|
|
|
void TextWindow::ScreenChangeUseSIPrefixes(int link, uint32_t v) {
|
|
|
|
SS.useSIPrefixes = !SS.useSIPrefixes;
|
|
|
|
SS.GW.Invalidate();
|
|
|
|
}
|
|
|
|
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenChangeExportScale(int link, uint32_t v) {
|
2016-01-26 11:19:52 +00:00
|
|
|
SS.TW.ShowEditControl(5, ssprintf("%.3f", (double)SS.exportScale));
|
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
|
|
|
SS.TW.edit.meaning = Edit::EXPORT_SCALE;
|
2009-09-29 13:14:47 +00:00
|
|
|
}
|
|
|
|
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenChangeExportOffset(int link, uint32_t v) {
|
2016-01-26 11:19:52 +00:00
|
|
|
SS.TW.ShowEditControl(3, SS.MmToString(SS.exportOffset));
|
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
|
|
|
SS.TW.edit.meaning = Edit::EXPORT_OFFSET;
|
2009-09-29 13:14:47 +00:00
|
|
|
}
|
|
|
|
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenChangeFixExportColors(int link, uint32_t v) {
|
2009-09-29 13:14:47 +00:00
|
|
|
SS.fixExportColors = !SS.fixExportColors;
|
|
|
|
}
|
|
|
|
|
2020-03-25 03:26:58 +00:00
|
|
|
void TextWindow::ScreenChangeExportBackgroundColor(int link, uint32_t v) {
|
|
|
|
SS.exportBackgroundColor = !SS.exportBackgroundColor;
|
|
|
|
}
|
|
|
|
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenChangeBackFaces(int link, uint32_t v) {
|
2009-09-29 13:14:47 +00:00
|
|
|
SS.drawBackFaces = !SS.drawBackFaces;
|
2018-07-12 19:29:44 +00:00
|
|
|
SS.GW.Invalidate(/*clearPersistent=*/true);
|
2009-09-29 13:14:47 +00:00
|
|
|
}
|
|
|
|
|
2016-12-29 14:34:30 +00:00
|
|
|
void TextWindow::ScreenChangeTurntableNav(int link, uint32_t v) {
|
|
|
|
SS.turntableNav = !SS.turntableNav;
|
|
|
|
if(SS.turntableNav) {
|
|
|
|
// If turntable nav is being turned on, align view so Z is vertical
|
|
|
|
SS.GW.AnimateOnto(Quaternion::From(Vector::From(-1, 0, 0), Vector::From(0, 0, 1)),
|
|
|
|
SS.GW.offset);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-26 22:34:53 +00:00
|
|
|
void TextWindow::ScreenChangeImmediatelyEditDimension(int link, uint32_t v) {
|
|
|
|
SS.immediatelyEditDimension = !SS.immediatelyEditDimension;
|
|
|
|
SS.GW.Invalidate(/*clearPersistent=*/true);
|
|
|
|
}
|
|
|
|
|
2017-03-30 14:39:42 +00:00
|
|
|
void TextWindow::ScreenChangeShowContourAreas(int link, uint32_t v) {
|
|
|
|
SS.showContourAreas = !SS.showContourAreas;
|
2018-07-12 19:29:44 +00:00
|
|
|
SS.GW.Invalidate();
|
2017-03-30 14:39:42 +00:00
|
|
|
}
|
|
|
|
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenChangeCheckClosedContour(int link, uint32_t v) {
|
2009-10-01 10:35:11 +00:00
|
|
|
SS.checkClosedContour = !SS.checkClosedContour;
|
2018-07-12 19:29:44 +00:00
|
|
|
SS.GW.Invalidate();
|
2009-10-01 10:35:11 +00:00
|
|
|
}
|
|
|
|
|
2018-04-20 14:43:49 +00:00
|
|
|
void TextWindow::ScreenChangeAutomaticLineConstraints(int link, uint32_t v) {
|
|
|
|
SS.automaticLineConstraints = !SS.automaticLineConstraints;
|
|
|
|
SS.GW.Invalidate();
|
|
|
|
}
|
|
|
|
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenChangeShadedTriangles(int link, uint32_t v) {
|
2009-09-29 13:14:47 +00:00
|
|
|
SS.exportShadedTriangles = !SS.exportShadedTriangles;
|
2018-07-12 19:29:44 +00:00
|
|
|
SS.GW.Invalidate();
|
2009-09-29 13:14:47 +00:00
|
|
|
}
|
|
|
|
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenChangePwlCurves(int link, uint32_t v) {
|
2009-09-29 13:14:47 +00:00
|
|
|
SS.exportPwlCurves = !SS.exportPwlCurves;
|
2018-07-12 19:29:44 +00:00
|
|
|
SS.GW.Invalidate();
|
2009-09-29 13:14:47 +00:00
|
|
|
}
|
|
|
|
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenChangeCanvasSizeAuto(int link, uint32_t v) {
|
2010-05-09 18:25:23 +00:00
|
|
|
if(link == 't') {
|
|
|
|
SS.exportCanvasSizeAuto = true;
|
|
|
|
} else {
|
|
|
|
SS.exportCanvasSizeAuto = false;
|
|
|
|
}
|
2018-07-12 19:29:44 +00:00
|
|
|
SS.GW.Invalidate();
|
2009-09-29 13:14:47 +00:00
|
|
|
}
|
|
|
|
|
Use C99 integer types and C++ boolean types/values
This change comprehensively replaces the use of Microsoft-standard integer
and boolean types with their C99/C++ standard equivalents, as the latter is
more appropriate for a cross-platform application. With matter-of-course
exceptions in the Win32-specific code, the types/values have been converted
as follows:
QWORD --> uint64_t
SQWORD --> int64_t
DWORD --> uint32_t
SDWORD --> int32_t
WORD --> uint16_t
SWORD --> int16_t
BYTE --> uint8_t
BOOL --> bool
TRUE --> true
FALSE --> false
The following related changes are also included:
* Added C99 integer type definitions for Windows, as stdint.h is not
available prior to Visual Studio 2010
* Changed types of some variables in the SolveSpace class from 'int' to
'bool', as they actually represent boolean settings
* Implemented new Cnf{Freeze,Thaw}Bool() functions to support boolean
variables in the Registry
* Cnf{Freeze,Thaw}DWORD() are now Cnf{Freeze,Thaw}Int()
* TtfFont::Get{WORD,DWORD}() are now TtfFont::Get{USHORT,ULONG}() (names
inspired by the OpenType spec)
* RGB colors are packed into an integer of type uint32_t (nee DWORD), but
in a few places, these were represented by an int; these have been
corrected to uint32_t
2013-10-02 05:45:13 +00:00
|
|
|
void TextWindow::ScreenChangeCanvasSize(int link, uint32_t v) {
|
2009-09-29 13:14:47 +00:00
|
|
|
double d;
|
|
|
|
switch(v) {
|
|
|
|
case 0: d = SS.exportMargin.left; break;
|
|
|
|
case 1: d = SS.exportMargin.right; break;
|
|
|
|
case 2: d = SS.exportMargin.bottom; break;
|
|
|
|
case 3: d = SS.exportMargin.top; break;
|
|
|
|
|
|
|
|
case 10: d = SS.exportCanvas.width; break;
|
|
|
|
case 11: d = SS.exportCanvas.height; break;
|
|
|
|
case 12: d = SS.exportCanvas.dx; break;
|
|
|
|
case 13: d = SS.exportCanvas.dy; break;
|
|
|
|
|
|
|
|
default: return;
|
|
|
|
}
|
2016-01-26 11:19:52 +00:00
|
|
|
int col = 13;
|
|
|
|
if(v < 10) col = 11;
|
|
|
|
SS.TW.ShowEditControl(col, SS.MmToString(d));
|
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
|
|
|
SS.TW.edit.meaning = Edit::CANVAS_SIZE;
|
2009-09-29 13:14:47 +00:00
|
|
|
SS.TW.edit.i = 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
|
|
|
void TextWindow::ScreenChangeGCodeParameter(int link, uint32_t v) {
|
2015-11-06 08:40:12 +00:00
|
|
|
std::string buf;
|
2010-01-14 04:47:17 +00:00
|
|
|
switch(link) {
|
|
|
|
case 'd':
|
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
|
|
|
SS.TW.edit.meaning = Edit::G_CODE_DEPTH;
|
2015-11-06 08:40:12 +00:00
|
|
|
buf += SS.MmToString(SS.gCode.depth);
|
2010-01-14 04:47:17 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 's':
|
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
|
|
|
SS.TW.edit.meaning = Edit::G_CODE_PASSES;
|
2015-11-06 08:40:12 +00:00
|
|
|
buf += std::to_string(SS.gCode.passes);
|
2010-01-14 04:47:17 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'F':
|
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
|
|
|
SS.TW.edit.meaning = Edit::G_CODE_FEED;
|
2015-11-06 08:40:12 +00:00
|
|
|
buf += SS.MmToString(SS.gCode.feed);
|
2010-01-14 04:47:17 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'P':
|
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
|
|
|
SS.TW.edit.meaning = Edit::G_CODE_PLUNGE_FEED;
|
2015-11-06 08:40:12 +00:00
|
|
|
buf += SS.MmToString(SS.gCode.plungeFeed);
|
2010-01-14 04:47:17 +00:00
|
|
|
break;
|
|
|
|
}
|
2016-01-26 11:19:52 +00:00
|
|
|
SS.TW.ShowEditControl(14, buf);
|
2010-01-14 04:47:17 +00:00
|
|
|
}
|
|
|
|
|
2015-03-29 04:46:57 +00:00
|
|
|
void TextWindow::ScreenChangeAutosaveInterval(int link, uint32_t v) {
|
2016-01-26 11:19:52 +00:00
|
|
|
SS.TW.ShowEditControl(3, std::to_string(SS.autosaveInterval));
|
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
|
|
|
SS.TW.edit.meaning = Edit::AUTOSAVE_INTERVAL;
|
2015-03-29 04:46:57 +00:00
|
|
|
}
|
|
|
|
|
2020-09-12 19:52:27 +00:00
|
|
|
void TextWindow::ScreenChangeFindConstraintTimeout(int link, uint32_t v) {
|
|
|
|
SS.TW.ShowEditControl(3, std::to_string(SS.timeoutRedundantConstr));
|
|
|
|
SS.TW.edit.meaning = Edit::FIND_CONSTRAINT_TIMEOUT;
|
|
|
|
}
|
|
|
|
|
2016-05-05 05:54:05 +00:00
|
|
|
void TextWindow::ShowConfiguration() {
|
2009-09-29 13:14:47 +00:00
|
|
|
int i;
|
2010-08-14 19:00:25 +00:00
|
|
|
Printf(true, "%Ft user color (r, g, b)");
|
2015-03-29 00:30:52 +00:00
|
|
|
|
2009-09-29 13:14:47 +00:00
|
|
|
for(i = 0; i < SS.MODEL_COLORS; i++) {
|
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
|
|
|
Printf(false, "%Bp #%d: %Bz %Bp (%@, %@, %@) %f%D%Ll%Fl[change]%E",
|
2009-09-29 13:14:47 +00:00
|
|
|
(i & 1) ? 'd' : 'a',
|
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
|
|
|
i, &SS.modelColor[i],
|
2009-09-29 13:14:47 +00:00
|
|
|
(i & 1) ? 'd' : 'a',
|
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
|
|
|
SS.modelColor[i].redF(),
|
|
|
|
SS.modelColor[i].greenF(),
|
|
|
|
SS.modelColor[i].blueF(),
|
2009-09-29 13:14:47 +00:00
|
|
|
&ScreenChangeColor, i);
|
|
|
|
}
|
2015-03-29 00:30:52 +00:00
|
|
|
|
2009-09-29 13:14:47 +00:00
|
|
|
Printf(false, "");
|
|
|
|
Printf(false, "%Ft light direction intensity");
|
|
|
|
for(i = 0; i < 2; i++) {
|
|
|
|
Printf(false, "%Bp #%d (%2,%2,%2)%Fl%D%f%Ll[c]%E "
|
|
|
|
"%2 %Fl%D%f%Ll[c]%E",
|
|
|
|
(i & 1) ? 'd' : 'a', i,
|
|
|
|
CO(SS.lightDir[i]), i, &ScreenChangeLightDirection,
|
|
|
|
SS.lightIntensity[i], i, &ScreenChangeLightIntensity);
|
|
|
|
}
|
2020-07-17 20:59:17 +00:00
|
|
|
Printf(false, "%Bp ambient lighting "
|
|
|
|
"%2 %Fl%D%f%Ll[c]%E",
|
|
|
|
(i & 1) ? 'd' : 'a', i,
|
|
|
|
SS.ambientIntensity, &ScreenChangeLightAmbient);
|
2009-09-29 13:14:47 +00:00
|
|
|
|
|
|
|
Printf(false, "");
|
Use relative chord tolerance instead of absolute.
Commit 89eb208 has improved the overall situation with chord
tolerance, but it changed the display chord tolerance to use
an absolute value in millimeters as a stopgap measure.
This commit changes the display chord tolerance to be specified
in percents of entity bounding box instead of millimeters.
As a result, the linearized curves are both zoom level and sketch
scale independent.
In order to compute the bounding box, all entities are generated
twice. However, this shouldn't result in a noticeable slowdown,
since the bounding box calculation does not need the expensive
triangle mesh generation and the solver will converge immediately
on the second run.
Since the meaning of the preference has changed, a new name is
used (ChordTolerancePct instead of ChordTolerance), so that it
would be reset to the default value after updating SolveSpace.
The default value, 0.5%, was selected using trial and error by
judging whether cylinders of moderate dimensions were looking
aesthetically pleasing enough.
After this change, the only real function of the spacebar
shortcut is to reload imported groups, since manual regeneration
should not change anything anymore unless there is a bug.
2016-01-29 10:33:56 +00:00
|
|
|
Printf(false, "%Ft chord tolerance (in percents)%E");
|
|
|
|
Printf(false, "%Ba %@ %% %Fl%Ll%f%D[change]%E; %@ mm, %d triangles",
|
2009-09-29 13:14:47 +00:00
|
|
|
SS.chordTol,
|
Use relative chord tolerance instead of absolute.
Commit 89eb208 has improved the overall situation with chord
tolerance, but it changed the display chord tolerance to use
an absolute value in millimeters as a stopgap measure.
This commit changes the display chord tolerance to be specified
in percents of entity bounding box instead of millimeters.
As a result, the linearized curves are both zoom level and sketch
scale independent.
In order to compute the bounding box, all entities are generated
twice. However, this shouldn't result in a noticeable slowdown,
since the bounding box calculation does not need the expensive
triangle mesh generation and the solver will converge immediately
on the second run.
Since the meaning of the preference has changed, a new name is
used (ChordTolerancePct instead of ChordTolerance), so that it
would be reset to the default value after updating SolveSpace.
The default value, 0.5%, was selected using trial and error by
judging whether cylinders of moderate dimensions were looking
aesthetically pleasing enough.
After this change, the only real function of the spacebar
shortcut is to reload imported groups, since manual regeneration
should not change anything anymore unless there is a bug.
2016-01-29 10:33:56 +00:00
|
|
|
&ScreenChangeChordTolerance, 0, SS.chordTolCalculated,
|
2009-09-29 13:14:47 +00:00
|
|
|
SK.GetGroup(SS.GW.activeGroup)->displayMesh.l.n);
|
|
|
|
Printf(false, "%Ft max piecewise linear segments%E");
|
2009-09-30 10:02:15 +00:00
|
|
|
Printf(false, "%Ba %d %Fl%Ll%f[change]%E",
|
2009-09-29 13:14:47 +00:00
|
|
|
SS.maxSegments,
|
|
|
|
&ScreenChangeMaxSegments);
|
|
|
|
|
2016-01-27 04:07:54 +00:00
|
|
|
Printf(false, "");
|
|
|
|
Printf(false, "%Ft export chord tolerance (in mm)%E");
|
|
|
|
Printf(false, "%Ba %@ %Fl%Ll%f%D[change]%E",
|
|
|
|
SS.exportChordTol,
|
|
|
|
&ScreenChangeExportChordTolerance, 0);
|
|
|
|
Printf(false, "%Ft export max piecewise linear segments%E");
|
|
|
|
Printf(false, "%Ba %d %Fl%Ll%f[change]%E",
|
|
|
|
SS.exportMaxSegments,
|
|
|
|
&ScreenChangeExportMaxSegments);
|
|
|
|
|
2009-09-29 13:14:47 +00:00
|
|
|
Printf(false, "");
|
|
|
|
Printf(false, "%Ft perspective factor (0 for parallel)%E");
|
2009-09-30 10:02:15 +00:00
|
|
|
Printf(false, "%Ba %# %Fl%Ll%f%D[change]%E",
|
2009-09-29 13:14:47 +00:00
|
|
|
SS.cameraTangent*1000,
|
|
|
|
&ScreenChangeCameraTangent, 0);
|
|
|
|
Printf(false, "%Ft snap grid spacing%E");
|
|
|
|
Printf(false, "%Ba %s %Fl%Ll%f%D[change]%E",
|
2015-11-06 08:40:12 +00:00
|
|
|
SS.MmToString(SS.gridSpacing).c_str(),
|
2009-09-29 13:14:47 +00:00
|
|
|
&ScreenChangeGridSpacing, 0);
|
Add a setting to format constraint labels using SI prefixes.
Supported metric units: km, m, cm, mm, µm, nm.
Supported USCS units: in, mil, µin.
Also, use the newly introduced unit formatting machinery in tools for
measuring perimeter, area and volume, so that e.g. volume is not
displayed in millions of cubic millimeters.
2017-04-04 17:03:32 +00:00
|
|
|
|
|
|
|
Printf(false, "");
|
2010-09-24 02:58:34 +00:00
|
|
|
Printf(false, "%Ft digits after decimal point to show%E");
|
2019-05-23 17:19:37 +00:00
|
|
|
Printf(false, "%Ba%Ft distances: %Fd%d %Fl%Ll%f%D[change]%E (e.g. '%s')",
|
2010-09-24 02:58:34 +00:00
|
|
|
SS.UnitDigitsAfterDecimal(),
|
|
|
|
&ScreenChangeDigitsAfterDecimal, 0,
|
2015-11-06 08:40:12 +00:00
|
|
|
SS.MmToString(SS.StringToMm("1.23456789")).c_str());
|
Add a setting to format constraint labels using SI prefixes.
Supported metric units: km, m, cm, mm, µm, nm.
Supported USCS units: in, mil, µin.
Also, use the newly introduced unit formatting machinery in tools for
measuring perimeter, area and volume, so that e.g. volume is not
displayed in millions of cubic millimeters.
2017-04-04 17:03:32 +00:00
|
|
|
Printf(false, "%Bd%Ft angles: %Fd%d %Fl%Ll%f%D[change]%E (e.g. '%s')",
|
2019-05-23 17:19:37 +00:00
|
|
|
SS.afterDecimalDegree,
|
|
|
|
&ScreenChangeDigitsAfterDecimalDegree, 0,
|
|
|
|
SS.DegreeToString(1.23456789).c_str());
|
Add a setting to format constraint labels using SI prefixes.
Supported metric units: km, m, cm, mm, µm, nm.
Supported USCS units: in, mil, µin.
Also, use the newly introduced unit formatting machinery in tools for
measuring perimeter, area and volume, so that e.g. volume is not
displayed in millions of cubic millimeters.
2017-04-04 17:03:32 +00:00
|
|
|
Printf(false, " %Fd%f%Ll%s use SI prefixes for distances%E",
|
|
|
|
&ScreenChangeUseSIPrefixes,
|
|
|
|
SS.useSIPrefixes ? CHECK_TRUE : CHECK_FALSE);
|
2009-09-29 13:14:47 +00:00
|
|
|
|
|
|
|
Printf(false, "");
|
2009-10-12 09:28:34 +00:00
|
|
|
Printf(false, "%Ft export scale factor (1:1=mm, 1:25.4=inch)");
|
|
|
|
Printf(false, "%Ba 1:%# %Fl%Ll%f%D[change]%E",
|
2009-09-29 13:14:47 +00:00
|
|
|
(double)SS.exportScale,
|
|
|
|
&ScreenChangeExportScale, 0);
|
|
|
|
Printf(false, "%Ft cutter radius offset (0=no offset) ");
|
|
|
|
Printf(false, "%Ba %s %Fl%Ll%f%D[change]%E",
|
2015-11-06 08:40:12 +00:00
|
|
|
SS.MmToString(SS.exportOffset).c_str(),
|
2009-09-29 13:14:47 +00:00
|
|
|
&ScreenChangeExportOffset, 0);
|
|
|
|
|
|
|
|
Printf(false, "");
|
2015-11-05 19:39:27 +00:00
|
|
|
Printf(false, " %Fd%f%Ll%s export shaded 2d triangles%E",
|
2009-09-29 13:14:47 +00:00
|
|
|
&ScreenChangeShadedTriangles,
|
2010-05-09 18:25:23 +00:00
|
|
|
SS.exportShadedTriangles ? CHECK_TRUE : CHECK_FALSE);
|
2009-09-29 13:14:47 +00:00
|
|
|
if(fabs(SS.exportOffset) > LENGTH_EPS) {
|
2015-11-05 19:39:27 +00:00
|
|
|
Printf(false, " %Fd%s curves as piecewise linear%E "
|
2010-05-09 18:25:23 +00:00
|
|
|
"(since cutter radius is not zero)", CHECK_TRUE);
|
2009-09-29 13:14:47 +00:00
|
|
|
} else {
|
2015-11-05 19:39:27 +00:00
|
|
|
Printf(false, " %Fd%f%Ll%s export curves as piecewise linear%E",
|
2009-09-29 13:14:47 +00:00
|
|
|
&ScreenChangePwlCurves,
|
2010-05-09 18:25:23 +00:00
|
|
|
SS.exportPwlCurves ? CHECK_TRUE : CHECK_FALSE);
|
2009-09-29 13:14:47 +00:00
|
|
|
}
|
2015-11-05 19:39:27 +00:00
|
|
|
Printf(false, " %Fd%f%Ll%s fix white exported lines%E",
|
2010-09-24 02:58:34 +00:00
|
|
|
&ScreenChangeFixExportColors,
|
|
|
|
SS.fixExportColors ? CHECK_TRUE : CHECK_FALSE);
|
2020-03-25 03:26:58 +00:00
|
|
|
Printf(false, " %Fd%f%Ll%s export background color%E",
|
|
|
|
&ScreenChangeExportBackgroundColor,
|
|
|
|
SS.exportBackgroundColor ? CHECK_TRUE : CHECK_FALSE);
|
2009-09-29 13:14:47 +00:00
|
|
|
|
|
|
|
Printf(false, "");
|
2010-05-09 18:25:23 +00:00
|
|
|
Printf(false, "%Ft export canvas size: "
|
2015-11-05 19:39:27 +00:00
|
|
|
"%f%Fd%Lf%s fixed%E "
|
|
|
|
"%f%Fd%Lt%s auto%E",
|
2009-09-29 13:14:47 +00:00
|
|
|
&ScreenChangeCanvasSizeAuto,
|
2010-05-09 18:25:23 +00:00
|
|
|
!SS.exportCanvasSizeAuto ? RADIO_TRUE : RADIO_FALSE,
|
2009-09-29 13:14:47 +00:00
|
|
|
&ScreenChangeCanvasSizeAuto,
|
2010-05-09 18:25:23 +00:00
|
|
|
SS.exportCanvasSizeAuto ? RADIO_TRUE : RADIO_FALSE);
|
|
|
|
|
2009-09-29 13:14:47 +00:00
|
|
|
if(SS.exportCanvasSizeAuto) {
|
|
|
|
Printf(false, "%Ft (by margins around exported geometry)");
|
|
|
|
Printf(false, "%Ba%Ft left: %Fd%s %Fl%Ll%f%D[change]%E",
|
2015-11-06 08:40:12 +00:00
|
|
|
SS.MmToString(SS.exportMargin.left).c_str(), &ScreenChangeCanvasSize, 0);
|
2009-09-29 13:14:47 +00:00
|
|
|
Printf(false, "%Bd%Ft right: %Fd%s %Fl%Ll%f%D[change]%E",
|
2015-11-06 08:40:12 +00:00
|
|
|
SS.MmToString(SS.exportMargin.right).c_str(), &ScreenChangeCanvasSize, 1);
|
2009-09-29 13:14:47 +00:00
|
|
|
Printf(false, "%Ba%Ft bottom: %Fd%s %Fl%Ll%f%D[change]%E",
|
2015-11-06 08:40:12 +00:00
|
|
|
SS.MmToString(SS.exportMargin.bottom).c_str(), &ScreenChangeCanvasSize, 2);
|
2009-09-29 13:14:47 +00:00
|
|
|
Printf(false, "%Bd%Ft top: %Fd%s %Fl%Ll%f%D[change]%E",
|
2015-11-06 08:40:12 +00:00
|
|
|
SS.MmToString(SS.exportMargin.top).c_str(), &ScreenChangeCanvasSize, 3);
|
2009-09-29 13:14:47 +00:00
|
|
|
} else {
|
|
|
|
Printf(false, "%Ft (by absolute dimensions and offsets)");
|
|
|
|
Printf(false, "%Ba%Ft width: %Fd%s %Fl%Ll%f%D[change]%E",
|
2015-11-06 08:40:12 +00:00
|
|
|
SS.MmToString(SS.exportCanvas.width).c_str(), &ScreenChangeCanvasSize, 10);
|
2009-09-29 13:14:47 +00:00
|
|
|
Printf(false, "%Bd%Ft height: %Fd%s %Fl%Ll%f%D[change]%E",
|
2015-11-06 08:40:12 +00:00
|
|
|
SS.MmToString(SS.exportCanvas.height).c_str(), &ScreenChangeCanvasSize, 11);
|
2009-09-29 13:14:47 +00:00
|
|
|
Printf(false, "%Ba%Ft offset x: %Fd%s %Fl%Ll%f%D[change]%E",
|
2015-11-06 08:40:12 +00:00
|
|
|
SS.MmToString(SS.exportCanvas.dx).c_str(), &ScreenChangeCanvasSize, 12);
|
2009-09-29 13:14:47 +00:00
|
|
|
Printf(false, "%Bd%Ft offset y: %Fd%s %Fl%Ll%f%D[change]%E",
|
2015-11-06 08:40:12 +00:00
|
|
|
SS.MmToString(SS.exportCanvas.dy).c_str(), &ScreenChangeCanvasSize, 13);
|
2009-09-29 13:14:47 +00:00
|
|
|
}
|
|
|
|
|
2010-01-14 04:47:17 +00:00
|
|
|
Printf(false, "");
|
|
|
|
Printf(false, "%Ft exported g code parameters");
|
|
|
|
Printf(false, "%Ba%Ft depth: %Fd%s %Fl%Ld%f[change]%E",
|
2015-11-06 08:40:12 +00:00
|
|
|
SS.MmToString(SS.gCode.depth).c_str(), &ScreenChangeGCodeParameter);
|
2010-01-14 04:47:17 +00:00
|
|
|
Printf(false, "%Bd%Ft passes: %Fd%d %Fl%Ls%f[change]%E",
|
|
|
|
SS.gCode.passes, &ScreenChangeGCodeParameter);
|
|
|
|
Printf(false, "%Ba%Ft feed: %Fd%s %Fl%LF%f[change]%E",
|
2015-11-06 08:40:12 +00:00
|
|
|
SS.MmToString(SS.gCode.feed).c_str(), &ScreenChangeGCodeParameter);
|
2010-01-14 04:47:17 +00:00
|
|
|
Printf(false, "%Bd%Ft plunge fd: %Fd%s %Fl%LP%f[change]%E",
|
2015-11-06 08:40:12 +00:00
|
|
|
SS.MmToString(SS.gCode.plungeFeed).c_str(), &ScreenChangeGCodeParameter);
|
2010-09-24 02:58:34 +00:00
|
|
|
|
|
|
|
Printf(false, "");
|
2015-11-05 19:39:27 +00:00
|
|
|
Printf(false, " %Fd%f%Ll%s draw triangle back faces in red%E",
|
2010-09-24 02:58:34 +00:00
|
|
|
&ScreenChangeBackFaces,
|
|
|
|
SS.drawBackFaces ? CHECK_TRUE : CHECK_FALSE);
|
2015-11-05 19:39:27 +00:00
|
|
|
Printf(false, " %Fd%f%Ll%s check sketch for closed contour%E",
|
2010-09-24 02:58:34 +00:00
|
|
|
&ScreenChangeCheckClosedContour,
|
|
|
|
SS.checkClosedContour ? CHECK_TRUE : CHECK_FALSE);
|
2017-03-30 14:39:42 +00:00
|
|
|
Printf(false, " %Fd%f%Ll%s show areas of closed contours%E",
|
|
|
|
&ScreenChangeShowContourAreas,
|
|
|
|
SS.showContourAreas ? CHECK_TRUE : CHECK_FALSE);
|
2016-12-29 14:34:30 +00:00
|
|
|
Printf(false, " %Fd%f%Ll%s enable automatic line constraints%E",
|
|
|
|
&ScreenChangeAutomaticLineConstraints,
|
|
|
|
SS.automaticLineConstraints ? CHECK_TRUE : CHECK_FALSE);
|
|
|
|
Printf(false, " %Fd%f%Ll%s use turntable mouse navigation%E", &ScreenChangeTurntableNav,
|
|
|
|
SS.turntableNav ? CHECK_TRUE : CHECK_FALSE);
|
2019-11-26 22:34:53 +00:00
|
|
|
Printf(false, " %Fd%f%Ll%s edit newly added dimensions%E",
|
|
|
|
&ScreenChangeImmediatelyEditDimension,
|
|
|
|
SS.immediatelyEditDimension ? CHECK_TRUE : CHECK_FALSE);
|
2015-03-29 04:46:57 +00:00
|
|
|
Printf(false, "");
|
|
|
|
Printf(false, "%Ft autosave interval (in minutes)%E");
|
|
|
|
Printf(false, "%Ba %d %Fl%Ll%f[change]%E",
|
|
|
|
SS.autosaveInterval, &ScreenChangeAutosaveInterval);
|
2020-09-12 19:52:27 +00:00
|
|
|
Printf(false, "");
|
|
|
|
Printf(false, "%Ft redundant constraint timeout (in ms)%E");
|
|
|
|
Printf(false, "%Ba %d %Fl%Ll%f[change]%E",
|
|
|
|
SS.timeoutRedundantConstr, &ScreenChangeFindConstraintTimeout);
|
2015-03-29 04:46:57 +00:00
|
|
|
|
2016-06-28 08:48:06 +00:00
|
|
|
if(canvas) {
|
|
|
|
const char *gl_vendor, *gl_renderer, *gl_version;
|
|
|
|
canvas->GetIdent(&gl_vendor, &gl_renderer, &gl_version);
|
|
|
|
Printf(false, "");
|
|
|
|
Printf(false, " %Ftgl vendor %E%s", gl_vendor);
|
|
|
|
Printf(false, " %Ft renderer %E%s", gl_renderer);
|
|
|
|
Printf(false, " %Ft version %E%s", gl_version);
|
|
|
|
}
|
2009-09-29 13:14:47 +00:00
|
|
|
}
|
|
|
|
|
2018-07-12 19:29:44 +00:00
|
|
|
bool TextWindow::EditControlDoneForConfiguration(const std::string &s) {
|
2009-09-29 13:14:47 +00:00
|
|
|
switch(edit.meaning) {
|
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
|
|
|
case Edit::LIGHT_INTENSITY:
|
2018-07-12 19:29:44 +00:00
|
|
|
SS.lightIntensity[edit.i] = min(1.0, max(0.0, atof(s.c_str())));
|
|
|
|
SS.GW.Invalidate();
|
2009-09-29 13:14:47 +00:00
|
|
|
break;
|
2020-07-17 20:59:17 +00:00
|
|
|
case Edit::LIGHT_AMBIENT:
|
|
|
|
SS.ambientIntensity = min(1.0, max(0.0, atof(s.c_str())));
|
|
|
|
SS.GW.Invalidate();
|
|
|
|
break;
|
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
|
|
|
case Edit::LIGHT_DIRECTION: {
|
2009-09-29 13:14:47 +00:00
|
|
|
double x, y, z;
|
2018-07-12 19:29:44 +00:00
|
|
|
if(sscanf(s.c_str(), "%lf, %lf, %lf", &x, &y, &z)==3) {
|
2009-09-29 13:14:47 +00:00
|
|
|
SS.lightDir[edit.i] = Vector::From(x, y, z);
|
Eliminate blocking in Error() and Message() calls.
This serves two purposes.
First, we want to (some day) convert these messages into a less
obtrustive form, something like toaster notifications, such that they
don't interrupt workflow as harshly. That would, of course, be
nonblocking.
Second, some platforms, like Emscripten, do not support nested event
loops, and it's not possible to display a modal dialog on them
synchronously.
When making this commit, I've reviewed all Error() and Message()
calls to ensure that only some of the following is true for all
of them:
* The call is followed a break or return statement that exits
an UI entry point (e.g. an MenuX function);
* The call is followed by cleanup (in fact, in this case the new
behavior is better, since even with a synchronous modal dialog
we have to be reentrant);
* The message is an informational message only and nothing
unexpected will happen if the operation proceeds in background.
In general, all Error() calls already satisfied the above conditions,
although in some cases I changed control flow aroudn them to more
clearly show that. The Message() calls that didn't satisfy these
conditions were reworked into an asynchronous form.
There are three explicit RunModal() calls left that need to be
reworked into an async form.
2018-07-19 21:54:05 +00:00
|
|
|
SS.GW.Invalidate();
|
2009-09-29 13:14:47 +00:00
|
|
|
} else {
|
2017-01-07 06:41:13 +00:00
|
|
|
Error(_("Bad format: specify coordinates as x, y, z"));
|
2009-09-29 13:14:47 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
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
|
|
|
case Edit::COLOR: {
|
2010-08-14 19:00:25 +00:00
|
|
|
Vector rgb;
|
2018-07-12 19:29:44 +00:00
|
|
|
if(sscanf(s.c_str(), "%lf, %lf, %lf", &rgb.x, &rgb.y, &rgb.z)==3) {
|
2010-08-14 19:00:25 +00:00
|
|
|
rgb = rgb.ClampWithin(0, 1);
|
|
|
|
SS.modelColor[edit.i] = RGBf(rgb.x, rgb.y, rgb.z);
|
2009-09-29 13:14:47 +00:00
|
|
|
} else {
|
2017-01-07 06:41:13 +00:00
|
|
|
Error(_("Bad format: specify color as r, g, b"));
|
2009-09-29 13:14:47 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
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
|
|
|
case Edit::CHORD_TOLERANCE: {
|
2016-01-27 04:07:54 +00:00
|
|
|
if(edit.i == 0) {
|
2018-07-12 19:29:44 +00:00
|
|
|
SS.chordTol = max(0.0, atof(s.c_str()));
|
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
|
|
|
SS.GenerateAll(SolveSpaceUI::Generate::ALL);
|
2016-01-27 04:07:54 +00:00
|
|
|
} else {
|
2018-07-12 19:29:44 +00:00
|
|
|
SS.exportChordTol = max(0.0, atof(s.c_str()));
|
2016-01-27 04:07:54 +00:00
|
|
|
}
|
2009-09-29 13:14:47 +00:00
|
|
|
break;
|
|
|
|
}
|
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
|
|
|
case Edit::MAX_SEGMENTS: {
|
2016-01-27 04:07:54 +00:00
|
|
|
if(edit.i == 0) {
|
2018-07-12 19:29:44 +00:00
|
|
|
SS.maxSegments = min(1000, max(7, atoi(s.c_str())));
|
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
|
|
|
SS.GenerateAll(SolveSpaceUI::Generate::ALL);
|
2016-01-27 04:07:54 +00:00
|
|
|
} else {
|
2018-07-12 19:29:44 +00:00
|
|
|
SS.exportMaxSegments = min(1000, max(7, atoi(s.c_str())));
|
2016-01-27 04:07:54 +00:00
|
|
|
}
|
2009-09-29 13:14:47 +00:00
|
|
|
break;
|
|
|
|
}
|
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
|
|
|
case Edit::CAMERA_TANGENT: {
|
2018-07-12 19:29:44 +00:00
|
|
|
SS.cameraTangent = (min(2.0, max(0.0, atof(s.c_str()))))/1000.0;
|
Eliminate blocking in Error() and Message() calls.
This serves two purposes.
First, we want to (some day) convert these messages into a less
obtrustive form, something like toaster notifications, such that they
don't interrupt workflow as harshly. That would, of course, be
nonblocking.
Second, some platforms, like Emscripten, do not support nested event
loops, and it's not possible to display a modal dialog on them
synchronously.
When making this commit, I've reviewed all Error() and Message()
calls to ensure that only some of the following is true for all
of them:
* The call is followed a break or return statement that exits
an UI entry point (e.g. an MenuX function);
* The call is followed by cleanup (in fact, in this case the new
behavior is better, since even with a synchronous modal dialog
we have to be reentrant);
* The message is an informational message only and nothing
unexpected will happen if the operation proceeds in background.
In general, all Error() calls already satisfied the above conditions,
although in some cases I changed control flow aroudn them to more
clearly show that. The Message() calls that didn't satisfy these
conditions were reworked into an asynchronous form.
There are three explicit RunModal() calls left that need to be
reworked into an async form.
2018-07-19 21:54:05 +00:00
|
|
|
SS.GW.Invalidate();
|
2010-05-03 05:15:28 +00:00
|
|
|
if(!SS.usePerspectiveProj) {
|
2017-01-07 06:41:13 +00:00
|
|
|
Message(_("The perspective factor will have no effect until you "
|
|
|
|
"enable View -> Use Perspective Projection."));
|
2009-09-29 13:14:47 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
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
|
|
|
case Edit::GRID_SPACING: {
|
2009-09-29 13:14:47 +00:00
|
|
|
SS.gridSpacing = (float)min(1e4, max(1e-3, SS.StringToMm(s)));
|
2018-07-12 19:29:44 +00:00
|
|
|
SS.GW.Invalidate();
|
2009-09-29 13:14:47 +00:00
|
|
|
break;
|
|
|
|
}
|
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
|
|
|
case Edit::DIGITS_AFTER_DECIMAL: {
|
2018-07-12 19:29:44 +00:00
|
|
|
int v = atoi(s.c_str());
|
2010-09-24 02:58:34 +00:00
|
|
|
if(v < 0 || v > 8) {
|
2019-05-23 17:19:37 +00:00
|
|
|
Error(_("Specify between 0 and %d digits after the decimal."), 8);
|
2010-09-24 02:58:34 +00:00
|
|
|
} else {
|
|
|
|
SS.SetUnitDigitsAfterDecimal(v);
|
Eliminate blocking in Error() and Message() calls.
This serves two purposes.
First, we want to (some day) convert these messages into a less
obtrustive form, something like toaster notifications, such that they
don't interrupt workflow as harshly. That would, of course, be
nonblocking.
Second, some platforms, like Emscripten, do not support nested event
loops, and it's not possible to display a modal dialog on them
synchronously.
When making this commit, I've reviewed all Error() and Message()
calls to ensure that only some of the following is true for all
of them:
* The call is followed a break or return statement that exits
an UI entry point (e.g. an MenuX function);
* The call is followed by cleanup (in fact, in this case the new
behavior is better, since even with a synchronous modal dialog
we have to be reentrant);
* The message is an informational message only and nothing
unexpected will happen if the operation proceeds in background.
In general, all Error() calls already satisfied the above conditions,
although in some cases I changed control flow aroudn them to more
clearly show that. The Message() calls that didn't satisfy these
conditions were reworked into an asynchronous form.
There are three explicit RunModal() calls left that need to be
reworked into an async form.
2018-07-19 21:54:05 +00:00
|
|
|
SS.GW.Invalidate();
|
2010-09-24 02:58:34 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2019-05-23 17:19:37 +00:00
|
|
|
case Edit::DIGITS_AFTER_DECIMAL_DEGREE: {
|
|
|
|
int v = atoi(s.c_str());
|
|
|
|
if(v < 0 || v > 4) {
|
|
|
|
Error(_("Specify between 0 and %d digits after the decimal."), 4);
|
|
|
|
} else {
|
|
|
|
SS.afterDecimalDegree = v;
|
|
|
|
SS.GW.Invalidate();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
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
|
|
|
case Edit::EXPORT_SCALE: {
|
2016-05-25 12:08:19 +00:00
|
|
|
Expr *e = Expr::From(s, /*popUpError=*/true);
|
2009-09-29 13:14:47 +00:00
|
|
|
if(e) {
|
|
|
|
double ev = e->Eval();
|
2020-05-12 13:59:23 +00:00
|
|
|
if(fabs(ev) < 0.001 || IsReasonable(ev)) {
|
2017-01-07 06:41:13 +00:00
|
|
|
Error(_("Export scale must not be zero!"));
|
2009-09-29 13:14:47 +00:00
|
|
|
} else {
|
|
|
|
SS.exportScale = (float)ev;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
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
|
|
|
case Edit::EXPORT_OFFSET: {
|
2016-05-25 12:08:19 +00:00
|
|
|
Expr *e = Expr::From(s, /*popUpError=*/true);
|
2009-09-29 13:14:47 +00:00
|
|
|
if(e) {
|
|
|
|
double ev = SS.ExprToMm(e);
|
2020-05-12 13:59:23 +00:00
|
|
|
if(IsReasonable(ev) || ev < 0) {
|
2017-01-07 06:41:13 +00:00
|
|
|
Error(_("Cutter radius offset must not be negative!"));
|
2009-09-29 13:14:47 +00:00
|
|
|
} else {
|
|
|
|
SS.exportOffset = (float)ev;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
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
|
|
|
case Edit::CANVAS_SIZE: {
|
2016-05-25 12:08:19 +00:00
|
|
|
Expr *e = Expr::From(s, /*popUpError=*/true);
|
2009-09-29 13:14:47 +00:00
|
|
|
if(!e) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
float d = (float)SS.ExprToMm(e);
|
|
|
|
switch(edit.i) {
|
|
|
|
case 0: SS.exportMargin.left = d; break;
|
|
|
|
case 1: SS.exportMargin.right = d; break;
|
|
|
|
case 2: SS.exportMargin.bottom = d; break;
|
|
|
|
case 3: SS.exportMargin.top = d; break;
|
|
|
|
|
|
|
|
case 10: SS.exportCanvas.width = d; break;
|
|
|
|
case 11: SS.exportCanvas.height = d; break;
|
|
|
|
case 12: SS.exportCanvas.dx = d; break;
|
|
|
|
case 13: SS.exportCanvas.dy = d; break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
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
|
|
|
case Edit::G_CODE_DEPTH: {
|
2016-05-25 12:08:19 +00:00
|
|
|
Expr *e = Expr::From(s, /*popUpError=*/true);
|
2010-01-14 04:47:17 +00:00
|
|
|
if(e) SS.gCode.depth = (float)SS.ExprToMm(e);
|
|
|
|
break;
|
|
|
|
}
|
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
|
|
|
case Edit::G_CODE_PASSES: {
|
2016-05-25 12:08:19 +00:00
|
|
|
Expr *e = Expr::From(s, /*popUpError=*/true);
|
2010-01-14 04:47:17 +00:00
|
|
|
if(e) SS.gCode.passes = (int)(e->Eval());
|
|
|
|
SS.gCode.passes = max(1, min(1000, SS.gCode.passes));
|
|
|
|
break;
|
|
|
|
}
|
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
|
|
|
case Edit::G_CODE_FEED: {
|
2016-05-25 12:08:19 +00:00
|
|
|
Expr *e = Expr::From(s, /*popUpError=*/true);
|
2010-01-14 04:47:17 +00:00
|
|
|
if(e) SS.gCode.feed = (float)SS.ExprToMm(e);
|
|
|
|
break;
|
|
|
|
}
|
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
|
|
|
case Edit::G_CODE_PLUNGE_FEED: {
|
2016-05-25 12:08:19 +00:00
|
|
|
Expr *e = Expr::From(s, /*popUpError=*/true);
|
2010-01-14 04:47:17 +00:00
|
|
|
if(e) SS.gCode.plungeFeed = (float)SS.ExprToMm(e);
|
|
|
|
break;
|
|
|
|
}
|
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
|
|
|
case Edit::AUTOSAVE_INTERVAL: {
|
2018-07-12 19:29:44 +00:00
|
|
|
int interval = atoi(s.c_str());
|
|
|
|
if(interval) {
|
2015-03-29 04:46:57 +00:00
|
|
|
if(interval >= 1) {
|
|
|
|
SS.autosaveInterval = interval;
|
2018-07-11 05:35:31 +00:00
|
|
|
SS.ScheduleAutosave();
|
2015-03-29 04:46:57 +00:00
|
|
|
} else {
|
2017-01-07 06:41:13 +00:00
|
|
|
Error(_("Bad value: autosave interval should be positive"));
|
2015-03-29 04:46:57 +00:00
|
|
|
}
|
|
|
|
} else {
|
2017-01-07 06:41:13 +00:00
|
|
|
Error(_("Bad format: specify interval in integral minutes"));
|
2015-03-29 04:46:57 +00:00
|
|
|
}
|
2016-06-23 11:55:15 +00:00
|
|
|
break;
|
2015-03-29 04:46:57 +00:00
|
|
|
}
|
2020-09-12 19:52:27 +00:00
|
|
|
case Edit::FIND_CONSTRAINT_TIMEOUT: {
|
|
|
|
int timeout = atoi(s.c_str());
|
|
|
|
if(timeout) {
|
|
|
|
if(timeout >= 1) {
|
|
|
|
SS.timeoutRedundantConstr = timeout;
|
|
|
|
} else {
|
|
|
|
SS.timeoutRedundantConstr = 1000;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2009-09-29 13:14:47 +00:00
|
|
|
|
|
|
|
default: return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|