From 37bb85d16f7edad800d250a0aa976686f3d24ad7 Mon Sep 17 00:00:00 2001 From: nds Date: Thu, 28 Jul 2016 09:09:06 +0300 Subject: [PATCH] Issue #1657 In the Sketcher, disable all coordinate and lenght inputs : rename "Sketch plane" preference tab into "Sketch" --- src/Config/Config_Prop.h | 2 ++ src/Config/Config_PropManager.cpp | 4 ++-- src/ConstructionPlugin/ConstructionPlugin_Plane.cpp | 2 +- src/ModuleBase/ModuleBase_ModelWidget.cpp | 2 +- src/PartSet/PartSet_Module.cpp | 8 ++++---- src/PartSet/PartSet_PreviewPlanes.cpp | 4 ++-- src/PartSet/PartSet_WidgetSketchLabel.cpp | 2 +- 7 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/Config/Config_Prop.h b/src/Config/Config_Prop.h index b24e42278..aba70bf7b 100644 --- a/src/Config/Config_Prop.h +++ b/src/Config/Config_Prop.h @@ -12,6 +12,8 @@ #include #include +const static char* SKETCH_TAB_NAME = "Sketch"; + /*! * \class Config_Prop * \brief Class which describes a one property diff --git a/src/Config/Config_PropManager.cpp b/src/Config/Config_PropManager.cpp index ad5ceca9b..c6e71b88e 100644 --- a/src/Config/Config_PropManager.cpp +++ b/src/Config/Config_PropManager.cpp @@ -151,7 +151,7 @@ std::vector stringToRGB(const std::string& theColor) aBuf[1] = theColor[6]; aRes[2] = strtol(aBuf, &aP, 16); } else { - int aPos = theColor.find(","); + int aPos = (int)theColor.find(","); char aBuf[10]; // Get Red std::size_t length = theColor.copy(aBuf, aPos, 0); @@ -159,7 +159,7 @@ std::vector stringToRGB(const std::string& theColor) aRes[0] = atoi(aBuf); // Get Green - int aNPos = theColor.find(",", aPos + 1); + int aNPos = (int)theColor.find(",", aPos + 1); length = theColor.copy(aBuf, aNPos - aPos - 1, aPos + 1); aBuf[length] = '\0'; aRes[1] = atoi(aBuf); diff --git a/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp b/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp index 68f3e5b0a..316878723 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp @@ -158,7 +158,7 @@ std::shared_ptr ConstructionPlugin_Plane::createByGeneralEquation std::shared_ptr aPlane = std::shared_ptr(new GeomAPI_Pln(aA, aB, aC, aD)); std::string kDefaultPlaneSize = "200"; - double aSize = Config_PropManager::integer("Sketch planes", "planes_size", kDefaultPlaneSize); + double aSize = Config_PropManager::integer(SKETCH_TAB_NAME, "planes_size", kDefaultPlaneSize); aSize *= 4.; aPlaneFace = GeomAlgoAPI_FaceBuilder::squareFace(aPlane, aSize); } diff --git a/src/ModuleBase/ModuleBase_ModelWidget.cpp b/src/ModuleBase/ModuleBase_ModelWidget.cpp index 77d58959b..713adea89 100644 --- a/src/ModuleBase/ModuleBase_ModelWidget.cpp +++ b/src/ModuleBase/ModuleBase_ModelWidget.cpp @@ -90,7 +90,7 @@ bool ModuleBase_ModelWidget::isValueEnabled() const { bool anEnabled = true; if (myIsValueEnabled == DefinedInPreferences) { - bool aCanDisable = Config_PropManager::boolean("Sketch planes", "disable_input_fields", "true"); + bool aCanDisable = Config_PropManager::boolean(SKETCH_TAB_NAME, "disable_input_fields", "true"); if (aCanDisable) anEnabled = false; } diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 120d4d6ac..8c818d861 100755 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -166,7 +166,7 @@ PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop) PartSet_CustomPrs::OPERATION_HIGHLIGHT_COLOR()); - Config_PropManager::registerProp("Sketch planes", "disable_input_fields", "Disable input fields", + Config_PropManager::registerProp(SKETCH_TAB_NAME, "disable_input_fields", "Disable input fields", Config_Prop::Boolean, "true"); } @@ -244,11 +244,11 @@ void PartSet_Module::registerFilters() void PartSet_Module::registerProperties() { - Config_PropManager::registerProp("Sketch planes", "planes_size", "Size", Config_Prop::Double, + Config_PropManager::registerProp(SKETCH_TAB_NAME, "planes_size", "Size", Config_Prop::Double, PLANE_SIZE); - Config_PropManager::registerProp("Sketch planes", "planes_thickness", "Thickness", + Config_PropManager::registerProp(SKETCH_TAB_NAME, "planes_thickness", "Thickness", Config_Prop::Integer, SKETCH_WIDTH); - Config_PropManager::registerProp("Sketch planes", "rotate_to_plane", "Rotate to plane when selected", + Config_PropManager::registerProp(SKETCH_TAB_NAME, "rotate_to_plane", "Rotate to plane when selected", Config_Prop::Boolean, "false"); } diff --git a/src/PartSet/PartSet_PreviewPlanes.cpp b/src/PartSet/PartSet_PreviewPlanes.cpp index 53e4cebfd..4e362145d 100755 --- a/src/PartSet/PartSet_PreviewPlanes.cpp +++ b/src/PartSet/PartSet_PreviewPlanes.cpp @@ -123,11 +123,11 @@ AISObjectPtr PartSet_PreviewPlanes::createPreviewPlane(std::shared_ptr theNorm, const int theRGB[3]) { - double aSize = Config_PropManager::integer("Sketch planes", "planes_size", PLANE_SIZE); + double aSize = Config_PropManager::integer(SKETCH_TAB_NAME, "planes_size", PLANE_SIZE); std::shared_ptr aFace = GeomAlgoAPI_FaceBuilder::squareFace(theOrigin, theNorm, aSize); AISObjectPtr aAIS = AISObjectPtr(new GeomAPI_AISObject()); aAIS->createShape(aFace); - aAIS->setWidth(Config_PropManager::integer("Sketch planes", "planes_thickness", SKETCH_WIDTH)); + aAIS->setWidth(Config_PropManager::integer(SKETCH_TAB_NAME, "planes_thickness", SKETCH_WIDTH)); aAIS->setColor(theRGB[0], theRGB[1], theRGB[2]); return aAIS; } diff --git a/src/PartSet/PartSet_WidgetSketchLabel.cpp b/src/PartSet/PartSet_WidgetSketchLabel.cpp index c09625924..9a94798aa 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.cpp +++ b/src/PartSet/PartSet_WidgetSketchLabel.cpp @@ -270,7 +270,7 @@ void PartSet_WidgetSketchLabel::updateByPlaneSelected(const ModuleBase_ViewerPrs // Rotate view if the sketcher plane is selected only from preview planes // Preview planes are created only if there is no any shape - bool aRotate = Config_PropManager::boolean("Sketch planes", "rotate_to_plane", "false"); + bool aRotate = Config_PropManager::boolean(SKETCH_TAB_NAME, "rotate_to_plane", "false"); if (aRotate) { myWorkshop->viewer()->setViewProjection(aXYZ.X(), aXYZ.Y(), aXYZ.Z(), aTwist); PartSet_Module* aModule = dynamic_cast(myWorkshop->module()); -- 2.39.2