Add preference settings
- autodistribute, vertex size, vertex color
This commit is contained in:
committed by
Yorik van Havre
parent
8e2586ccc7
commit
ecb29f1dbf
@@ -29,14 +29,15 @@
|
||||
#include <cmath>
|
||||
#endif
|
||||
|
||||
#include <App/Application.h>
|
||||
#include <App/Document.h>
|
||||
#include <App/DocumentObject.h>
|
||||
|
||||
#include <Base/BoundBox.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Exception.h>
|
||||
|
||||
#include <Base/Matrix.h>
|
||||
#include <Base/Parameter.h>
|
||||
|
||||
#include "Cube.h"
|
||||
#include "DrawUtil.h"
|
||||
@@ -62,6 +63,10 @@ DrawProjGroup::DrawProjGroup(void)
|
||||
static const char *group = "Base";
|
||||
static const char *agroup = "Distribute";
|
||||
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
|
||||
GetGroup("Preferences")->GetGroup("Mod/TechDraw/General");
|
||||
bool autoDist = hGrp->GetBool("AutoDist",true);
|
||||
|
||||
|
||||
ADD_PROPERTY_TYPE(Source ,(0), group, App::Prop_None,"Shape to view");
|
||||
Source.setScope(App::LinkScope::Global);
|
||||
@@ -69,7 +74,7 @@ DrawProjGroup::DrawProjGroup(void)
|
||||
ProjectionType.setEnums(ProjectionTypeEnums);
|
||||
ADD_PROPERTY(ProjectionType, ((long)0));
|
||||
|
||||
ADD_PROPERTY_TYPE(AutoDistribute ,(true),agroup,App::Prop_None,"Distribute Views Automatically or Manually");
|
||||
ADD_PROPERTY_TYPE(AutoDistribute ,(autoDist),agroup,App::Prop_None,"Distribute Views Automatically or Manually");
|
||||
ADD_PROPERTY_TYPE(spacingX, (15), agroup, App::Prop_None, "Horizontal spacing between views");
|
||||
ADD_PROPERTY_TYPE(spacingY, (15), agroup, App::Prop_None, "Vertical spacing between views");
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>558</width>
|
||||
<height>845</height>
|
||||
<height>883</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -159,6 +159,25 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="Gui::PrefCheckBox" name="cb_AutoDist">
|
||||
<property name="toolTip">
|
||||
<string>Automatically distribute secondary views.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>AutoDistribute Secondary Views</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>AutoDist</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>/Mod/TechDraw/General</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>521</width>
|
||||
<height>640</height>
|
||||
<height>716</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -274,6 +274,46 @@
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_2" columnstretch="1,0,0">
|
||||
<item row="3" column="2">
|
||||
<widget class="Gui::PrefColorButton" name="colCenterLine">
|
||||
<property name="color">
|
||||
<color>
|
||||
<red>175</red>
|
||||
<green>175</green>
|
||||
<blue>175</blue>
|
||||
</color>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>CenterColor</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>/Mod/TechDraw/Decorations</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="Gui::PrefDoubleSpinBox" name="pdsb_VertexScale">
|
||||
<property name="toolTip">
|
||||
<string>Adjusts size of vertices in drawing</string>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>3.000000000000000</double>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>VertexScale</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/TechDraw/General</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Vertex Scale</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="Gui::PrefComboBox" name="pcbMatting">
|
||||
<property name="prefEntry" stdset="0">
|
||||
@@ -315,23 +355,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="Gui::PrefColorButton" name="colCenterLine">
|
||||
<property name="color">
|
||||
<color>
|
||||
<red>175</red>
|
||||
<green>175</green>
|
||||
<blue>175</blue>
|
||||
</color>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>CenterColor</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>/Mod/TechDraw/Decorations</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="Gui::PrefComboBox" name="pcbCenterStyle">
|
||||
<property name="currentIndex">
|
||||
@@ -465,7 +488,7 @@
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>Line Group</string>
|
||||
<string>Line Group Name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -482,6 +505,30 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string>Vertex Color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="2">
|
||||
<widget class="Gui::PrefColorButton" name="pcb_VertexColor">
|
||||
<property name="color">
|
||||
<color>
|
||||
<red>150</red>
|
||||
<green>147</green>
|
||||
<blue>145</blue>
|
||||
</color>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>VertexColor</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>/Mod/TechDraw/Decorations</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
@@ -538,6 +585,11 @@
|
||||
<extends>QLineEdit</extends>
|
||||
<header>Gui/PrefWidgets.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>Gui::PrefDoubleSpinBox</class>
|
||||
<extends>QDoubleSpinBox</extends>
|
||||
<header>Gui/PrefWidgets.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>Gui::PrefUnitSpinBox</class>
|
||||
<extends>Gui::QuantitySpinBox</extends>
|
||||
|
||||
@@ -59,6 +59,8 @@ void DlgPrefsTechDraw2Imp::saveSettings()
|
||||
sbAltDecimals->onSave();
|
||||
plsb_ArrowSize->onSave();
|
||||
leLineGroup->onSave();
|
||||
pdsb_VertexScale->onSave();
|
||||
pcb_VertexColor->onSave();
|
||||
}
|
||||
|
||||
void DlgPrefsTechDraw2Imp::loadSettings()
|
||||
@@ -77,6 +79,8 @@ void DlgPrefsTechDraw2Imp::loadSettings()
|
||||
sbAltDecimals->onRestore();
|
||||
plsb_ArrowSize->onRestore();
|
||||
leLineGroup->onRestore();
|
||||
pdsb_VertexScale->onRestore();
|
||||
pcb_VertexColor->onRestore();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -50,6 +50,7 @@ void DlgPrefsTechDrawImp::saveSettings()
|
||||
cb_Faces->onSave();
|
||||
cb_SectionEdges->onSave();
|
||||
cb_PageUpdate->onSave();
|
||||
cb_AutoDist->onSave();
|
||||
|
||||
pcb_Normal->onSave();
|
||||
pcb_Select->onSave();
|
||||
@@ -78,6 +79,7 @@ void DlgPrefsTechDrawImp::loadSettings()
|
||||
cb_Faces->onRestore();
|
||||
cb_SectionEdges->onRestore();
|
||||
cb_PageUpdate->onRestore();
|
||||
cb_AutoDist->onRestore();
|
||||
|
||||
pcb_Normal->onRestore();
|
||||
pcb_Select->onRestore();
|
||||
|
||||
@@ -52,6 +52,8 @@ QGIPrimPath::QGIPrimPath():
|
||||
|
||||
isHighlighted = false;
|
||||
|
||||
m_colNormal = Qt::white;
|
||||
m_colOverride = false;
|
||||
m_colCurrent = getNormalColor();
|
||||
m_styleCurrent = Qt::SolidLine;
|
||||
m_pen.setStyle(m_styleCurrent);
|
||||
@@ -130,8 +132,15 @@ void QGIPrimPath::paint ( QPainter * painter, const QStyleOptionGraphicsItem * o
|
||||
|
||||
QColor QGIPrimPath::getNormalColor()
|
||||
{
|
||||
|
||||
QColor result;
|
||||
QGIView *parent;
|
||||
|
||||
if (m_colOverride) {
|
||||
result = m_colNormal;
|
||||
return result;
|
||||
}
|
||||
|
||||
QGraphicsItem* qparent = parentItem();
|
||||
if (qparent == nullptr) {
|
||||
parent = nullptr;
|
||||
@@ -205,6 +214,13 @@ void QGIPrimPath::setStyle(Qt::PenStyle s)
|
||||
m_styleCurrent = s;
|
||||
}
|
||||
|
||||
void QGIPrimPath::setNormalColor(QColor c)
|
||||
{
|
||||
m_colNormal = c;
|
||||
m_colOverride = true;
|
||||
}
|
||||
|
||||
|
||||
Base::Reference<ParameterGrp> QGIPrimPath::getParmGroup()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
|
||||
@@ -55,6 +55,7 @@ public:
|
||||
virtual double getWidth() { return m_width;}
|
||||
Qt::PenStyle getStyle() { return m_styleCurrent; }
|
||||
void setStyle(Qt::PenStyle s);
|
||||
virtual void setNormalColor(QColor c);
|
||||
|
||||
protected:
|
||||
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
|
||||
@@ -69,6 +70,8 @@ protected:
|
||||
bool isHighlighted;
|
||||
QPen m_pen;
|
||||
QColor m_colCurrent;
|
||||
QColor m_colNormal;
|
||||
bool m_colOverride;
|
||||
Qt::PenStyle m_styleCurrent;
|
||||
double m_width;
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include <App/DocumentObject.h>
|
||||
#include <App/Material.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Parameter.h>
|
||||
#include <Base/Vector3D.h>
|
||||
#include <Gui/ViewProvider.h>
|
||||
|
||||
@@ -458,6 +459,11 @@ void QGIViewPart::drawViewPart()
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
|
||||
GetGroup("Preferences")->GetGroup("Mod/TechDraw/General");
|
||||
double vertexScaleFactor = hGrp->GetFloat("VertexScale", 3.0);
|
||||
hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
|
||||
GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations");
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("VertexColor", 0x00FF0000));
|
||||
QColor vertexColor = fcColor.asValue<QColor>();
|
||||
|
||||
bool usePolygonHLR = viewPart->CoarseView.getValue();
|
||||
const std::vector<TechDrawGeometry::Vertex *> &verts = viewPart->getVertexGeometry();
|
||||
@@ -476,6 +482,8 @@ void QGIViewPart::drawViewPart()
|
||||
}
|
||||
} else if(!usePolygonHLR){ //Disable dots WHEN usePolygonHLR
|
||||
QGIVertex *item = new QGIVertex(i);
|
||||
item->setNormalColor(vertexColor);
|
||||
item->setPrettyNormal();
|
||||
addToGroup(item);
|
||||
item->setPos(Rez::guiX((*vert)->pnt.x), Rez::guiX((*vert)->pnt.y));
|
||||
item->setRadius(lineWidth * vertexScaleFactor);
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include <QObject>
|
||||
#include <QPainter>
|
||||
|
||||
#include <Base/Parameter.h>
|
||||
#include <Mod/TechDraw/App/Geometry.h>
|
||||
#include "QGIView.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user