diff --git a/src/Mod/Path/Gui/DlgSettingsPathColor.cpp b/src/Mod/Path/Gui/DlgSettingsPathColor.cpp index f644bf056c..64bcdd02de 100644 --- a/src/Mod/Path/Gui/DlgSettingsPathColor.cpp +++ b/src/Mod/Path/Gui/DlgSettingsPathColor.cpp @@ -27,6 +27,7 @@ #include "DlgSettingsPathColor.h" #include +#include using namespace PathGui; @@ -60,6 +61,9 @@ void DlgSettingsPathColor::saveSettings() DefaultExtentsColor->onSave(); DefaultProbePathColor->onSave(); DefaultHighlightPathColor->onSave(); + DefaultBBoxSelectionColor->onSave(); + DefaultBBoxNormalColor->onSave(); + DefaultSelectionStyle->onSave(); } void DlgSettingsPathColor::loadSettings() @@ -72,6 +76,9 @@ void DlgSettingsPathColor::loadSettings() DefaultExtentsColor->onRestore(); DefaultProbePathColor->onRestore(); DefaultHighlightPathColor->onRestore(); + DefaultBBoxSelectionColor->onRestore(); + DefaultBBoxNormalColor->onRestore(); + DefaultSelectionStyle->onRestore(); } /** diff --git a/src/Mod/Path/Gui/DlgSettingsPathColor.ui b/src/Mod/Path/Gui/DlgSettingsPathColor.ui index fa7df4cd09..49ed19f0ab 100644 --- a/src/Mod/Path/Gui/DlgSettingsPathColor.ui +++ b/src/Mod/Path/Gui/DlgSettingsPathColor.ui @@ -6,22 +6,25 @@ 0 0 - 310 - 304 + 357 + 372 Path colors + + QFormLayout::AllNonFixedFieldsGrow + Default Path colors - - + + 182 @@ -29,7 +32,27 @@ - Default normal path color + Default path marker color + + + + + + + The default line color for new shapes + + + + 255 + 255 + 255 + + + + DefaultBBoxNormalColor + + + Mod/Path @@ -53,54 +76,6 @@ - - - - - 182 - 0 - - - - Default pathline width - - - - - - - The default line thickness for new shapes - - - px - - - 9 - - - 1 - - - DefaultPathLineWidth - - - Mod/Path - - - - - - - - 182 - 0 - - - - Default path marker color - - - @@ -134,6 +109,54 @@ + + + + The default line thickness for new shapes + + + px + + + 9 + + + 1 + + + DefaultPathLineWidth + + + Mod/Path + + + + + + + + 182 + 0 + + + + Default pathline width + + + + + + + + 182 + 0 + + + + Default normal path color + + + @@ -237,6 +260,52 @@ + + + + + 182 + 0 + + + + Bounding Box Normal Color + + + + + + + + 182 + 0 + + + + Bounding Box Selection Color + + + + + + + The default line color for new shapes + + + + 200 + 255 + 255 + + + + DefaultBBoxSelectionColor + + + Mod/Path + + + label_6 DefaultNormalPathColor @@ -252,21 +321,12 @@ DefaultProbePathColor label_11 DefaultHighlightPathColor + label_13 + DefaultBBoxNormalColor + label_14 + DefaultBBoxSelectionColor - - - - Qt::Vertical - - - - 20 - 217 - - - - @@ -280,6 +340,78 @@ + + + + + 0 + 0 + + + + UI Settings + + + + QFormLayout::AllNonFixedFieldsGrow + + + + + Path Selection Style + + + + + + + + 0 + 0 + + + + Default path shape selection behavior in 3D viewer + + + DefaultSelectionStyle + + + Mod/Path + + + + Shape + + + + + Bounding Box + + + + + None + + + + + + + + + + + Qt::Vertical + + + + 20 + 217 + + + + @@ -298,6 +430,11 @@ Gui::ColorButton
Gui/PrefWidgets.h
+ + Gui::PrefComboBox + QComboBox +
Gui/PrefWidgets.h
+
DefaultNormalPathColor diff --git a/src/Mod/Path/Gui/ViewProviderPath.cpp b/src/Mod/Path/Gui/ViewProviderPath.cpp index 4e657c3615..de41561641 100644 --- a/src/Mod/Path/Gui/ViewProviderPath.cpp +++ b/src/Mod/Path/Gui/ViewProviderPath.cpp @@ -167,7 +167,11 @@ ViewProviderPath::ViewProviderPath() MarkerColor.touch(); DisplayMode.setStatus(App::Property::Status::Hidden, true); - SelectionStyle.setValue(1); + + static const char *SelectionStyleEnum[] = {"Shape","BoundBox","None",0}; + SelectionStyle.setEnums(SelectionStyleEnum); + unsigned long sstyle = hGrp->GetInt("DefaultSelectionStyle",0); + SelectionStyle.setValue(sstyle); } ViewProviderPath::~ViewProviderPath() @@ -186,7 +190,7 @@ ViewProviderPath::~ViewProviderPath() void ViewProviderPath::attach(App::DocumentObject *pcObj) { - ViewProviderGeometryObject::attach(pcObj); + inherited::attach(pcObj); // Draw trajectory lines SoSeparator* linesep = new SoSeparator; @@ -213,11 +217,15 @@ void ViewProviderPath::attach(App::DocumentObject *pcObj) addDisplayMaskMode(pcPathRoot, "Waypoints"); } +bool ViewProviderPath::useNewSelectionModel(void) const { + return SelectionStyle.getValue()!=2; +} + void ViewProviderPath::setDisplayMode(const char* ModeName) { if ( strcmp("Waypoints",ModeName)==0 ) setDisplayMaskMode("Waypoints"); - ViewProviderGeometryObject::setDisplayMode( ModeName ); + inherited::setDisplayMode( ModeName ); } std::vector ViewProviderPath::getDisplayModes(void) const @@ -348,10 +356,28 @@ void ViewProviderPath::onChanged(const App::Property* prop) pcMarkerCoords->point.set1Value(0,pt.x,pt.y,pt.z); } } else { - ViewProviderGeometryObject::onChanged(prop); + inherited::onChanged(prop); + if(prop == &SelectionStyle && SelectionStyle.getValue()==2) + hideSelection(); } } +void ViewProviderPath::showBoundingBox(bool show) { + if(show) { + if(!pcLineCoords->point.getNum()) + return; + } + inherited::showBoundingBox(show); +} + +unsigned long ViewProviderPath::getBoundColor() const { + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Path"); + if(SelectionStyle.getValue() == 0 || !Selectable.getValue()) + return hGrp->GetUnsigned("DefaultBBoxNormalColor",4294967295UL); // white (255,255,255) + else + return hGrp->GetUnsigned("DefaultBBoxSelectionColor",0xc8ffff00UL); // rgb(0,85,255) +} + void ViewProviderPath::updateShowConstraints() { Path::Feature* pcPathObj = static_cast(pcObject); const Toolpath &tp = pcPathObj->Path.getValue(); @@ -378,11 +404,10 @@ void ViewProviderPath::updateData(const App::Property* prop) updateVisual(true); return; } - ViewProviderGeometryObject::updateData(prop); + inherited::updateData(prop); } -void ViewProviderPath::updateVisual(bool rebuild) { - +void ViewProviderPath::hideSelection() { // Clear selection SoSelectionElementAction saction(Gui::SoSelectionElementAction::None); saction.apply(pcLines); @@ -393,6 +418,11 @@ void ViewProviderPath::updateVisual(bool rebuild) { // Hide arrow pcArrowSwitch->whichChild = -1; +} + +void ViewProviderPath::updateVisual(bool rebuild) { + + hideSelection(); updateShowConstraints(); diff --git a/src/Mod/Path/Gui/ViewProviderPath.h b/src/Mod/Path/Gui/ViewProviderPath.h index 5fe4926577..291b2ccd8b 100644 --- a/src/Mod/Path/Gui/ViewProviderPath.h +++ b/src/Mod/Path/Gui/ViewProviderPath.h @@ -46,6 +46,7 @@ class PathGuiExport ViewProviderPath : public Gui::ViewProviderGeometryObject , public Gui::SelectionObserver { PROPERTY_HEADER(PathGui::ViewProviderPath); + typedef ViewProviderGeometryObject inherited; public: /// constructor. @@ -74,7 +75,7 @@ public: void recomputeBoundingBox(); virtual QIcon getIcon() const; - virtual bool useNewSelectionModel(void) const {return true;} + virtual bool useNewSelectionModel(void) const; virtual std::string getElement(const SoDetail *) const; SoDetail* getDetail(const char* subelement) const; @@ -82,10 +83,14 @@ public: void updateShowConstraints(); void updateVisual(bool rebuild = false); + void hideSelection(); + + virtual void showBoundingBox(bool show); protected: virtual void onChanged(const App::Property* prop); + virtual unsigned long getBoundColor() const; SoCoordinate3 * pcLineCoords; SoCoordinate3 * pcMarkerCoords;