Make some dubious type conversions explicit.
This is to address MSVC warnings. This commit changes a few configuration fields to use double instead of float. There doesn't seem to be any reason these use float except for the legacy Windows code using float for saved configuration. Changing their type to double improves consistency.pull/339/head
parent
c1f1c7c409
commit
7630e0e4e2
|
@ -909,7 +909,7 @@ bool GraphicsWindow::MouseEvent(Platform::MouseEvent event) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MouseEvent::Type::SCROLL_VERT:
|
case MouseEvent::Type::SCROLL_VERT:
|
||||||
this->MouseScroll(event.x, event.y, event.scrollDelta);
|
this->MouseScroll(event.x, event.y, (int)event.scrollDelta);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MouseEvent::Type::LEAVE:
|
case MouseEvent::Type::LEAVE:
|
||||||
|
|
|
@ -58,7 +58,7 @@ void Settings::FreezeBool(const std::string &key, bool value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Settings::ThawBool(const std::string &key, bool defaultValue) {
|
bool Settings::ThawBool(const std::string &key, bool defaultValue) {
|
||||||
return (bool)ThawInt(key, (int)defaultValue);
|
return ThawInt(key, (int)defaultValue) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::FreezeColor(const std::string &key, RgbaColor value) {
|
void Settings::FreezeColor(const std::string &key, RgbaColor value) {
|
||||||
|
|
|
@ -1138,7 +1138,7 @@ public:
|
||||||
settings->FreezeInt(key + "_Right", rc.right);
|
settings->FreezeInt(key + "_Right", rc.right);
|
||||||
settings->FreezeInt(key + "_Top", rc.top);
|
settings->FreezeInt(key + "_Top", rc.top);
|
||||||
settings->FreezeInt(key + "_Bottom", rc.bottom);
|
settings->FreezeInt(key + "_Bottom", rc.bottom);
|
||||||
settings->FreezeBool(key + "_Maximized", isMaximized);
|
settings->FreezeBool(key + "_Maximized", isMaximized == TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThawPosition(SettingsRef settings, const std::string &key) override {
|
void ThawPosition(SettingsRef settings, const std::string &key) override {
|
||||||
|
@ -1555,9 +1555,9 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isSaveDialog) {
|
if(isSaveDialog) {
|
||||||
return GetSaveFileNameW(&ofn);
|
return GetSaveFileNameW(&ofn) == TRUE;
|
||||||
} else {
|
} else {
|
||||||
return GetOpenFileNameW(&ofn);
|
return GetOpenFileNameW(&ofn) == TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -31,24 +31,24 @@ void SolveSpaceUI::Init() {
|
||||||
modelColor[6] = settings->ThawColor("ModelColor_6", RGBi( 0, 0, 130));
|
modelColor[6] = settings->ThawColor("ModelColor_6", RGBi( 0, 0, 130));
|
||||||
modelColor[7] = settings->ThawColor("ModelColor_7", RGBi( 80, 0, 80));
|
modelColor[7] = settings->ThawColor("ModelColor_7", RGBi( 80, 0, 80));
|
||||||
// Light intensities
|
// Light intensities
|
||||||
lightIntensity[0] = settings->ThawFloat("LightIntensity_0", 1.0f);
|
lightIntensity[0] = settings->ThawFloat("LightIntensity_0", 1.0);
|
||||||
lightIntensity[1] = settings->ThawFloat("LightIntensity_1", 0.5f);
|
lightIntensity[1] = settings->ThawFloat("LightIntensity_1", 0.5);
|
||||||
ambientIntensity = 0.3; // no setting for that yet
|
ambientIntensity = 0.3; // no setting for that yet
|
||||||
// Light positions
|
// Light positions
|
||||||
lightDir[0].x = settings->ThawFloat("LightDir_0_Right", -1.0f);
|
lightDir[0].x = settings->ThawFloat("LightDir_0_Right", -1.0);
|
||||||
lightDir[0].y = settings->ThawFloat("LightDir_0_Up", 1.0f);
|
lightDir[0].y = settings->ThawFloat("LightDir_0_Up", 1.0);
|
||||||
lightDir[0].z = settings->ThawFloat("LightDir_0_Forward", 0.0f);
|
lightDir[0].z = settings->ThawFloat("LightDir_0_Forward", 0.0);
|
||||||
lightDir[1].x = settings->ThawFloat("LightDir_1_Right", 1.0f);
|
lightDir[1].x = settings->ThawFloat("LightDir_1_Right", 1.0);
|
||||||
lightDir[1].y = settings->ThawFloat("LightDir_1_Up", 0.0f);
|
lightDir[1].y = settings->ThawFloat("LightDir_1_Up", 0.0);
|
||||||
lightDir[1].z = settings->ThawFloat("LightDir_1_Forward", 0.0f);
|
lightDir[1].z = settings->ThawFloat("LightDir_1_Forward", 0.0);
|
||||||
|
|
||||||
exportMode = false;
|
exportMode = false;
|
||||||
// Chord tolerance
|
// Chord tolerance
|
||||||
chordTol = settings->ThawFloat("ChordTolerancePct", 0.5f);
|
chordTol = settings->ThawFloat("ChordTolerancePct", 0.5);
|
||||||
// Max pwl segments to generate
|
// Max pwl segments to generate
|
||||||
maxSegments = settings->ThawInt("MaxSegments", 10);
|
maxSegments = settings->ThawInt("MaxSegments", 10);
|
||||||
// Chord tolerance
|
// Chord tolerance
|
||||||
exportChordTol = settings->ThawFloat("ExportChordTolerance", 0.1f);
|
exportChordTol = settings->ThawFloat("ExportChordTolerance", 0.1);
|
||||||
// Max pwl segments to generate
|
// Max pwl segments to generate
|
||||||
exportMaxSegments = settings->ThawInt("ExportMaxSegments", 64);
|
exportMaxSegments = settings->ThawInt("ExportMaxSegments", 64);
|
||||||
// View units
|
// View units
|
||||||
|
@ -57,13 +57,13 @@ void SolveSpaceUI::Init() {
|
||||||
afterDecimalMm = settings->ThawInt("AfterDecimalMm", 2);
|
afterDecimalMm = settings->ThawInt("AfterDecimalMm", 2);
|
||||||
afterDecimalInch = settings->ThawInt("AfterDecimalInch", 3);
|
afterDecimalInch = settings->ThawInt("AfterDecimalInch", 3);
|
||||||
// Camera tangent (determines perspective)
|
// Camera tangent (determines perspective)
|
||||||
cameraTangent = settings->ThawFloat("CameraTangent", 0.3f/1e3f);
|
cameraTangent = settings->ThawFloat("CameraTangent", 0.3f/1e3);
|
||||||
// Grid spacing
|
// Grid spacing
|
||||||
gridSpacing = settings->ThawFloat("GridSpacing", 5.0f);
|
gridSpacing = settings->ThawFloat("GridSpacing", 5.0);
|
||||||
// Export scale factor
|
// Export scale factor
|
||||||
exportScale = settings->ThawFloat("ExportScale", 1.0f);
|
exportScale = settings->ThawFloat("ExportScale", 1.0);
|
||||||
// Export offset (cutter radius comp)
|
// Export offset (cutter radius comp)
|
||||||
exportOffset = settings->ThawFloat("ExportOffset", 0.0f);
|
exportOffset = settings->ThawFloat("ExportOffset", 0.0);
|
||||||
// Rewrite exported colors close to white into black (assuming white bg)
|
// Rewrite exported colors close to white into black (assuming white bg)
|
||||||
fixExportColors = settings->ThawBool("FixExportColors", true);
|
fixExportColors = settings->ThawBool("FixExportColors", true);
|
||||||
// Draw back faces of triangles (when mesh is leaky/self-intersecting)
|
// Draw back faces of triangles (when mesh is leaky/self-intersecting)
|
||||||
|
@ -81,20 +81,20 @@ void SolveSpaceUI::Init() {
|
||||||
// Whether export canvas size is fixed or derived from bbox
|
// Whether export canvas size is fixed or derived from bbox
|
||||||
exportCanvasSizeAuto = settings->ThawBool("ExportCanvasSizeAuto", true);
|
exportCanvasSizeAuto = settings->ThawBool("ExportCanvasSizeAuto", true);
|
||||||
// Margins for automatic canvas size
|
// Margins for automatic canvas size
|
||||||
exportMargin.left = settings->ThawFloat("ExportMargin_Left", 5.0f);
|
exportMargin.left = settings->ThawFloat("ExportMargin_Left", 5.0);
|
||||||
exportMargin.right = settings->ThawFloat("ExportMargin_Right", 5.0f);
|
exportMargin.right = settings->ThawFloat("ExportMargin_Right", 5.0);
|
||||||
exportMargin.bottom = settings->ThawFloat("ExportMargin_Bottom", 5.0f);
|
exportMargin.bottom = settings->ThawFloat("ExportMargin_Bottom", 5.0);
|
||||||
exportMargin.top = settings->ThawFloat("ExportMargin_Top", 5.0f);
|
exportMargin.top = settings->ThawFloat("ExportMargin_Top", 5.0);
|
||||||
// Dimensions for fixed canvas size
|
// Dimensions for fixed canvas size
|
||||||
exportCanvas.width = settings->ThawFloat("ExportCanvas_Width", 100.0f);
|
exportCanvas.width = settings->ThawFloat("ExportCanvas_Width", 100.0);
|
||||||
exportCanvas.height = settings->ThawFloat("ExportCanvas_Height", 100.0f);
|
exportCanvas.height = settings->ThawFloat("ExportCanvas_Height", 100.0);
|
||||||
exportCanvas.dx = settings->ThawFloat("ExportCanvas_Dx", 5.0f);
|
exportCanvas.dx = settings->ThawFloat("ExportCanvas_Dx", 5.0);
|
||||||
exportCanvas.dy = settings->ThawFloat("ExportCanvas_Dy", 5.0f);
|
exportCanvas.dy = settings->ThawFloat("ExportCanvas_Dy", 5.0);
|
||||||
// Extra parameters when exporting G code
|
// Extra parameters when exporting G code
|
||||||
gCode.depth = settings->ThawFloat("GCode_Depth", 10.0f);
|
gCode.depth = settings->ThawFloat("GCode_Depth", 10.0);
|
||||||
gCode.passes = settings->ThawInt("GCode_Passes", 1);
|
gCode.passes = settings->ThawInt("GCode_Passes", 1);
|
||||||
gCode.feed = settings->ThawFloat("GCode_Feed", 10.0f);
|
gCode.feed = settings->ThawFloat("GCode_Feed", 10.0);
|
||||||
gCode.plungeFeed = settings->ThawFloat("GCode_PlungeFeed", 10.0f);
|
gCode.plungeFeed = settings->ThawFloat("GCode_PlungeFeed", 10.0);
|
||||||
// Show toolbar in the graphics window
|
// Show toolbar in the graphics window
|
||||||
showToolbar = settings->ThawBool("ShowToolbar", true);
|
showToolbar = settings->ThawBool("ShowToolbar", true);
|
||||||
// Recent files menus
|
// Recent files menus
|
||||||
|
|
|
@ -586,9 +586,9 @@ public:
|
||||||
double exportChordTol;
|
double exportChordTol;
|
||||||
int exportMaxSegments;
|
int exportMaxSegments;
|
||||||
double cameraTangent;
|
double cameraTangent;
|
||||||
float gridSpacing;
|
double gridSpacing;
|
||||||
float exportScale;
|
double exportScale;
|
||||||
float exportOffset;
|
double exportOffset;
|
||||||
bool fixExportColors;
|
bool fixExportColors;
|
||||||
bool drawBackFaces;
|
bool drawBackFaces;
|
||||||
bool showContourAreas;
|
bool showContourAreas;
|
||||||
|
@ -601,22 +601,22 @@ public:
|
||||||
bool exportCanvasSizeAuto;
|
bool exportCanvasSizeAuto;
|
||||||
bool exportMode;
|
bool exportMode;
|
||||||
struct {
|
struct {
|
||||||
float left;
|
double left;
|
||||||
float right;
|
double right;
|
||||||
float bottom;
|
double bottom;
|
||||||
float top;
|
double top;
|
||||||
} exportMargin;
|
} exportMargin;
|
||||||
struct {
|
struct {
|
||||||
float width;
|
double width;
|
||||||
float height;
|
double height;
|
||||||
float dx;
|
double dx;
|
||||||
float dy;
|
double dy;
|
||||||
} exportCanvas;
|
} exportCanvas;
|
||||||
struct {
|
struct {
|
||||||
float depth;
|
double depth;
|
||||||
int passes;
|
int passes;
|
||||||
float feed;
|
double feed;
|
||||||
float plungeFeed;
|
double plungeFeed;
|
||||||
} gCode;
|
} gCode;
|
||||||
|
|
||||||
Unit viewUnits;
|
Unit viewUnits;
|
||||||
|
|
Loading…
Reference in New Issue