MeshLib Documentation
Loading...
Searching...
No Matches
MRUnitSettings.h
Go to the documentation of this file.
1#pragma once
2
3#include "exports.h"
4#include "MRUnits.h"
5
6// This abstracts away the UI measurement unit configuration. Internally this uses `setDefaultUnitParams()`.
7
9{
10
11// Reset to some sane default.
12MRVIEWER_API void resetToDefaults();
13
14// Common:
15
16// True: `0.1`, false: `.1`.
17[[nodiscard]] MRVIEWER_API bool getShowLeadingZero();
18MRVIEWER_API void setShowLeadingZero( bool show );
19
20// Can be '\0' to indicate no separator.
21// `fractional == true` means to the right of the fractional point, if any.
22[[nodiscard]] MRVIEWER_API char getThousandsSeparator();
23void setThousandsSeparator( char ch );
24
25// Length:
26
27// In addition to length, this also controls the units for speed, area, volume, etc.
28// This can be null to indicate "no unit".
29// If `setPreferredLeadingZero == true`, will call `setShowLeadingZero()` to match this unit (currently inches = false, everything else = true).
30[[nodiscard]] MRVIEWER_API std::optional<LengthUnit> getUiLengthUnit();
31MRVIEWER_API void setUiLengthUnit( std::optional<LengthUnit> unit, bool setPreferredLeadingZero );
32
33// Angle:
34
35[[nodiscard]] MRVIEWER_API DegreesMode getDegreesMode();
36MRVIEWER_API void setDegreesMode( DegreesMode mode, bool setPreferredPrecision );
37
38// Precision:
39
40// Whether this means total number of digits or the number of digits after the decimal point depends
41// on another setting (`getDefaultUnitParams().style`) that's currently not exposed in this file.
42[[nodiscard]] MRVIEWER_API int getUiLengthPrecision();
43MRVIEWER_API void setUiLengthPrecision( int precision );
44
45[[nodiscard]] MRVIEWER_API int getUiAnglePrecision();
46MRVIEWER_API void setUiAnglePrecision( int precision );
47
48}
Definition MRUnitSettings.h:9
MRVIEWER_API char getThousandsSeparator()
MRVIEWER_API void setDegreesMode(DegreesMode mode, bool setPreferredPrecision)
MRVIEWER_API void setUiAnglePrecision(int precision)
MRVIEWER_API DegreesMode getDegreesMode()
MRVIEWER_API void setShowLeadingZero(bool show)
MRVIEWER_API std::optional< LengthUnit > getUiLengthUnit()
MRVIEWER_API void setUiLengthPrecision(int precision)
void setThousandsSeparator(char ch)
MRVIEWER_API bool getShowLeadingZero()
MRVIEWER_API void setUiLengthUnit(std::optional< LengthUnit > unit, bool setPreferredLeadingZero)
MRVIEWER_API void resetToDefaults()
MRVIEWER_API int getUiAnglePrecision()
MRVIEWER_API int getUiLengthPrecision()
DegreesMode
Definition MRUnits.h:249