PathGui: added selection style preference
This commit is contained in:
committed by
Yorik van Havre
parent
151d8a7b08
commit
38d41f935c
@@ -27,6 +27,7 @@
|
||||
|
||||
#include "DlgSettingsPathColor.h"
|
||||
#include <Gui/PrefWidgets.h>
|
||||
#include <Base/Console.h>
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,22 +6,25 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>310</width>
|
||||
<height>304</height>
|
||||
<width>357</width>
|
||||
<height>372</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Path colors</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBoxDefaultColors">
|
||||
<property name="title">
|
||||
<string>Default Path colors</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>182</width>
|
||||
@@ -29,7 +32,27 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Default normal path color</string>
|
||||
<string>Default path marker color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="Gui::PrefColorButton" name="DefaultBBoxNormalColor">
|
||||
<property name="toolTip">
|
||||
<string>The default line color for new shapes</string>
|
||||
</property>
|
||||
<property name="color" stdset="0">
|
||||
<color>
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>DefaultBBoxNormalColor</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Path</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -53,54 +76,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>182</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Default pathline width</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="Gui::PrefSpinBox" name="DefaultPathLineWidth">
|
||||
<property name="toolTip">
|
||||
<string>The default line thickness for new shapes</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string>px</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>DefaultPathLineWidth</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Path</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>182</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Default path marker color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="Gui::PrefColorButton" name="DefaultPathMarkerColor">
|
||||
<property name="toolTip">
|
||||
@@ -134,6 +109,54 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="Gui::PrefSpinBox" name="DefaultPathLineWidth">
|
||||
<property name="toolTip">
|
||||
<string>The default line thickness for new shapes</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string>px</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>DefaultPathLineWidth</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Path</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>182</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Default pathline width</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>182</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Default normal path color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="Gui::PrefColorButton" name="DefaultRapidPathColor">
|
||||
<property name="toolTip">
|
||||
@@ -237,6 +260,52 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>182</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Bounding Box Normal Color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>182</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Bounding Box Selection Color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="Gui::PrefColorButton" name="DefaultBBoxSelectionColor">
|
||||
<property name="toolTip">
|
||||
<string>The default line color for new shapes</string>
|
||||
</property>
|
||||
<property name="color" stdset="0">
|
||||
<color>
|
||||
<red>200</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>DefaultBBoxSelectionColor</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Path</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<zorder>label_6</zorder>
|
||||
<zorder>DefaultNormalPathColor</zorder>
|
||||
@@ -252,21 +321,12 @@
|
||||
<zorder>DefaultProbePathColor</zorder>
|
||||
<zorder>label_11</zorder>
|
||||
<zorder>DefaultHighlightPathColor</zorder>
|
||||
<zorder>label_13</zorder>
|
||||
<zorder>DefaultBBoxNormalColor</zorder>
|
||||
<zorder>label_14</zorder>
|
||||
<zorder>DefaultBBoxSelectionColor</zorder>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>217</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
@@ -280,6 +340,78 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>UI Settings</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_3">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Path Selection Style</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="Gui::PrefComboBox" name="DefaultSelectionStyle">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Default path shape selection behavior in 3D viewer</string>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>DefaultSelectionStyle</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Path</cstring>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Shape</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Bounding Box</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>217</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
@@ -298,6 +430,11 @@
|
||||
<extends>Gui::ColorButton</extends>
|
||||
<header>Gui/PrefWidgets.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>Gui::PrefComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>Gui/PrefWidgets.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>DefaultNormalPathColor</tabstop>
|
||||
|
||||
@@ -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<std::string> 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<Path::Feature*>(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();
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user