[TD]add light text on dark page mode
- some visually impaired users need white graphics on dark page. - revise Annotation dialog to respect dark style
This commit is contained in:
@@ -23,9 +23,9 @@
|
|||||||
#include "PreCompiled.h"
|
#include "PreCompiled.h"
|
||||||
|
|
||||||
#ifndef _PreComp_
|
#ifndef _PreComp_
|
||||||
# include <iostream>
|
#include <Precision.hxx>
|
||||||
# include <sstream>
|
#include <iostream>
|
||||||
# include <Precision.hxx>
|
#include <sstream>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <App/Application.h>
|
#include <App/Application.h>
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
#include <Base/Parameter.h>
|
#include <Base/Parameter.h>
|
||||||
|
|
||||||
#include "DrawPage.h"
|
#include "DrawPage.h"
|
||||||
#include "DrawPagePy.h" // generated from DrawPagePy.xml
|
#include "DrawPagePy.h"// generated from DrawPagePy.xml
|
||||||
#include "DrawProjGroup.h"
|
#include "DrawProjGroup.h"
|
||||||
#include "DrawTemplate.h"
|
#include "DrawTemplate.h"
|
||||||
#include "DrawView.h"
|
#include "DrawView.h"
|
||||||
@@ -50,49 +50,59 @@ using namespace TechDraw;
|
|||||||
// DrawPage
|
// DrawPage
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
App::PropertyFloatConstraint::Constraints DrawPage::scaleRange = {Precision::Confusion(),
|
App::PropertyFloatConstraint::Constraints DrawPage::scaleRange = {
|
||||||
std::numeric_limits<double>::max(),
|
Precision::Confusion(), std::numeric_limits<double>::max(), (0.1)};// increment by 0.1
|
||||||
(0.1)}; // increment by 0.1
|
|
||||||
|
|
||||||
PROPERTY_SOURCE(TechDraw::DrawPage, App::DocumentObject)
|
PROPERTY_SOURCE(TechDraw::DrawPage, App::DocumentObject)
|
||||||
|
|
||||||
const char* DrawPage::ProjectionTypeEnums[] = { "First Angle",
|
const char* DrawPage::ProjectionTypeEnums[] = {"First Angle", "Third Angle", nullptr};
|
||||||
"Third Angle",
|
|
||||||
nullptr };
|
|
||||||
|
|
||||||
DrawPage::DrawPage(void)
|
DrawPage::DrawPage(void)
|
||||||
{
|
{
|
||||||
static const char *group = "Page";
|
static const char* group = "Page";
|
||||||
nowUnsetting = false;
|
nowUnsetting = false;
|
||||||
forceRedraw(false);
|
forceRedraw(false);
|
||||||
|
|
||||||
ADD_PROPERTY_TYPE(KeepUpdated, (Preferences::keepPagesUpToDate()),
|
ADD_PROPERTY_TYPE(KeepUpdated,
|
||||||
group, (App::PropertyType)(App::Prop_Output), "Keep page in sync with model");
|
(Preferences::keepPagesUpToDate()),
|
||||||
ADD_PROPERTY_TYPE(Template, (nullptr), group, (App::PropertyType)(App::Prop_None), "Attached Template");
|
group,
|
||||||
|
(App::PropertyType)(App::Prop_Output),
|
||||||
|
"Keep page in sync with model");
|
||||||
|
ADD_PROPERTY_TYPE(
|
||||||
|
Template, (nullptr), group, (App::PropertyType)(App::Prop_None), "Attached Template");
|
||||||
Template.setScope(App::LinkScope::Global);
|
Template.setScope(App::LinkScope::Global);
|
||||||
ADD_PROPERTY_TYPE(Views, (nullptr), group, (App::PropertyType)(App::Prop_None), "Attached Views");
|
ADD_PROPERTY_TYPE(
|
||||||
|
Views, (nullptr), group, (App::PropertyType)(App::Prop_None), "Attached Views");
|
||||||
Views.setScope(App::LinkScope::Global);
|
Views.setScope(App::LinkScope::Global);
|
||||||
|
|
||||||
// Projection Properties
|
// Projection Properties
|
||||||
ProjectionType.setEnums(ProjectionTypeEnums);
|
ProjectionType.setEnums(ProjectionTypeEnums);
|
||||||
ADD_PROPERTY(ProjectionType, ((long)Preferences::projectionAngle()));
|
ADD_PROPERTY(ProjectionType, ((long)Preferences::projectionAngle()));
|
||||||
|
|
||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
.GetUserParameter()
|
||||||
GetGroup("Mod/TechDraw/General");
|
.GetGroup("BaseApp")
|
||||||
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/General");
|
||||||
double defScale = hGrp->GetFloat("DefaultScale", 1.0);
|
double defScale = hGrp->GetFloat("DefaultScale", 1.0);
|
||||||
ADD_PROPERTY_TYPE(Scale, (defScale), group, (App::PropertyType)(App::Prop_None), "Scale factor for this Page");
|
ADD_PROPERTY_TYPE(Scale,
|
||||||
|
(defScale),
|
||||||
|
group,
|
||||||
|
(App::PropertyType)(App::Prop_None),
|
||||||
|
"Scale factor for this Page");
|
||||||
|
|
||||||
ADD_PROPERTY_TYPE(NextBalloonIndex, (1), group, (App::PropertyType)(App::Prop_None),
|
ADD_PROPERTY_TYPE(NextBalloonIndex,
|
||||||
"Auto-numbering for Balloons");
|
(1),
|
||||||
|
group,
|
||||||
|
(App::PropertyType)(App::Prop_None),
|
||||||
|
"Auto-numbering for Balloons");
|
||||||
|
|
||||||
Scale.setConstraints(&scaleRange);
|
Scale.setConstraints(&scaleRange);
|
||||||
balloonParent = nullptr;
|
balloonParent = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawPage::~DrawPage()
|
DrawPage::~DrawPage()
|
||||||
{
|
{}
|
||||||
}
|
|
||||||
|
|
||||||
void DrawPage::onBeforeChange(const App::Property* prop)
|
void DrawPage::onBeforeChange(const App::Property* prop)
|
||||||
{
|
{
|
||||||
@@ -101,53 +111,56 @@ void DrawPage::onBeforeChange(const App::Property* prop)
|
|||||||
|
|
||||||
void DrawPage::onChanged(const App::Property* prop)
|
void DrawPage::onChanged(const App::Property* prop)
|
||||||
{
|
{
|
||||||
if ((prop == &KeepUpdated) &&
|
if ((prop == &KeepUpdated) && KeepUpdated.getValue()) {
|
||||||
KeepUpdated.getValue()) {
|
if (!isRestoring() && !isUnsetting()) {
|
||||||
if (!isRestoring() &&
|
|
||||||
!isUnsetting()) {
|
|
||||||
//would be nice if this message was displayed immediately instead of after the recomputeFeature
|
//would be nice if this message was displayed immediately instead of after the recomputeFeature
|
||||||
Base::Console().Message("Rebuilding Views for: %s/%s\n", getNameInDocument(), Label.getValue());
|
Base::Console().Message(
|
||||||
|
"Rebuilding Views for: %s/%s\n", getNameInDocument(), Label.getValue());
|
||||||
updateAllViews();
|
updateAllViews();
|
||||||
purgeTouched();
|
purgeTouched();
|
||||||
}
|
}
|
||||||
} else if (prop == &Template) {
|
}
|
||||||
if (!isRestoring() &&
|
else if (prop == &Template) {
|
||||||
!isUnsetting()) {
|
if (!isRestoring() && !isUnsetting()) {
|
||||||
//nothing to page to do??
|
//nothing to page to do??
|
||||||
}
|
}
|
||||||
} else if(prop == &Scale) {
|
}
|
||||||
|
else if (prop == &Scale) {
|
||||||
// touch all views in the Page as they may be dependent on this scale
|
// touch all views in the Page as they may be dependent on this scale
|
||||||
// WF: not sure this loop is required. Views figure out their scale as required. but maybe
|
// WF: not sure this loop is required. Views figure out their scale as required. but maybe
|
||||||
// this is needed just to mark the Views to recompute??
|
// this is needed just to mark the Views to recompute??
|
||||||
if (!isRestoring()) {
|
if (!isRestoring()) {
|
||||||
const std::vector<App::DocumentObject*> &vals = Views.getValues();
|
const std::vector<App::DocumentObject*>& vals = Views.getValues();
|
||||||
for(std::vector<App::DocumentObject *>::const_iterator it = vals.begin(); it < vals.end(); ++it) {
|
for (std::vector<App::DocumentObject*>::const_iterator it = vals.begin();
|
||||||
TechDraw::DrawView *view = dynamic_cast<TechDraw::DrawView *>(*it);
|
it < vals.end();
|
||||||
|
++it) {
|
||||||
|
TechDraw::DrawView* view = dynamic_cast<TechDraw::DrawView*>(*it);
|
||||||
if (view && view->ScaleType.isValue("Page")) {
|
if (view && view->ScaleType.isValue("Page")) {
|
||||||
if(std::abs(view->Scale.getValue() - Scale.getValue()) > FLT_EPSILON) {
|
if (std::abs(view->Scale.getValue() - Scale.getValue()) > FLT_EPSILON) {
|
||||||
view->Scale.setValue(Scale.getValue());
|
view->Scale.setValue(Scale.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (prop == &ProjectionType) {
|
}
|
||||||
// touch all ortho views in the Page as they may be dependent on Projection Type //(is this true?)
|
else if (prop == &ProjectionType) {
|
||||||
const std::vector<App::DocumentObject*> &vals = Views.getValues();
|
// touch all ortho views in the Page as they may be dependent on Projection Type //(is this true?)
|
||||||
for(std::vector<App::DocumentObject *>::const_iterator it = vals.begin(); it < vals.end(); ++it) {
|
const std::vector<App::DocumentObject*>& vals = Views.getValues();
|
||||||
TechDraw::DrawProjGroup *view = dynamic_cast<TechDraw::DrawProjGroup *>(*it);
|
for (std::vector<App::DocumentObject*>::const_iterator it = vals.begin(); it < vals.end();
|
||||||
if (view && view->ProjectionType.isValue("Default")) {
|
++it) {
|
||||||
view->ProjectionType.touch();
|
TechDraw::DrawProjGroup* view = dynamic_cast<TechDraw::DrawProjGroup*>(*it);
|
||||||
}
|
if (view && view->ProjectionType.isValue("Default")) {
|
||||||
}
|
view->ProjectionType.touch();
|
||||||
|
}
|
||||||
// TODO: Also update Template graphic.
|
}
|
||||||
|
|
||||||
|
// TODO: Also update Template graphic.
|
||||||
}
|
}
|
||||||
App::DocumentObject::onChanged(prop);
|
App::DocumentObject::onChanged(prop);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Page is just a container. It doesn't "do" anything.
|
//Page is just a container. It doesn't "do" anything.
|
||||||
App::DocumentObjectExecReturn *DrawPage::execute(void)
|
App::DocumentObjectExecReturn* DrawPage::execute(void)
|
||||||
{
|
{
|
||||||
return App::DocumentObject::execute();
|
return App::DocumentObject::execute();
|
||||||
}
|
}
|
||||||
@@ -157,10 +170,8 @@ short DrawPage::mustExecute() const
|
|||||||
{
|
{
|
||||||
short result = 0;
|
short result = 0;
|
||||||
if (!isRestoring()) {
|
if (!isRestoring()) {
|
||||||
result = (Views.isTouched() ||
|
result = (Views.isTouched() || Scale.isTouched() || ProjectionType.isTouched()
|
||||||
Scale.isTouched() ||
|
|| Template.isTouched());
|
||||||
ProjectionType.isTouched() ||
|
|
||||||
Template.isTouched());
|
|
||||||
if (result) {
|
if (result) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -168,9 +179,9 @@ short DrawPage::mustExecute() const
|
|||||||
return App::DocumentObject::mustExecute();
|
return App::DocumentObject::mustExecute();
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *DrawPage::getPyObject(void)
|
PyObject* DrawPage::getPyObject(void)
|
||||||
{
|
{
|
||||||
if (PythonObject.is(Py::_None())){
|
if (PythonObject.is(Py::_None())) {
|
||||||
// ref counter is set to 1
|
// ref counter is set to 1
|
||||||
PythonObject = Py::Object(new DrawPagePy(this), true);
|
PythonObject = Py::Object(new DrawPagePy(this), true);
|
||||||
}
|
}
|
||||||
@@ -180,13 +191,12 @@ PyObject *DrawPage::getPyObject(void)
|
|||||||
|
|
||||||
bool DrawPage::hasValidTemplate() const
|
bool DrawPage::hasValidTemplate() const
|
||||||
{
|
{
|
||||||
App::DocumentObject *obj = nullptr;
|
App::DocumentObject* obj = nullptr;
|
||||||
obj = Template.getValue();
|
obj = Template.getValue();
|
||||||
|
|
||||||
if(obj && obj->isDerivedFrom(TechDraw::DrawTemplate::getClassTypeId())) {
|
if (obj && obj->isDerivedFrom(TechDraw::DrawTemplate::getClassTypeId())) {
|
||||||
TechDraw::DrawTemplate *templ = static_cast<TechDraw::DrawTemplate *>(obj);
|
TechDraw::DrawTemplate* templ = static_cast<TechDraw::DrawTemplate*>(obj);
|
||||||
if (templ->getWidth() > 0. &&
|
if (templ->getWidth() > 0. && templ->getHeight() > 0.) {
|
||||||
templ->getHeight() > 0.) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -196,11 +206,11 @@ bool DrawPage::hasValidTemplate() const
|
|||||||
|
|
||||||
double DrawPage::getPageWidth() const
|
double DrawPage::getPageWidth() const
|
||||||
{
|
{
|
||||||
App::DocumentObject *obj = nullptr;
|
App::DocumentObject* obj = nullptr;
|
||||||
obj = Template.getValue();
|
obj = Template.getValue();
|
||||||
|
|
||||||
if( obj && obj->isDerivedFrom(TechDraw::DrawTemplate::getClassTypeId()) ) {
|
if (obj && obj->isDerivedFrom(TechDraw::DrawTemplate::getClassTypeId())) {
|
||||||
TechDraw::DrawTemplate *templ = static_cast<TechDraw::DrawTemplate *>(obj);
|
TechDraw::DrawTemplate* templ = static_cast<TechDraw::DrawTemplate*>(obj);
|
||||||
return templ->getWidth();
|
return templ->getWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,12 +219,12 @@ double DrawPage::getPageWidth() const
|
|||||||
|
|
||||||
double DrawPage::getPageHeight() const
|
double DrawPage::getPageHeight() const
|
||||||
{
|
{
|
||||||
App::DocumentObject *obj = nullptr;
|
App::DocumentObject* obj = nullptr;
|
||||||
obj = Template.getValue();
|
obj = Template.getValue();
|
||||||
|
|
||||||
if(obj) {
|
if (obj) {
|
||||||
if(obj->isDerivedFrom(TechDraw::DrawTemplate::getClassTypeId())) {
|
if (obj->isDerivedFrom(TechDraw::DrawTemplate::getClassTypeId())) {
|
||||||
TechDraw::DrawTemplate *templ = static_cast<TechDraw::DrawTemplate *>(obj);
|
TechDraw::DrawTemplate* templ = static_cast<TechDraw::DrawTemplate*>(obj);
|
||||||
return templ->getHeight();
|
return templ->getHeight();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -223,16 +233,16 @@ double DrawPage::getPageHeight() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
//orientation as text
|
//orientation as text
|
||||||
const char * DrawPage::getPageOrientation() const
|
const char* DrawPage::getPageOrientation() const
|
||||||
{
|
{
|
||||||
App::DocumentObject *obj;
|
App::DocumentObject* obj;
|
||||||
obj = Template.getValue();
|
obj = Template.getValue();
|
||||||
|
|
||||||
if(obj) {
|
if (obj) {
|
||||||
if(obj->isDerivedFrom(TechDraw::DrawTemplate::getClassTypeId())) {
|
if (obj->isDerivedFrom(TechDraw::DrawTemplate::getClassTypeId())) {
|
||||||
TechDraw::DrawTemplate *templ = static_cast<TechDraw::DrawTemplate *>(obj);
|
TechDraw::DrawTemplate* templ = static_cast<TechDraw::DrawTemplate*>(obj);
|
||||||
|
|
||||||
return templ->Orientation.getValueAsString();
|
return templ->Orientation.getValueAsString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw Base::RuntimeError("Template not set for Page");
|
throw Base::RuntimeError("Template not set for Page");
|
||||||
@@ -241,41 +251,43 @@ const char * DrawPage::getPageOrientation() const
|
|||||||
//orientation as 0(Portrait) or 1(Landscape)
|
//orientation as 0(Portrait) or 1(Landscape)
|
||||||
int DrawPage::getOrientation() const
|
int DrawPage::getOrientation() const
|
||||||
{
|
{
|
||||||
App::DocumentObject *obj;
|
App::DocumentObject* obj;
|
||||||
obj = Template.getValue();
|
obj = Template.getValue();
|
||||||
|
|
||||||
if(obj) {
|
if (obj) {
|
||||||
if(obj->isDerivedFrom(TechDraw::DrawTemplate::getClassTypeId())) {
|
if (obj->isDerivedFrom(TechDraw::DrawTemplate::getClassTypeId())) {
|
||||||
TechDraw::DrawTemplate *templ = static_cast<TechDraw::DrawTemplate *>(obj);
|
TechDraw::DrawTemplate* templ = static_cast<TechDraw::DrawTemplate*>(obj);
|
||||||
|
|
||||||
return templ->Orientation.getValue();
|
return templ->Orientation.getValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw Base::RuntimeError("Template not set for Page");
|
throw Base::RuntimeError("Template not set for Page");
|
||||||
}
|
}
|
||||||
|
|
||||||
int DrawPage::addView(App::DocumentObject *docObj)
|
int DrawPage::addView(App::DocumentObject* docObj)
|
||||||
{
|
{
|
||||||
if(!docObj->isDerivedFrom(TechDraw::DrawView::getClassTypeId()))
|
if (!docObj->isDerivedFrom(TechDraw::DrawView::getClassTypeId())) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
DrawView* view = static_cast<DrawView*>(docObj);
|
DrawView* view = static_cast<DrawView*>(docObj);
|
||||||
|
|
||||||
//position all new views in center of Page (exceptDVDimension)
|
//position all new views in center of Page (exceptDVDimension)
|
||||||
if (!docObj->isDerivedFrom(TechDraw::DrawViewDimension::getClassTypeId()) &&
|
if (!docObj->isDerivedFrom(TechDraw::DrawViewDimension::getClassTypeId())
|
||||||
!docObj->isDerivedFrom(TechDraw::DrawViewBalloon::getClassTypeId())) {
|
&& !docObj->isDerivedFrom(TechDraw::DrawViewBalloon::getClassTypeId())) {
|
||||||
view->X.setValue(getPageWidth()/2.0);
|
view->X.setValue(getPageWidth() / 2.0);
|
||||||
view->Y.setValue(getPageHeight()/2.0);
|
view->Y.setValue(getPageHeight() / 2.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//add view to list
|
//add view to list
|
||||||
const std::vector<App::DocumentObject *> currViews = Views.getValues();
|
const std::vector<App::DocumentObject*> currViews = Views.getValues();
|
||||||
std::vector<App::DocumentObject *> newViews(currViews);
|
std::vector<App::DocumentObject*> newViews(currViews);
|
||||||
newViews.push_back(docObj);
|
newViews.push_back(docObj);
|
||||||
Views.setValues(newViews);
|
Views.setValues(newViews);
|
||||||
|
|
||||||
//check if View fits on Page
|
//check if View fits on Page
|
||||||
if ( !view->checkFit(this) ) {
|
if (!view->checkFit(this)) {
|
||||||
Base::Console().Warning("%s is larger than page. Will be scaled.\n", view->getNameInDocument());
|
Base::Console().Warning("%s is larger than page. Will be scaled.\n",
|
||||||
|
view->getNameInDocument());
|
||||||
view->ScaleType.setValue("Automatic");
|
view->ScaleType.setValue("Automatic");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -285,10 +297,11 @@ int DrawPage::addView(App::DocumentObject *docObj)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Note Views might be removed from document elsewhere so need to check if a View is still in Document here
|
//Note Views might be removed from document elsewhere so need to check if a View is still in Document here
|
||||||
int DrawPage::removeView(App::DocumentObject *docObj)
|
int DrawPage::removeView(App::DocumentObject* docObj)
|
||||||
{
|
{
|
||||||
if(!docObj->isDerivedFrom(TechDraw::DrawView::getClassTypeId()))
|
if (!docObj->isDerivedFrom(TechDraw::DrawView::getClassTypeId())) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
App::Document* doc = docObj->getDocument();
|
App::Document* doc = docObj->getDocument();
|
||||||
if (!doc) {
|
if (!doc) {
|
||||||
@@ -297,7 +310,7 @@ int DrawPage::removeView(App::DocumentObject *docObj)
|
|||||||
|
|
||||||
const char* name = docObj->getNameInDocument();
|
const char* name = docObj->getNameInDocument();
|
||||||
if (!name) {
|
if (!name) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
const std::vector<App::DocumentObject*> currViews = Views.getValues();
|
const std::vector<App::DocumentObject*> currViews = Views.getValues();
|
||||||
std::vector<App::DocumentObject*> newViews;
|
std::vector<App::DocumentObject*> newViews;
|
||||||
@@ -334,7 +347,7 @@ void DrawPage::onDocumentRestored()
|
|||||||
|
|
||||||
void DrawPage::redrawCommand()
|
void DrawPage::redrawCommand()
|
||||||
{
|
{
|
||||||
// Base::Console().Message("DP::redrawCommand()\n");
|
// Base::Console().Message("DP::redrawCommand()\n");
|
||||||
forceRedraw(true);
|
forceRedraw(true);
|
||||||
updateAllViews();
|
updateAllViews();
|
||||||
forceRedraw(false);
|
forceRedraw(false);
|
||||||
@@ -342,12 +355,13 @@ void DrawPage::redrawCommand()
|
|||||||
|
|
||||||
void DrawPage::updateAllViews()
|
void DrawPage::updateAllViews()
|
||||||
{
|
{
|
||||||
// Base::Console().Message("DP::updateAllViews()\n");
|
// Base::Console().Message("DP::updateAllViews()\n");
|
||||||
std::vector<App::DocumentObject*> featViews = getAllViews(); //unordered list of views within page
|
std::vector<App::DocumentObject*> featViews =
|
||||||
|
getAllViews();//unordered list of views within page
|
||||||
|
|
||||||
//first, make sure all the Parts have been executed so GeometryObjects exist
|
//first, make sure all the Parts have been executed so GeometryObjects exist
|
||||||
for(auto& v: featViews) {
|
for (auto& v : featViews) {
|
||||||
TechDraw::DrawViewPart *part = dynamic_cast<TechDraw::DrawViewPart *>(v);
|
TechDraw::DrawViewPart* part = dynamic_cast<TechDraw::DrawViewPart*>(v);
|
||||||
if (part) {
|
if (part) {
|
||||||
//view, section, detail, dpgi
|
//view, section, detail, dpgi
|
||||||
part->recomputeFeature();
|
part->recomputeFeature();
|
||||||
@@ -355,8 +369,8 @@ void DrawPage::updateAllViews()
|
|||||||
}
|
}
|
||||||
//second, do the rest of the views that may depend on a part view
|
//second, do the rest of the views that may depend on a part view
|
||||||
//TODO: check if we have 2 layers of dependency (ex. leader > weld > tile?)
|
//TODO: check if we have 2 layers of dependency (ex. leader > weld > tile?)
|
||||||
for(auto& v: featViews) {
|
for (auto& v : featViews) {
|
||||||
TechDraw::DrawViewPart *part = dynamic_cast<TechDraw::DrawViewPart *>(v);
|
TechDraw::DrawViewPart* part = dynamic_cast<TechDraw::DrawViewPart*>(v);
|
||||||
if (part) {
|
if (part) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -371,15 +385,15 @@ void DrawPage::updateAllViews()
|
|||||||
|
|
||||||
std::vector<App::DocumentObject*> DrawPage::getAllViews(void)
|
std::vector<App::DocumentObject*> DrawPage::getAllViews(void)
|
||||||
{
|
{
|
||||||
auto views = Views.getValues(); //list of docObjects
|
auto views = Views.getValues();//list of docObjects
|
||||||
std::vector<App::DocumentObject*> allViews;
|
std::vector<App::DocumentObject*> allViews;
|
||||||
for (auto& v: views) {
|
for (auto& v : views) {
|
||||||
allViews.push_back(v);
|
allViews.push_back(v);
|
||||||
if (v->isDerivedFrom(TechDraw::DrawProjGroup::getClassTypeId())) {
|
if (v->isDerivedFrom(TechDraw::DrawProjGroup::getClassTypeId())) {
|
||||||
TechDraw::DrawProjGroup* dpg = static_cast<TechDraw::DrawProjGroup*>(v);
|
TechDraw::DrawProjGroup* dpg = static_cast<TechDraw::DrawProjGroup*>(v);
|
||||||
if (dpg) { //can't really happen!
|
if (dpg) {//can't really happen!
|
||||||
std::vector<App::DocumentObject*> pgViews = dpg->Views.getValues();
|
std::vector<App::DocumentObject*> pgViews = dpg->Views.getValues();
|
||||||
allViews.insert(allViews.end(), pgViews.begin(), pgViews.end());
|
allViews.insert(allViews.end(), pgViews.begin(), pgViews.end());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -397,31 +411,34 @@ void DrawPage::unsetupObject()
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const std::vector<App::DocumentObject*> currViews = Views.getValues();
|
const std::vector<App::DocumentObject*> currViews = Views.getValues();
|
||||||
for (auto& v: currViews) {
|
for (auto& v : currViews) {
|
||||||
//NOTE: the order of objects in Page.Views does not reflect the object hierarchy
|
//NOTE: the order of objects in Page.Views does not reflect the object hierarchy
|
||||||
// this means that a ProjGroup could be deleted before it's child ProjGroupItems.
|
// this means that a ProjGroup could be deleted before it's child ProjGroupItems.
|
||||||
// this causes problems when removing objects from document
|
// this causes problems when removing objects from document
|
||||||
if (v->isAttachedToDocument()) {
|
if (v->isAttachedToDocument()) {
|
||||||
std::string viewName = v->getNameInDocument();
|
std::string viewName = v->getNameInDocument();
|
||||||
Base::Interpreter().runStringArg("App.getDocument(\"%s\").removeObject(\"%s\")",
|
Base::Interpreter().runStringArg("App.getDocument(\"%s\").removeObject(\"%s\")",
|
||||||
docName.c_str(), viewName.c_str());
|
docName.c_str(),
|
||||||
} else {
|
viewName.c_str());
|
||||||
Base::Console().Log("DP::unsetupObject - v(%s) is not in document. skipping\n", pageName.c_str());
|
}
|
||||||
|
else {
|
||||||
|
Base::Console().Log("DP::unsetupObject - v(%s) is not in document. skipping\n",
|
||||||
|
pageName.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::vector<App::DocumentObject*> emptyViews; //probably superfluous
|
std::vector<App::DocumentObject*> emptyViews;//probably superfluous
|
||||||
Views.setValues(emptyViews);
|
Views.setValues(emptyViews);
|
||||||
|
}
|
||||||
}
|
catch (...) {
|
||||||
catch (...) {
|
Base::Console().Warning("DP::unsetupObject - %s - error while deleting children\n",
|
||||||
Base::Console().Warning("DP::unsetupObject - %s - error while deleting children\n", getNameInDocument());
|
getNameInDocument());
|
||||||
}
|
}
|
||||||
|
|
||||||
App::DocumentObject* tmp = Template.getValue();
|
App::DocumentObject* tmp = Template.getValue();
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
std::string templateName = Template.getValue()->getNameInDocument();
|
std::string templateName = Template.getValue()->getNameInDocument();
|
||||||
Base::Interpreter().runStringArg("App.getDocument(\"%s\").removeObject(\"%s\")",
|
Base::Interpreter().runStringArg(
|
||||||
docName.c_str(), templateName.c_str());
|
"App.getDocument(\"%s\").removeObject(\"%s\")", docName.c_str(), templateName.c_str());
|
||||||
}
|
}
|
||||||
Template.setValue(nullptr);
|
Template.setValue(nullptr);
|
||||||
}
|
}
|
||||||
@@ -434,21 +451,23 @@ int DrawPage::getNextBalloonIndex(void)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawPage::handleChangedPropertyType(
|
void DrawPage::handleChangedPropertyType(Base::XMLReader& reader, const char* TypeName,
|
||||||
Base::XMLReader &reader, const char * TypeName, App::Property * prop)
|
App::Property* prop)
|
||||||
{
|
{
|
||||||
if (prop == &Scale) {
|
if (prop == &Scale) {
|
||||||
App::PropertyFloat tmp;
|
App::PropertyFloat tmp;
|
||||||
if (strcmp(tmp.getTypeId().getName(), TypeName)==0) { //property in file is Float
|
if (strcmp(tmp.getTypeId().getName(), TypeName) == 0) {//property in file is Float
|
||||||
tmp.setContainer(this);
|
tmp.setContainer(this);
|
||||||
tmp.Restore(reader);
|
tmp.Restore(reader);
|
||||||
double tmpValue = tmp.getValue();
|
double tmpValue = tmp.getValue();
|
||||||
if (tmpValue > 0.0) {
|
if (tmpValue > 0.0) {
|
||||||
Scale.setValue(tmpValue);
|
Scale.setValue(tmpValue);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
Scale.setValue(1.0);
|
Scale.setValue(1.0);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
// has Scale prop that isn't Float!
|
// has Scale prop that isn't Float!
|
||||||
Base::Console().Log("DrawPage::Restore - old Document Scale is Not Float!\n");
|
Base::Console().Log("DrawPage::Restore - old Document Scale is Not Float!\n");
|
||||||
// no idea
|
// no idea
|
||||||
@@ -459,12 +478,10 @@ void DrawPage::handleChangedPropertyType(
|
|||||||
bool DrawPage::canUpdate() const
|
bool DrawPage::canUpdate() const
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
if (GlobalUpdateDrawings() &&
|
if (GlobalUpdateDrawings() && KeepUpdated.getValue()) {
|
||||||
KeepUpdated.getValue()) {
|
|
||||||
result = true;
|
result = true;
|
||||||
} else if (!GlobalUpdateDrawings() &&
|
}
|
||||||
AllowPageOverride() &&
|
else if (!GlobalUpdateDrawings() && AllowPageOverride() && KeepUpdated.getValue()) {
|
||||||
KeepUpdated.getValue()) {
|
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -486,8 +503,11 @@ bool DrawPage::hasObject(App::DocumentObject* obj)
|
|||||||
//allow/prevent drawing updates for all Pages
|
//allow/prevent drawing updates for all Pages
|
||||||
bool DrawPage::GlobalUpdateDrawings(void)
|
bool DrawPage::GlobalUpdateDrawings(void)
|
||||||
{
|
{
|
||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/General");
|
.GetUserParameter()
|
||||||
|
.GetGroup("BaseApp")
|
||||||
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/General");
|
||||||
bool result = hGrp->GetBool("GlobalUpdateDrawings", true);
|
bool result = hGrp->GetBool("GlobalUpdateDrawings", true);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -495,8 +515,11 @@ bool DrawPage::GlobalUpdateDrawings(void)
|
|||||||
//allow/prevent a single page to update despite GlobalUpdateDrawings setting
|
//allow/prevent a single page to update despite GlobalUpdateDrawings setting
|
||||||
bool DrawPage::AllowPageOverride(void)
|
bool DrawPage::AllowPageOverride(void)
|
||||||
{
|
{
|
||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/General");
|
.GetUserParameter()
|
||||||
|
.GetGroup("BaseApp")
|
||||||
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/General");
|
||||||
bool result = hGrp->GetBool("AllowPageOverride", true);
|
bool result = hGrp->GetBool("AllowPageOverride", true);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -504,14 +527,16 @@ bool DrawPage::AllowPageOverride(void)
|
|||||||
|
|
||||||
// Python Drawing feature ---------------------------------------------------------
|
// Python Drawing feature ---------------------------------------------------------
|
||||||
|
|
||||||
namespace App {
|
namespace App
|
||||||
|
{
|
||||||
/// @cond DOXERR
|
/// @cond DOXERR
|
||||||
PROPERTY_SOURCE_TEMPLATE(TechDraw::DrawPagePython, TechDraw::DrawPage)
|
PROPERTY_SOURCE_TEMPLATE(TechDraw::DrawPagePython, TechDraw::DrawPage)
|
||||||
template<> const char* TechDraw::DrawPagePython::getViewProviderName(void) const {
|
template<> const char* TechDraw::DrawPagePython::getViewProviderName(void) const
|
||||||
|
{
|
||||||
return "TechDrawGui::ViewProviderPage";
|
return "TechDrawGui::ViewProviderPage";
|
||||||
}
|
}
|
||||||
/// @endcond
|
/// @endcond
|
||||||
|
|
||||||
// explicit template instantiation
|
// explicit template instantiation
|
||||||
template class TechDrawExport FeaturePythonT<TechDraw::DrawPage>;
|
template class TechDrawExport FeaturePythonT<TechDraw::DrawPage>;
|
||||||
}
|
}// namespace App
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ DrawViewAnnotation::DrawViewAnnotation()
|
|||||||
ADD_PROPERTY_TYPE(Text ,("Default Text"), vgroup, App::Prop_None, "Annotation text");
|
ADD_PROPERTY_TYPE(Text ,("Default Text"), vgroup, App::Prop_None, "Annotation text");
|
||||||
ADD_PROPERTY_TYPE(Font ,(Preferences::labelFont().c_str()),
|
ADD_PROPERTY_TYPE(Font ,(Preferences::labelFont().c_str()),
|
||||||
vgroup, App::Prop_None, "Font name");
|
vgroup, App::Prop_None, "Font name");
|
||||||
ADD_PROPERTY_TYPE(TextColor, (0.0f, 0.0f, 0.0f), vgroup, App::Prop_None, "Text color");
|
ADD_PROPERTY_TYPE(TextColor, (Preferences::normalColor()), vgroup, App::Prop_None, "Text color");
|
||||||
ADD_PROPERTY_TYPE(TextSize, (Preferences::labelFontSizeMM()),
|
ADD_PROPERTY_TYPE(TextSize, (Preferences::labelFontSizeMM()),
|
||||||
vgroup, App::Prop_None, "Text size");
|
vgroup, App::Prop_None, "Text size");
|
||||||
ADD_PROPERTY_TYPE(MaxWidth, (-1.0), vgroup, App::Prop_None, "Maximum width of the annotation block.\n -1 means no maximum width.");
|
ADD_PROPERTY_TYPE(MaxWidth, (-1.0), vgroup, App::Prop_None, "Maximum width of the annotation block.\n -1 means no maximum width.");
|
||||||
|
|||||||
@@ -23,19 +23,19 @@
|
|||||||
#include "PreCompiled.h"
|
#include "PreCompiled.h"
|
||||||
|
|
||||||
#ifndef _PreComp_
|
#ifndef _PreComp_
|
||||||
# include <sstream>
|
#include "QDomNodeModel.h"
|
||||||
# include <QDomDocument>
|
#include <QDomDocument>
|
||||||
# include "QDomNodeModel.h"
|
#include <QXmlQuery>
|
||||||
# include <QXmlQuery>
|
#include <QXmlResultItems>
|
||||||
# include <QXmlResultItems>
|
#include <sstream>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <Base/Console.h>
|
#include <Base/Console.h>
|
||||||
|
|
||||||
#include "DrawViewSymbol.h"
|
|
||||||
#include "DrawViewSymbolPy.h" // generated from DrawViewSymbolPy.xml
|
|
||||||
#include "DrawPage.h"
|
#include "DrawPage.h"
|
||||||
#include "DrawUtil.h"
|
#include "DrawUtil.h"
|
||||||
|
#include "DrawViewSymbol.h"
|
||||||
|
#include "DrawViewSymbolPy.h"// generated from DrawViewSymbolPy.xml
|
||||||
|
|
||||||
|
|
||||||
using namespace TechDraw;
|
using namespace TechDraw;
|
||||||
@@ -49,18 +49,17 @@ PROPERTY_SOURCE(TechDraw::DrawViewSymbol, TechDraw::DrawView)
|
|||||||
|
|
||||||
DrawViewSymbol::DrawViewSymbol()
|
DrawViewSymbol::DrawViewSymbol()
|
||||||
{
|
{
|
||||||
static const char *vgroup = "Drawing view";
|
static const char* vgroup = "Drawing view";
|
||||||
|
|
||||||
ADD_PROPERTY_TYPE(Symbol, (""), vgroup, App::Prop_None, "The SVG code defining this symbol");
|
ADD_PROPERTY_TYPE(Symbol, (""), vgroup, App::Prop_None, "The SVG code defining this symbol");
|
||||||
ADD_PROPERTY_TYPE(EditableTexts, (""), vgroup, App::Prop_None, "Substitution values for the editable strings in this symbol");
|
ADD_PROPERTY_TYPE(EditableTexts, (""), vgroup, App::Prop_None,
|
||||||
|
"Substitution values for the editable strings in this symbol");
|
||||||
ScaleType.setValue("Custom");
|
ScaleType.setValue("Custom");
|
||||||
Scale.setStatus(App::Property::ReadOnly, false);
|
Scale.setStatus(App::Property::ReadOnly, false);
|
||||||
Symbol.setStatus(App::Property::Hidden, true);
|
Symbol.setStatus(App::Property::Hidden, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawViewSymbol::~DrawViewSymbol()
|
DrawViewSymbol::~DrawViewSymbol() {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void DrawViewSymbol::onChanged(const App::Property* prop)
|
void DrawViewSymbol::onChanged(const App::Property* prop)
|
||||||
{
|
{
|
||||||
@@ -69,7 +68,8 @@ void DrawViewSymbol::onChanged(const App::Property* prop)
|
|||||||
std::vector<std::string> editables = getEditableFields();
|
std::vector<std::string> editables = getEditableFields();
|
||||||
EditableTexts.setValues(editables);
|
EditableTexts.setValues(editables);
|
||||||
}
|
}
|
||||||
} else if (prop == &EditableTexts) {
|
}
|
||||||
|
else if (prop == &EditableTexts) {
|
||||||
//this will change Symbol, which will call onChanged(Symbol),
|
//this will change Symbol, which will call onChanged(Symbol),
|
||||||
//which will change EditableTexts, but the loop stops after
|
//which will change EditableTexts, but the loop stops after
|
||||||
//1 cycle
|
//1 cycle
|
||||||
@@ -79,7 +79,7 @@ void DrawViewSymbol::onChanged(const App::Property* prop)
|
|||||||
TechDraw::DrawView::onChanged(prop);
|
TechDraw::DrawView::onChanged(prop);
|
||||||
}
|
}
|
||||||
|
|
||||||
App::DocumentObjectExecReturn *DrawViewSymbol::execute()
|
App::DocumentObjectExecReturn* DrawViewSymbol::execute()
|
||||||
{
|
{
|
||||||
//nothing to do. DVS is just a container for properties.
|
//nothing to do. DVS is just a container for properties.
|
||||||
//the action takes place on the Gui side.
|
//the action takes place on the Gui side.
|
||||||
@@ -88,9 +88,9 @@ App::DocumentObjectExecReturn *DrawViewSymbol::execute()
|
|||||||
|
|
||||||
QRectF DrawViewSymbol::getRect() const
|
QRectF DrawViewSymbol::getRect() const
|
||||||
{
|
{
|
||||||
double w = 64.0; //must default to something
|
double w = 64.0;//must default to something
|
||||||
double h = 64.0;
|
double h = 64.0;
|
||||||
return (QRectF(0, 0,w, h));
|
return (QRectF(0, 0, w, h));
|
||||||
}
|
}
|
||||||
|
|
||||||
//!Assume all svg files fit the page and/or the user will scale manually
|
//!Assume all svg files fit the page and/or the user will scale manually
|
||||||
@@ -117,15 +117,15 @@ std::vector<std::string> DrawViewSymbol::getEditableFields()
|
|||||||
|
|
||||||
// XPath query to select all <tspan> nodes whose <text> parent
|
// XPath query to select all <tspan> nodes whose <text> parent
|
||||||
// has "freecad:editable" attribute
|
// has "freecad:editable" attribute
|
||||||
query.setQuery(QString::fromUtf8(
|
query.setQuery(QString::fromUtf8("declare default element namespace \"" SVG_NS_URI "\"; "
|
||||||
"declare default element namespace \"" SVG_NS_URI "\"; "
|
"declare namespace freecad=\"" FREECAD_SVG_NS_URI "\"; "
|
||||||
"declare namespace freecad=\"" FREECAD_SVG_NS_URI "\"; "
|
"//text[@freecad:editable]/tspan"));
|
||||||
"//text[@freecad:editable]/tspan"));
|
|
||||||
|
|
||||||
query.evaluateTo(&queryResult);
|
query.evaluateTo(&queryResult);
|
||||||
|
|
||||||
while (!queryResult.next().isNull()) {
|
while (!queryResult.next().isNull()) {
|
||||||
QDomElement tspan = model.toDomNode(queryResult.current().toNodeModelIndex()).toElement();
|
QDomElement tspan =
|
||||||
|
model.toDomNode(queryResult.current().toNodeModelIndex()).toElement();
|
||||||
QString editableValue = tspan.firstChild().nodeValue();
|
QString editableValue = tspan.firstChild().nodeValue();
|
||||||
editables.emplace_back(editableValue.toUtf8().constData());
|
editables.emplace_back(editableValue.toUtf8().constData());
|
||||||
}
|
}
|
||||||
@@ -153,19 +153,19 @@ void DrawViewSymbol::updateFieldsInSymbol()
|
|||||||
|
|
||||||
// XPath query to select all <tspan> nodes whose <text> parent
|
// XPath query to select all <tspan> nodes whose <text> parent
|
||||||
// has "freecad:editable" attribute
|
// has "freecad:editable" attribute
|
||||||
query.setQuery(QString::fromUtf8(
|
query.setQuery(QString::fromUtf8("declare default element namespace \"" SVG_NS_URI "\"; "
|
||||||
"declare default element namespace \"" SVG_NS_URI "\"; "
|
"declare namespace freecad=\"" FREECAD_SVG_NS_URI "\"; "
|
||||||
"declare namespace freecad=\"" FREECAD_SVG_NS_URI "\"; "
|
"//text[@freecad:editable]/tspan"));
|
||||||
"//text[@freecad:editable]/tspan"));
|
|
||||||
query.evaluateTo(&queryResult);
|
query.evaluateTo(&queryResult);
|
||||||
|
|
||||||
unsigned int count = 0;
|
unsigned int count = 0;
|
||||||
while (!queryResult.next().isNull())
|
while (!queryResult.next().isNull()) {
|
||||||
{
|
QDomElement tspanElement =
|
||||||
QDomElement tspanElement = model.toDomNode(queryResult.current().toNodeModelIndex()).toElement();
|
model.toDomNode(queryResult.current().toNodeModelIndex()).toElement();
|
||||||
|
|
||||||
// Keep all spaces in the text node
|
// Keep all spaces in the text node
|
||||||
tspanElement.setAttribute(QString::fromUtf8("xml:space"), QString::fromUtf8("preserve"));
|
tspanElement.setAttribute(QString::fromUtf8("xml:space"),
|
||||||
|
QString::fromUtf8("preserve"));
|
||||||
|
|
||||||
// Remove all child nodes (if any)
|
// Remove all child nodes (if any)
|
||||||
while (!tspanElement.lastChild().isNull()) {
|
while (!tspanElement.lastChild().isNull()) {
|
||||||
@@ -173,8 +173,8 @@ void DrawViewSymbol::updateFieldsInSymbol()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Finally append text node with editable replacement as the only <tspan> descendant
|
// Finally append text node with editable replacement as the only <tspan> descendant
|
||||||
tspanElement.appendChild(symbolDocument.createTextNode(
|
tspanElement.appendChild(
|
||||||
QString::fromUtf8(editText[count].c_str())));
|
symbolDocument.createTextNode(QString::fromUtf8(editText[count].c_str())));
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
Symbol.setValue(symbolDocument.toString(1).toStdString());
|
Symbol.setValue(symbolDocument.toString(1).toStdString());
|
||||||
@@ -186,6 +186,9 @@ bool DrawViewSymbol::loadQDomDocument(QDomDocument& symbolDocument)
|
|||||||
{
|
{
|
||||||
const char* symbol = Symbol.getValue();
|
const char* symbol = Symbol.getValue();
|
||||||
QByteArray qba(symbol);
|
QByteArray qba(symbol);
|
||||||
|
if (qba.isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
QString errorMsg;
|
QString errorMsg;
|
||||||
int errorLine;
|
int errorLine;
|
||||||
int errorCol;
|
int errorCol;
|
||||||
@@ -193,15 +196,16 @@ bool DrawViewSymbol::loadQDomDocument(QDomDocument& symbolDocument)
|
|||||||
bool rc = symbolDocument.setContent(qba, nsProcess, &errorMsg, &errorLine, &errorCol);
|
bool rc = symbolDocument.setContent(qba, nsProcess, &errorMsg, &errorLine, &errorCol);
|
||||||
if (!rc) {
|
if (!rc) {
|
||||||
//invalid SVG message
|
//invalid SVG message
|
||||||
Base::Console().Warning("DrawViewSymbol - %s - SVG for Symbol is not valid. See log.\n");
|
Base::Console().Warning("DrawViewSymbol - %s - SVG for Symbol is not valid. See log.\n",
|
||||||
|
getNameInDocument());
|
||||||
Base::Console().Log("DrawViewSymbol - %s - len: %d rc: %d error: %s line: %d col: %d\n",
|
Base::Console().Log("DrawViewSymbol - %s - len: %d rc: %d error: %s line: %d col: %d\n",
|
||||||
getNameInDocument(), strlen(symbol), rc,
|
getNameInDocument(), strlen(symbol), rc, qPrintable(errorMsg),
|
||||||
qPrintable(errorMsg), errorLine, errorCol);
|
errorLine, errorCol);
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *DrawViewSymbol::getPyObject()
|
PyObject* DrawViewSymbol::getPyObject()
|
||||||
{
|
{
|
||||||
if (PythonObject.is(Py::_None())) {
|
if (PythonObject.is(Py::_None())) {
|
||||||
// ref counter is set to 1
|
// ref counter is set to 1
|
||||||
@@ -212,14 +216,16 @@ PyObject *DrawViewSymbol::getPyObject()
|
|||||||
|
|
||||||
// Python Drawing feature ---------------------------------------------------------
|
// Python Drawing feature ---------------------------------------------------------
|
||||||
|
|
||||||
namespace App {
|
namespace App
|
||||||
|
{
|
||||||
/// @cond DOXERR
|
/// @cond DOXERR
|
||||||
PROPERTY_SOURCE_TEMPLATE(TechDraw::DrawViewSymbolPython, TechDraw::DrawViewSymbol)
|
PROPERTY_SOURCE_TEMPLATE(TechDraw::DrawViewSymbolPython, TechDraw::DrawViewSymbol)
|
||||||
template<> const char* TechDraw::DrawViewSymbolPython::getViewProviderName() const {
|
template<> const char* TechDraw::DrawViewSymbolPython::getViewProviderName() const
|
||||||
|
{
|
||||||
return "TechDrawGui::ViewProviderSymbol";
|
return "TechDrawGui::ViewProviderSymbol";
|
||||||
}
|
}
|
||||||
/// @endcond
|
/// @endcond
|
||||||
|
|
||||||
// explicit template instantiation
|
// explicit template instantiation
|
||||||
template class TechDrawExport FeaturePythonT<TechDraw::DrawViewSymbol>;
|
template class TechDrawExport FeaturePythonT<TechDraw::DrawViewSymbol>;
|
||||||
}
|
}// namespace App
|
||||||
|
|||||||
@@ -23,8 +23,8 @@
|
|||||||
#include "PreCompiled.h"
|
#include "PreCompiled.h"
|
||||||
|
|
||||||
#ifndef _PreComp_
|
#ifndef _PreComp_
|
||||||
#include <string>
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <string>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <App/Application.h>
|
#include <App/Application.h>
|
||||||
@@ -45,9 +45,11 @@ const double Preferences::DefaultFontSizeInMM = 5.0;
|
|||||||
|
|
||||||
std::string Preferences::labelFont()
|
std::string Preferences::labelFont()
|
||||||
{
|
{
|
||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
.GetUserParameter()
|
||||||
GetGroup("Mod/TechDraw/Labels");
|
.GetGroup("BaseApp")
|
||||||
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/Labels");
|
||||||
std::string fontName = hGrp->GetASCII("LabelFont", "osifont");
|
std::string fontName = hGrp->GetASCII("LabelFont", "osifont");
|
||||||
return fontName;
|
return fontName;
|
||||||
}
|
}
|
||||||
@@ -60,40 +62,50 @@ QString Preferences::labelFontQString()
|
|||||||
|
|
||||||
double Preferences::labelFontSizeMM()
|
double Preferences::labelFontSizeMM()
|
||||||
{
|
{
|
||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
.GetUserParameter()
|
||||||
GetGroup("Mod/TechDraw/Labels");
|
.GetGroup("BaseApp")
|
||||||
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/Labels");
|
||||||
return hGrp->GetFloat("LabelSize", DefaultFontSizeInMM);
|
return hGrp->GetFloat("LabelSize", DefaultFontSizeInMM);
|
||||||
}
|
}
|
||||||
|
|
||||||
double Preferences::dimFontSizeMM()
|
double Preferences::dimFontSizeMM()
|
||||||
{
|
{
|
||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
.GetUserParameter()
|
||||||
GetGroup("Mod/TechDraw/Dimensions");
|
.GetGroup("BaseApp")
|
||||||
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/Dimensions");
|
||||||
return hGrp->GetFloat("FontSize", DefaultFontSizeInMM);
|
return hGrp->GetFloat("FontSize", DefaultFontSizeInMM);
|
||||||
}
|
}
|
||||||
|
|
||||||
App::Color Preferences::normalColor()
|
App::Color Preferences::normalColor()
|
||||||
{
|
{
|
||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
.GetUserParameter()
|
||||||
GetGroup("Mod/TechDraw/Colors");
|
.GetGroup("BaseApp")
|
||||||
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/Colors");
|
||||||
App::Color fcColor;
|
App::Color fcColor;
|
||||||
fcColor.setPackedValue(hGrp->GetUnsigned("NormalColor", 0x000000FF)); //#000000 black
|
fcColor.setPackedValue(hGrp->GetUnsigned("NormalColor", 0x000000FF));//#000000 black
|
||||||
return fcColor;
|
return fcColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
App::Color Preferences::selectColor()
|
App::Color Preferences::selectColor()
|
||||||
{
|
{
|
||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
.GetUserParameter()
|
||||||
GetGroup("View");
|
.GetGroup("BaseApp")
|
||||||
unsigned int defColor = hGrp->GetUnsigned("SelectionColor", 0x00FF00FF); //#00FF00 lime
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("View");
|
||||||
|
unsigned int defColor = hGrp->GetUnsigned("SelectionColor", 0x00FF00FF);//#00FF00 lime
|
||||||
|
|
||||||
hGrp = App::GetApplication().GetUserParameter().
|
hGrp = App::GetApplication()
|
||||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
.GetUserParameter()
|
||||||
GetGroup("Mod/TechDraw/Colors");
|
.GetGroup("BaseApp")
|
||||||
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/Colors");
|
||||||
App::Color fcColor;
|
App::Color fcColor;
|
||||||
fcColor.setPackedValue(hGrp->GetUnsigned("SelectColor", defColor));
|
fcColor.setPackedValue(hGrp->GetUnsigned("SelectColor", defColor));
|
||||||
return fcColor;
|
return fcColor;
|
||||||
@@ -101,14 +113,18 @@ App::Color Preferences::selectColor()
|
|||||||
|
|
||||||
App::Color Preferences::preselectColor()
|
App::Color Preferences::preselectColor()
|
||||||
{
|
{
|
||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
.GetUserParameter()
|
||||||
GetGroup("View");
|
.GetGroup("BaseApp")
|
||||||
unsigned int defColor = hGrp->GetUnsigned("HighlightColor", 0xFFFF00FF); //#FFFF00 yellow
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("View");
|
||||||
|
unsigned int defColor = hGrp->GetUnsigned("HighlightColor", 0xFFFF00FF);//#FFFF00 yellow
|
||||||
|
|
||||||
hGrp = App::GetApplication().GetUserParameter().
|
hGrp = App::GetApplication()
|
||||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
.GetUserParameter()
|
||||||
GetGroup("Mod/TechDraw/Colors");
|
.GetGroup("BaseApp")
|
||||||
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/Colors");
|
||||||
App::Color fcColor;
|
App::Color fcColor;
|
||||||
fcColor.setPackedValue(hGrp->GetUnsigned("PreSelectColor", defColor));
|
fcColor.setPackedValue(hGrp->GetUnsigned("PreSelectColor", defColor));
|
||||||
return fcColor;
|
return fcColor;
|
||||||
@@ -116,26 +132,34 @@ App::Color Preferences::preselectColor()
|
|||||||
|
|
||||||
App::Color Preferences::vertexColor()
|
App::Color Preferences::vertexColor()
|
||||||
{
|
{
|
||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
.GetUserParameter()
|
||||||
GetGroup("Mod/TechDraw/Decorations");
|
.GetGroup("BaseApp")
|
||||||
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/Decorations");
|
||||||
App::Color fcColor;
|
App::Color fcColor;
|
||||||
fcColor.setPackedValue(hGrp->GetUnsigned("VertexColor", 0x000000FF)); //#000000 black
|
fcColor.setPackedValue(hGrp->GetUnsigned("VertexColor", 0x000000FF));//#000000 black
|
||||||
return fcColor;
|
return fcColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
double Preferences::vertexScale()
|
double Preferences::vertexScale()
|
||||||
{
|
{
|
||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
GetGroup("Preferences")->GetGroup("Mod/TechDraw/General");
|
.GetUserParameter()
|
||||||
|
.GetGroup("BaseApp")
|
||||||
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/General");
|
||||||
double result = hGrp->GetFloat("VertexScale", 3.0);
|
double result = hGrp->GetFloat("VertexScale", 3.0);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Preferences::scaleType()
|
int Preferences::scaleType()
|
||||||
{
|
{
|
||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/General");
|
.GetUserParameter()
|
||||||
|
.GetGroup("BaseApp")
|
||||||
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/General");
|
||||||
int result = hGrp->GetInt("DefaultScaleType", 0);
|
int result = hGrp->GetInt("DefaultScaleType", 0);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -143,25 +167,32 @@ int Preferences::scaleType()
|
|||||||
double Preferences::scale()
|
double Preferences::scale()
|
||||||
{
|
{
|
||||||
int prefScaleType = scaleType();
|
int prefScaleType = scaleType();
|
||||||
if (prefScaleType == 0) { //page scale
|
if (prefScaleType == 0) {//page scale
|
||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/General");
|
.GetUserParameter()
|
||||||
|
.GetGroup("BaseApp")
|
||||||
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/General");
|
||||||
return hGrp->GetFloat("DefaultPageScale", 1.0);
|
return hGrp->GetFloat("DefaultPageScale", 1.0);
|
||||||
} else if (prefScaleType == 1) { //custom scale
|
}
|
||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
else if (prefScaleType == 1) {//custom scale
|
||||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/General");
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
|
.GetUserParameter()
|
||||||
|
.GetGroup("BaseApp")
|
||||||
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/General");
|
||||||
return hGrp->GetFloat("DefaultViewScale", 1.0);
|
return hGrp->GetFloat("DefaultViewScale", 1.0);
|
||||||
}
|
}
|
||||||
return 1.0;
|
return 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//lightgray #D3D3D3
|
|
||||||
|
|
||||||
bool Preferences::keepPagesUpToDate()
|
bool Preferences::keepPagesUpToDate()
|
||||||
{
|
{
|
||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
.GetUserParameter()
|
||||||
GetGroup("Mod/TechDraw/General");
|
.GetGroup("BaseApp")
|
||||||
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/General");
|
||||||
bool autoUpdate = hGrp->GetBool("KeepPagesUpToDate", true);
|
bool autoUpdate = hGrp->GetBool("KeepPagesUpToDate", true);
|
||||||
return autoUpdate;
|
return autoUpdate;
|
||||||
}
|
}
|
||||||
@@ -169,45 +200,55 @@ bool Preferences::keepPagesUpToDate()
|
|||||||
bool Preferences::useGlobalDecimals()
|
bool Preferences::useGlobalDecimals()
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
GetUserParameter().GetGroup("BaseApp")->
|
.GetUserParameter()
|
||||||
GetGroup("Preferences")->GetGroup("Mod/TechDraw/Dimensions");
|
.GetGroup("BaseApp")
|
||||||
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/Dimensions");
|
||||||
result = hGrp->GetBool("UseGlobalDecimals", true);
|
result = hGrp->GetBool("UseGlobalDecimals", true);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Preferences::projectionAngle()
|
int Preferences::projectionAngle()
|
||||||
{
|
{
|
||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
.GetUserParameter()
|
||||||
GetGroup("Mod/TechDraw/General");
|
.GetGroup("BaseApp")
|
||||||
int projType = hGrp->GetInt("ProjectionAngle", 0); //First Angle
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/General");
|
||||||
|
int projType = hGrp->GetInt("ProjectionAngle", 0);//First Angle
|
||||||
return projType;
|
return projType;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Preferences::lineGroup()
|
int Preferences::lineGroup()
|
||||||
{
|
{
|
||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
.GetUserParameter()
|
||||||
GetGroup("Mod/TechDraw/Decorations");
|
.GetGroup("BaseApp")
|
||||||
int lgInt = hGrp->GetInt("LineGroup", 3); // FC 0.70mm
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/Decorations");
|
||||||
|
int lgInt = hGrp->GetInt("LineGroup", 3);// FC 0.70mm
|
||||||
return lgInt;
|
return lgInt;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Preferences::balloonArrow()
|
int Preferences::balloonArrow()
|
||||||
{
|
{
|
||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
.GetUserParameter()
|
||||||
GetGroup("Mod/TechDraw/Decorations");
|
.GetGroup("BaseApp")
|
||||||
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/Decorations");
|
||||||
int end = hGrp->GetInt("BalloonArrow", 0);
|
int end = hGrp->GetInt("BalloonArrow", 0);
|
||||||
return end;
|
return end;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Preferences::defaultTemplate()
|
QString Preferences::defaultTemplate()
|
||||||
{
|
{
|
||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
.GetUserParameter()
|
||||||
GetGroup("Mod/TechDraw/Files");
|
.GetGroup("BaseApp")
|
||||||
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/Files");
|
||||||
std::string defaultDir = App::Application::getResourceDir() + "Mod/TechDraw/Templates/";
|
std::string defaultDir = App::Application::getResourceDir() + "Mod/TechDraw/Templates/";
|
||||||
std::string defaultFileName = defaultDir + "A4_LandscapeTD.svg";
|
std::string defaultFileName = defaultDir + "A4_LandscapeTD.svg";
|
||||||
std::string prefFileName = hGrp->GetASCII("TemplateFile", defaultFileName.c_str());
|
std::string prefFileName = hGrp->GetASCII("TemplateFile", defaultFileName.c_str());
|
||||||
@@ -225,8 +266,11 @@ QString Preferences::defaultTemplate()
|
|||||||
|
|
||||||
QString Preferences::defaultTemplateDir()
|
QString Preferences::defaultTemplateDir()
|
||||||
{
|
{
|
||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Files");
|
.GetUserParameter()
|
||||||
|
.GetGroup("BaseApp")
|
||||||
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/Files");
|
||||||
|
|
||||||
std::string defaultDir = App::Application::getResourceDir() + "Mod/TechDraw/Templates";
|
std::string defaultDir = App::Application::getResourceDir() + "Mod/TechDraw/Templates";
|
||||||
std::string prefTemplateDir = hGrp->GetASCII("TemplateDir", defaultDir.c_str());
|
std::string prefTemplateDir = hGrp->GetASCII("TemplateDir", defaultDir.c_str());
|
||||||
@@ -236,17 +280,20 @@ QString Preferences::defaultTemplateDir()
|
|||||||
QString templateDir = QString::fromStdString(prefTemplateDir);
|
QString templateDir = QString::fromStdString(prefTemplateDir);
|
||||||
Base::FileInfo fi(prefTemplateDir);
|
Base::FileInfo fi(prefTemplateDir);
|
||||||
if (!fi.isReadable()) {
|
if (!fi.isReadable()) {
|
||||||
Base::Console().Warning("Template Directory: %s is not readable\n", prefTemplateDir.c_str());
|
Base::Console().Warning("Template Directory: %s is not readable\n",
|
||||||
|
prefTemplateDir.c_str());
|
||||||
templateDir = QString::fromStdString(defaultDir);
|
templateDir = QString::fromStdString(defaultDir);
|
||||||
}
|
}
|
||||||
return templateDir;
|
return templateDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Preferences::lineGroupFile()
|
std::string Preferences::lineGroupFile()
|
||||||
{
|
{
|
||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
GetUserParameter().GetGroup("BaseApp")->
|
.GetUserParameter()
|
||||||
GetGroup("Preferences")->GetGroup("Mod/TechDraw/Files");
|
.GetGroup("BaseApp")
|
||||||
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/Files");
|
||||||
std::string defaultDir = App::Application::getResourceDir() + "Mod/TechDraw/LineGroup/";
|
std::string defaultDir = App::Application::getResourceDir() + "Mod/TechDraw/LineGroup/";
|
||||||
std::string defaultFileName = defaultDir + "LineGroup.csv";
|
std::string defaultFileName = defaultDir + "LineGroup.csv";
|
||||||
std::string lgFileName = hGrp->GetASCII("LineGroupFile", defaultFileName.c_str());
|
std::string lgFileName = hGrp->GetASCII("LineGroupFile", defaultFileName.c_str());
|
||||||
@@ -263,31 +310,42 @@ std::string Preferences::lineGroupFile()
|
|||||||
|
|
||||||
std::string Preferences::formatSpec()
|
std::string Preferences::formatSpec()
|
||||||
{
|
{
|
||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Dimensions");
|
.GetUserParameter()
|
||||||
|
.GetGroup("BaseApp")
|
||||||
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/Dimensions");
|
||||||
return hGrp->GetASCII("formatSpec", "%.2w");
|
return hGrp->GetASCII("formatSpec", "%.2w");
|
||||||
}
|
}
|
||||||
|
|
||||||
int Preferences::altDecimals()
|
int Preferences::altDecimals()
|
||||||
{
|
{
|
||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Dimensions");
|
.GetUserParameter()
|
||||||
|
.GetGroup("BaseApp")
|
||||||
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/Dimensions");
|
||||||
return hGrp->GetInt("AltDecimals", 2);
|
return hGrp->GetInt("AltDecimals", 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Preferences::mattingStyle()
|
int Preferences::mattingStyle()
|
||||||
{
|
{
|
||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
.GetUserParameter()
|
||||||
GetGroup("Mod/TechDraw/Decorations");
|
.GetGroup("BaseApp")
|
||||||
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/Decorations");
|
||||||
int style = hGrp->GetInt("MattingStyle", 0);
|
int style = hGrp->GetInt("MattingStyle", 0);
|
||||||
return style;
|
return style;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Preferences::svgFile()
|
std::string Preferences::svgFile()
|
||||||
{
|
{
|
||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Files");
|
.GetUserParameter()
|
||||||
|
.GetGroup("BaseApp")
|
||||||
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/Files");
|
||||||
|
|
||||||
std::string defaultDir = App::Application::getResourceDir() + "Mod/TechDraw/Patterns/";
|
std::string defaultDir = App::Application::getResourceDir() + "Mod/TechDraw/Patterns/";
|
||||||
std::string defaultFileName = defaultDir + "simple.svg";
|
std::string defaultFileName = defaultDir + "simple.svg";
|
||||||
@@ -305,8 +363,11 @@ std::string Preferences::svgFile()
|
|||||||
|
|
||||||
std::string Preferences::patFile()
|
std::string Preferences::patFile()
|
||||||
{
|
{
|
||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/PAT");
|
.GetUserParameter()
|
||||||
|
.GetGroup("BaseApp")
|
||||||
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/PAT");
|
||||||
|
|
||||||
std::string defaultDir = App::Application::getResourceDir() + "Mod/TechDraw/PAT/";
|
std::string defaultDir = App::Application::getResourceDir() + "Mod/TechDraw/PAT/";
|
||||||
std::string defaultFileName = defaultDir + "FCPAT.pat";
|
std::string defaultFileName = defaultDir + "FCPAT.pat";
|
||||||
@@ -325,8 +386,11 @@ std::string Preferences::patFile()
|
|||||||
|
|
||||||
std::string Preferences::bitmapFill()
|
std::string Preferences::bitmapFill()
|
||||||
{
|
{
|
||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Files");
|
.GetUserParameter()
|
||||||
|
.GetGroup("BaseApp")
|
||||||
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/Files");
|
||||||
|
|
||||||
std::string defaultDir = App::Application::getResourceDir() + "Mod/TechDraw/Patterns/";
|
std::string defaultDir = App::Application::getResourceDir() + "Mod/TechDraw/Patterns/";
|
||||||
std::string defaultFileName = defaultDir + "default.png";
|
std::string defaultFileName = defaultDir + "default.png";
|
||||||
@@ -344,27 +408,130 @@ std::string Preferences::bitmapFill()
|
|||||||
|
|
||||||
double Preferences::GapISO()
|
double Preferences::GapISO()
|
||||||
{
|
{
|
||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
.GetGroup("BaseApp")->GetGroup("Preferences")->
|
.GetUserParameter()
|
||||||
GetGroup("Mod/TechDraw/Dimensions");
|
.GetGroup("BaseApp")
|
||||||
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/Dimensions");
|
||||||
double factor = hGrp->GetFloat("GapISO", 8.0);
|
double factor = hGrp->GetFloat("GapISO", 8.0);
|
||||||
return factor;
|
return factor;
|
||||||
}
|
}
|
||||||
|
|
||||||
double Preferences::GapASME()
|
double Preferences::GapASME()
|
||||||
{
|
{
|
||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
.GetGroup("BaseApp")->GetGroup("Preferences")->
|
.GetUserParameter()
|
||||||
GetGroup("Mod/TechDraw/Dimensions");
|
.GetGroup("BaseApp")
|
||||||
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/Dimensions");
|
||||||
double factor = hGrp->GetFloat("GapASME", 6.0);
|
double factor = hGrp->GetFloat("GapASME", 6.0);
|
||||||
return factor;
|
return factor;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Preferences::reportProgress()
|
bool Preferences::reportProgress()
|
||||||
{
|
{
|
||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
.GetUserParameter()
|
||||||
GetGroup("Mod/TechDraw/General");
|
.GetGroup("BaseApp")
|
||||||
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/General");
|
||||||
bool report = hGrp->GetBool("ReportProgress", false);
|
bool report = hGrp->GetBool("ReportProgress", false);
|
||||||
return report;
|
return report;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Preferences::lightOnDark()
|
||||||
|
{
|
||||||
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
|
.GetUserParameter()
|
||||||
|
.GetGroup("BaseApp")
|
||||||
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/Colors");
|
||||||
|
bool light = hGrp->GetBool("LightOnDark", false);
|
||||||
|
return light;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Preferences::lightOnDark(bool state)
|
||||||
|
{
|
||||||
|
Base::Console().Message("Pref::useLightText - set to %d\n", state);
|
||||||
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
|
.GetUserParameter()
|
||||||
|
.GetGroup("BaseApp")
|
||||||
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/Colors");
|
||||||
|
hGrp->SetBool("LightOnDark", state);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Preferences::monochrome()
|
||||||
|
{
|
||||||
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
|
.GetUserParameter()
|
||||||
|
.GetGroup("BaseApp")
|
||||||
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/Colors");
|
||||||
|
bool mono = hGrp->GetBool("Monochrome", false);
|
||||||
|
return mono;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Preferences::monochrome(bool state)
|
||||||
|
{
|
||||||
|
Base::Console().Message("Pref::useLightText - set to %d\n", state);
|
||||||
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
|
.GetUserParameter()
|
||||||
|
.GetGroup("BaseApp")
|
||||||
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/Colors");
|
||||||
|
hGrp->SetBool("Monochrome", state);
|
||||||
|
}
|
||||||
|
|
||||||
|
App::Color Preferences::lightTextColor()
|
||||||
|
{
|
||||||
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
|
.GetUserParameter()
|
||||||
|
.GetGroup("BaseApp")
|
||||||
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/Colors");
|
||||||
|
App::Color result;
|
||||||
|
result.setPackedValue(hGrp->GetUnsigned("LightTextColor", 0xFFFFFFFF));//#FFFFFFFF white
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
App::Color Preferences::lightenColor(App::Color orig)
|
||||||
|
{
|
||||||
|
// get component colours on [0, 255]
|
||||||
|
uchar red = orig.r * 255;
|
||||||
|
uchar blue = orig.b * 255;
|
||||||
|
uchar green = orig.g * 255;
|
||||||
|
// uchar alpha = orig.a * 255;
|
||||||
|
|
||||||
|
// shift color values
|
||||||
|
uchar m = std::min({red, blue, green});
|
||||||
|
red -= m;
|
||||||
|
blue -= m;
|
||||||
|
green -= m;
|
||||||
|
|
||||||
|
// calculate chroma (colour range)
|
||||||
|
uchar chroma = std::max({red, blue, green});
|
||||||
|
|
||||||
|
// calculate lightened colour value
|
||||||
|
uchar newm = 255 - chroma - m;
|
||||||
|
red += newm;
|
||||||
|
green += newm;
|
||||||
|
blue += newm;
|
||||||
|
|
||||||
|
double redF = (float)red / 255.0;
|
||||||
|
double greenF = (float)green / 255.0;
|
||||||
|
double blueF = (float)blue / 255.0;
|
||||||
|
|
||||||
|
return App::Color(redF, greenF, blueF, orig.a);
|
||||||
|
}
|
||||||
|
|
||||||
|
App::Color Preferences::getAccessibleColor(App::Color orig)
|
||||||
|
{
|
||||||
|
if (Preferences::lightOnDark() && Preferences::monochrome()) {
|
||||||
|
return lightTextColor();
|
||||||
|
}
|
||||||
|
if (Preferences::lightOnDark()) {
|
||||||
|
return lightenColor(orig);
|
||||||
|
}
|
||||||
|
return orig;
|
||||||
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
|
|
||||||
class QString;
|
class QString;
|
||||||
|
class QColor;
|
||||||
|
|
||||||
namespace App
|
namespace App
|
||||||
{
|
{
|
||||||
@@ -39,50 +40,59 @@ namespace TechDraw
|
|||||||
{
|
{
|
||||||
|
|
||||||
//getters for parameters used in multiple places.
|
//getters for parameters used in multiple places.
|
||||||
class TechDrawExport Preferences {
|
class TechDrawExport Preferences
|
||||||
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static std::string labelFont();
|
static std::string labelFont();
|
||||||
static QString labelFontQString();
|
static QString labelFontQString();
|
||||||
static double labelFontSizeMM();
|
static double labelFontSizeMM();
|
||||||
static double dimFontSizeMM();
|
static double dimFontSizeMM();
|
||||||
|
|
||||||
static App::Color normalColor();
|
static App::Color normalColor();
|
||||||
static App::Color selectColor();
|
static App::Color selectColor();
|
||||||
static App::Color preselectColor();
|
static App::Color preselectColor();
|
||||||
static App::Color vertexColor();
|
static App::Color vertexColor();
|
||||||
static double vertexScale();
|
static double vertexScale();
|
||||||
static int scaleType();
|
static int scaleType();
|
||||||
static double scale();
|
static double scale();
|
||||||
static bool useGlobalDecimals();
|
static bool useGlobalDecimals();
|
||||||
static bool keepPagesUpToDate();
|
static bool keepPagesUpToDate();
|
||||||
|
|
||||||
static int projectionAngle();
|
static int projectionAngle();
|
||||||
static int lineGroup();
|
static int lineGroup();
|
||||||
|
|
||||||
static int balloonArrow();
|
static int balloonArrow();
|
||||||
|
|
||||||
static QString defaultTemplate();
|
static QString defaultTemplate();
|
||||||
static QString defaultTemplateDir();
|
static QString defaultTemplateDir();
|
||||||
static std::string lineGroupFile();
|
static std::string lineGroupFile();
|
||||||
|
|
||||||
static const double DefaultFontSizeInMM;
|
static const double DefaultFontSizeInMM;
|
||||||
|
|
||||||
static std::string formatSpec();
|
static std::string formatSpec();
|
||||||
static int altDecimals();
|
static int altDecimals();
|
||||||
|
|
||||||
static int mattingStyle();
|
static int mattingStyle();
|
||||||
|
|
||||||
static std::string svgFile();
|
static std::string svgFile();
|
||||||
static std::string patFile();
|
static std::string patFile();
|
||||||
|
|
||||||
static std::string bitmapFill();
|
static std::string bitmapFill();
|
||||||
|
|
||||||
static double GapISO();
|
static double GapISO();
|
||||||
static double GapASME();
|
static double GapASME();
|
||||||
|
|
||||||
static bool reportProgress();
|
static bool reportProgress();
|
||||||
|
|
||||||
|
static bool lightOnDark();
|
||||||
|
static void lightOnDark(bool state);
|
||||||
|
static bool monochrome();
|
||||||
|
static void monochrome(bool state);
|
||||||
|
static App::Color lightTextColor();
|
||||||
|
static App::Color lightenColor(App::Color orig);
|
||||||
|
static App::Color getAccessibleColor(App::Color orig);
|
||||||
};
|
};
|
||||||
|
|
||||||
} //end namespace TechDraw
|
}//end namespace TechDraw
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ set(TechDrawGui_LIBS
|
|||||||
qt_add_resources(TechDrawGui_SRCS Resources/TechDraw.qrc)
|
qt_add_resources(TechDrawGui_SRCS Resources/TechDraw.qrc)
|
||||||
|
|
||||||
set(TechDrawGui_UIC_SRCS
|
set(TechDrawGui_UIC_SRCS
|
||||||
|
DlgStringListEditor.ui
|
||||||
DlgPageChooser.ui
|
DlgPageChooser.ui
|
||||||
DlgPrefsTechDrawAdvanced.ui
|
DlgPrefsTechDrawAdvanced.ui
|
||||||
DlgPrefsTechDrawAnnotation.ui
|
DlgPrefsTechDrawAnnotation.ui
|
||||||
@@ -115,6 +116,9 @@ SET(TechDrawGui_SRCS
|
|||||||
TaskProjGroup.ui
|
TaskProjGroup.ui
|
||||||
TaskProjGroup.cpp
|
TaskProjGroup.cpp
|
||||||
TaskProjGroup.h
|
TaskProjGroup.h
|
||||||
|
DlgStringListEditor.ui
|
||||||
|
DlgStringListEditor.cpp
|
||||||
|
DlgStringListEditor.h
|
||||||
DlgPageChooser.ui
|
DlgPageChooser.ui
|
||||||
DlgPageChooser.cpp
|
DlgPageChooser.cpp
|
||||||
DlgPageChooser.h
|
DlgPageChooser.h
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>440</width>
|
<width>440</width>
|
||||||
<height>368</height>
|
<height>400</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@@ -49,63 +49,19 @@
|
|||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="0">
|
<item row="10" column="1">
|
||||||
<widget class="QLabel" name="lbl_Normal">
|
<widget class="Gui::PrefColorButton" name="pcbLightTextColor">
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<italic>true</italic>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Normal</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="Gui::PrefColorButton" name="pcb_Normal">
|
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Normal line color</string>
|
<string>Monochrome text color</string>
|
||||||
</property>
|
|
||||||
<property name="color">
|
|
||||||
<color>
|
|
||||||
<red>0</red>
|
|
||||||
<green>0</green>
|
|
||||||
<blue>0</blue>
|
|
||||||
</color>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="prefEntry" stdset="0">
|
<property name="prefEntry" stdset="0">
|
||||||
<cstring>NormalColor</cstring>
|
<cstring>LightTextColor</cstring>
|
||||||
</property>
|
</property>
|
||||||
<property name="prefPath" stdset="0">
|
<property name="prefPath" stdset="0">
|
||||||
<cstring>Mod/TechDraw/Colors</cstring>
|
<cstring>Mod/TechDraw/Colors</cstring>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
|
||||||
<spacer name="horizontalSpacer_3">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="3">
|
|
||||||
<widget class="QLabel" name="lbl_Hidden">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<italic>true</italic>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Hidden Line</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="4">
|
<item row="0" column="4">
|
||||||
<widget class="Gui::PrefColorButton" name="pcb_Hidden">
|
<widget class="Gui::PrefColorButton" name="pcb_Hidden">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
@@ -126,114 +82,8 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="6" column="1">
|
||||||
<widget class="QLabel" name="lbl_PreSelect">
|
<widget class="Gui::PrefColorButton" name="pcbHighlight">
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<italic>true</italic>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Preselected</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="Gui::PrefColorButton" name="pcb_PreSelect">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Preselection color</string>
|
|
||||||
</property>
|
|
||||||
<property name="color">
|
|
||||||
<color>
|
|
||||||
<red>255</red>
|
|
||||||
<green>255</green>
|
|
||||||
<blue>0</blue>
|
|
||||||
</color>
|
|
||||||
</property>
|
|
||||||
<property name="prefEntry" stdset="0">
|
|
||||||
<cstring>PreSelectColor</cstring>
|
|
||||||
</property>
|
|
||||||
<property name="prefPath" stdset="0">
|
|
||||||
<cstring>Mod/TechDraw/Colors</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="3">
|
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<italic>true</italic>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Section Face</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="4">
|
|
||||||
<widget class="Gui::PrefColorButton" name="pcb_Surface">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Section face color</string>
|
|
||||||
</property>
|
|
||||||
<property name="color">
|
|
||||||
<color>
|
|
||||||
<red>211</red>
|
|
||||||
<green>211</green>
|
|
||||||
<blue>211</blue>
|
|
||||||
</color>
|
|
||||||
</property>
|
|
||||||
<property name="prefEntry" stdset="0">
|
|
||||||
<cstring>CutSurfaceColor</cstring>
|
|
||||||
</property>
|
|
||||||
<property name="prefPath" stdset="0">
|
|
||||||
<cstring>Mod/TechDraw/Colors</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="lbl_Select">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<italic>true</italic>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Selected</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="Gui::PrefColorButton" name="pcb_Select">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Selected item color</string>
|
|
||||||
</property>
|
|
||||||
<property name="color">
|
|
||||||
<color>
|
|
||||||
<red>0</red>
|
|
||||||
<green>255</green>
|
|
||||||
<blue>0</blue>
|
|
||||||
</color>
|
|
||||||
</property>
|
|
||||||
<property name="prefEntry" stdset="0">
|
|
||||||
<cstring>SelectColor</cstring>
|
|
||||||
</property>
|
|
||||||
<property name="prefPath" stdset="0">
|
|
||||||
<cstring>Mod/TechDraw/Colors</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="3">
|
|
||||||
<widget class="QLabel" name="label_14">
|
|
||||||
<property name="text">
|
|
||||||
<string>Section Line</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="4">
|
|
||||||
<widget class="Gui::PrefColorButton" name="pcbSectionLine">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Section line color</string>
|
|
||||||
</property>
|
|
||||||
<property name="color">
|
<property name="color">
|
||||||
<color>
|
<color>
|
||||||
<red>0</red>
|
<red>0</red>
|
||||||
@@ -242,84 +92,13 @@
|
|||||||
</color>
|
</color>
|
||||||
</property>
|
</property>
|
||||||
<property name="prefEntry" stdset="0">
|
<property name="prefEntry" stdset="0">
|
||||||
<cstring>SectionColor</cstring>
|
<cstring>HighlightColor</cstring>
|
||||||
</property>
|
</property>
|
||||||
<property name="prefPath" stdset="0">
|
<property name="prefPath" stdset="0">
|
||||||
<cstring>/Mod/TechDraw/Decorations</cstring>
|
<cstring>/Mod/TechDraw/Decorations</cstring>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
|
||||||
<widget class="QLabel" name="label_4">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<italic>true</italic>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Background</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1">
|
|
||||||
<widget class="Gui::PrefColorButton" name="pcb_Background">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Background color around pages</string>
|
|
||||||
</property>
|
|
||||||
<property name="color">
|
|
||||||
<color>
|
|
||||||
<red>211</red>
|
|
||||||
<green>211</green>
|
|
||||||
<blue>211</blue>
|
|
||||||
</color>
|
|
||||||
</property>
|
|
||||||
<property name="prefEntry" stdset="0">
|
|
||||||
<cstring>Background</cstring>
|
|
||||||
</property>
|
|
||||||
<property name="prefPath" stdset="0">
|
|
||||||
<cstring>/Mod/TechDraw/Colors</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="3">
|
|
||||||
<widget class="QLabel" name="label_5">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<italic>true</italic>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Hatch</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="4">
|
|
||||||
<widget class="Gui::PrefColorButton" name="pcb_Hatch">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Hatch image color</string>
|
|
||||||
</property>
|
|
||||||
<property name="color">
|
|
||||||
<color>
|
|
||||||
<red>0</red>
|
|
||||||
<green>0</green>
|
|
||||||
<blue>0</blue>
|
|
||||||
</color>
|
|
||||||
</property>
|
|
||||||
<property name="prefEntry" stdset="0">
|
|
||||||
<cstring>Hatch</cstring>
|
|
||||||
</property>
|
|
||||||
<property name="prefPath" stdset="0">
|
|
||||||
<cstring>/Mod/TechDraw/Colors</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0">
|
|
||||||
<widget class="QLabel" name="label_13">
|
|
||||||
<property name="text">
|
|
||||||
<string>Dimension</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="1">
|
<item row="4" column="1">
|
||||||
<widget class="Gui::PrefColorButton" name="pcbDimColor">
|
<widget class="Gui::PrefColorButton" name="pcbDimColor">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
@@ -340,6 +119,200 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<italic>true</italic>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Background</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="lbl_PreSelect">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<italic>true</italic>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Preselected</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Grid Color</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="0">
|
||||||
|
<widget class="QLabel" name="label_18">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<italic>true</italic>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Detail Highlight</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="lbl_Select">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<italic>true</italic>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Selected</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="9" column="0">
|
||||||
|
<widget class="Gui::PrefCheckBox" name="pcbLightOnDark">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Check this to use light text and lines on dark backgrounds. Set Page Color to a dark color. Transparent or light color faces are recommended with this option.</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Light on dark</string>
|
||||||
|
</property>
|
||||||
|
<property name="prefEntry" stdset="0">
|
||||||
|
<cstring>LightOnDark</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="prefPath" stdset="0">
|
||||||
|
<cstring>/Mod/TechDraw/Colors</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="4">
|
||||||
|
<widget class="Gui::PrefColorButton" name="pcb_Hatch">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Hatch image color</string>
|
||||||
|
</property>
|
||||||
|
<property name="color">
|
||||||
|
<color>
|
||||||
|
<red>0</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
</color>
|
||||||
|
</property>
|
||||||
|
<property name="prefEntry" stdset="0">
|
||||||
|
<cstring>Hatch</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="prefPath" stdset="0">
|
||||||
|
<cstring>/Mod/TechDraw/Colors</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="4">
|
||||||
|
<widget class="Gui::PrefColorButton" name="pcbMarkup">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Default color for leader lines</string>
|
||||||
|
</property>
|
||||||
|
<property name="color">
|
||||||
|
<color>
|
||||||
|
<red>0</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
</color>
|
||||||
|
</property>
|
||||||
|
<property name="prefEntry" stdset="0">
|
||||||
|
<cstring>Color</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="prefPath" stdset="0">
|
||||||
|
<cstring>Mod/TechDraw/Markups</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="10" column="3">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Page Color</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="Gui::PrefColorButton" name="pcb_Background">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Background color around pages</string>
|
||||||
|
</property>
|
||||||
|
<property name="color">
|
||||||
|
<color>
|
||||||
|
<red>211</red>
|
||||||
|
<green>211</green>
|
||||||
|
<blue>211</blue>
|
||||||
|
</color>
|
||||||
|
</property>
|
||||||
|
<property name="prefEntry" stdset="0">
|
||||||
|
<cstring>Background</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="prefPath" stdset="0">
|
||||||
|
<cstring>/Mod/TechDraw/Colors</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="3">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<italic>true</italic>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Section Face</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="3">
|
||||||
|
<widget class="QLabel" name="label_14">
|
||||||
|
<property name="text">
|
||||||
|
<string>Section Line</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<widget class="QLabel" name="label_15">
|
||||||
|
<property name="text">
|
||||||
|
<string>Centerline</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="1">
|
||||||
|
<widget class="Gui::PrefColorButton" name="pcb_Grid">
|
||||||
|
<property name="color">
|
||||||
|
<color>
|
||||||
|
<red>0</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
</color>
|
||||||
|
</property>
|
||||||
|
<property name="prefEntry" stdset="0">
|
||||||
|
<cstring>gridColor</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="prefPath" stdset="0">
|
||||||
|
<cstring>/Mod/TechDraw/Colors</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<spacer name="horizontalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
<item row="4" column="3">
|
<item row="4" column="3">
|
||||||
<widget class="QLabel" name="label_7">
|
<widget class="QLabel" name="label_7">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
@@ -352,10 +325,34 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="4">
|
<item row="6" column="3">
|
||||||
<widget class="Gui::PrefColorButton" name="pcb_GeomHatch">
|
<widget class="QLabel" name="label_17">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<italic>true</italic>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Leaderline</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="3">
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<italic>true</italic>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Hatch</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="4">
|
||||||
|
<widget class="Gui::PrefColorButton" name="pcbSectionLine">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Geometric hatch pattern color</string>
|
<string>Section line color</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="color">
|
<property name="color">
|
||||||
<color>
|
<color>
|
||||||
@@ -365,17 +362,102 @@
|
|||||||
</color>
|
</color>
|
||||||
</property>
|
</property>
|
||||||
<property name="prefEntry" stdset="0">
|
<property name="prefEntry" stdset="0">
|
||||||
<cstring>GeomHatch</cstring>
|
<cstring>SectionColor</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="prefPath" stdset="0">
|
||||||
|
<cstring>/Mod/TechDraw/Decorations</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="4">
|
||||||
|
<widget class="Gui::PrefColorButton" name="pcb_Face">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Face color (if not transparent)</string>
|
||||||
|
</property>
|
||||||
|
<property name="color">
|
||||||
|
<color>
|
||||||
|
<red>255</red>
|
||||||
|
<green>255</green>
|
||||||
|
<blue>255</blue>
|
||||||
|
</color>
|
||||||
|
</property>
|
||||||
|
<property name="prefEntry" stdset="0">
|
||||||
|
<cstring>FaceColor</cstring>
|
||||||
</property>
|
</property>
|
||||||
<property name="prefPath" stdset="0">
|
<property name="prefPath" stdset="0">
|
||||||
<cstring>/Mod/TechDraw/Colors</cstring>
|
<cstring>/Mod/TechDraw/Colors</cstring>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0">
|
<item row="1" column="1">
|
||||||
<widget class="QLabel" name="label_15">
|
<widget class="Gui::PrefColorButton" name="pcb_PreSelect">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Preselection color</string>
|
||||||
|
</property>
|
||||||
|
<property name="color">
|
||||||
|
<color>
|
||||||
|
<red>255</red>
|
||||||
|
<green>255</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
</color>
|
||||||
|
</property>
|
||||||
|
<property name="prefEntry" stdset="0">
|
||||||
|
<cstring>PreSelectColor</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="prefPath" stdset="0">
|
||||||
|
<cstring>Mod/TechDraw/Colors</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="3">
|
||||||
|
<widget class="QLabel" name="lbl_Hidden">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<italic>true</italic>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Centerline</string>
|
<string>Hidden Line</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="10" column="4">
|
||||||
|
<widget class="Gui::PrefColorButton" name="pcbPageColor">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Use a light color for dark text and dark color for light text.</string>
|
||||||
|
</property>
|
||||||
|
<property name="color">
|
||||||
|
<color>
|
||||||
|
<red>255</red>
|
||||||
|
<green>255</green>
|
||||||
|
<blue>255</blue>
|
||||||
|
</color>
|
||||||
|
</property>
|
||||||
|
<property name="prefEntry" stdset="0">
|
||||||
|
<cstring>PageColor</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="prefPath" stdset="0">
|
||||||
|
<cstring>Mod/TechDraw/Colors</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="Gui::PrefColorButton" name="pcb_Select">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Selected item color</string>
|
||||||
|
</property>
|
||||||
|
<property name="color">
|
||||||
|
<color>
|
||||||
|
<red>0</red>
|
||||||
|
<green>255</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
</color>
|
||||||
|
</property>
|
||||||
|
<property name="prefEntry" stdset="0">
|
||||||
|
<cstring>SelectColor</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="prefPath" stdset="0">
|
||||||
|
<cstring>Mod/TechDraw/Colors</cstring>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -406,6 +488,46 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="Gui::PrefColorButton" name="pcb_Normal">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Normal line color</string>
|
||||||
|
</property>
|
||||||
|
<property name="color">
|
||||||
|
<color>
|
||||||
|
<red>0</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
</color>
|
||||||
|
</property>
|
||||||
|
<property name="prefEntry" stdset="0">
|
||||||
|
<cstring>NormalColor</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="prefPath" stdset="0">
|
||||||
|
<cstring>Mod/TechDraw/Colors</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="4">
|
||||||
|
<widget class="Gui::PrefColorButton" name="pcb_Surface">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Section face color</string>
|
||||||
|
</property>
|
||||||
|
<property name="color">
|
||||||
|
<color>
|
||||||
|
<red>211</red>
|
||||||
|
<green>211</green>
|
||||||
|
<blue>211</blue>
|
||||||
|
</color>
|
||||||
|
</property>
|
||||||
|
<property name="prefEntry" stdset="0">
|
||||||
|
<cstring>CutSurfaceColor</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="prefPath" stdset="0">
|
||||||
|
<cstring>Mod/TechDraw/Colors</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="5" column="4">
|
<item row="5" column="4">
|
||||||
<widget class="Gui::PrefColorButton" name="pcbVertexColor">
|
<widget class="Gui::PrefColorButton" name="pcbVertexColor">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
@@ -426,92 +548,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0">
|
<item row="7" column="3">
|
||||||
<widget class="QLabel" name="label_18">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<italic>true</italic>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Detail Highlight</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="1">
|
|
||||||
<widget class="Gui::PrefColorButton" name="pcbHighlight">
|
|
||||||
<property name="color">
|
|
||||||
<color>
|
|
||||||
<red>0</red>
|
|
||||||
<green>0</green>
|
|
||||||
<blue>0</blue>
|
|
||||||
</color>
|
|
||||||
</property>
|
|
||||||
<property name="prefEntry" stdset="0">
|
|
||||||
<cstring>HighlightColor</cstring>
|
|
||||||
</property>
|
|
||||||
<property name="prefPath" stdset="0">
|
|
||||||
<cstring>/Mod/TechDraw/Decorations</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="3">
|
|
||||||
<widget class="QLabel" name="label_17">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<italic>true</italic>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Leaderline</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="4">
|
|
||||||
<widget class="Gui::PrefColorButton" name="pcbMarkup">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Default color for leader lines</string>
|
|
||||||
</property>
|
|
||||||
<property name="color">
|
|
||||||
<color>
|
|
||||||
<red>0</red>
|
|
||||||
<green>0</green>
|
|
||||||
<blue>0</blue>
|
|
||||||
</color>
|
|
||||||
</property>
|
|
||||||
<property name="prefEntry" stdset="0">
|
|
||||||
<cstring>Color</cstring>
|
|
||||||
</property>
|
|
||||||
<property name="prefPath" stdset="0">
|
|
||||||
<cstring>Mod/TechDraw/Markups</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="7" column="0">
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Grid Color</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="7" column="1">
|
|
||||||
<widget class="Gui::PrefColorButton" name="pcb_Grid">
|
|
||||||
<property name="color">
|
|
||||||
<color>
|
|
||||||
<red>0</red>
|
|
||||||
<green>0</green>
|
|
||||||
<blue>0</blue>
|
|
||||||
</color>
|
|
||||||
</property>
|
|
||||||
<property name="prefEntry" stdset="0">
|
|
||||||
<cstring>gridColor</cstring>
|
|
||||||
</property>
|
|
||||||
<property name="prefPath" stdset="0">
|
|
||||||
<cstring>/Mod/TechDraw/Colors</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="8" column="0">
|
|
||||||
<widget class="Gui::PrefCheckBox" name="pcb_PaintFaces">
|
<widget class="Gui::PrefCheckBox" name="pcb_PaintFaces">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
@@ -538,27 +575,69 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="1">
|
<item row="4" column="4">
|
||||||
<widget class="Gui::PrefColorButton" name="pcb_Face">
|
<widget class="Gui::PrefColorButton" name="pcb_GeomHatch">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Face color (if not transparent)</string>
|
<string>Geometric hatch pattern color</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="color">
|
<property name="color">
|
||||||
<color>
|
<color>
|
||||||
<red>255</red>
|
<red>0</red>
|
||||||
<green>255</green>
|
<green>0</green>
|
||||||
<blue>255</blue>
|
<blue>0</blue>
|
||||||
</color>
|
</color>
|
||||||
</property>
|
</property>
|
||||||
<property name="prefEntry" stdset="0">
|
<property name="prefEntry" stdset="0">
|
||||||
<cstring>FaceColor</cstring>
|
<cstring>GeomHatch</cstring>
|
||||||
</property>
|
</property>
|
||||||
<property name="prefPath" stdset="0">
|
<property name="prefPath" stdset="0">
|
||||||
<cstring>/Mod/TechDraw/Colors</cstring>
|
<cstring>/Mod/TechDraw/Colors</cstring>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="lbl_Normal">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<italic>true</italic>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Normal</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QLabel" name="label_13">
|
||||||
|
<property name="text">
|
||||||
|
<string>Dimension</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="10" column="0">
|
||||||
|
<widget class="Gui::PrefCheckBox" name="pcbMonochrome">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>If checked FreeCAD will use a single colour for all text and lines. If unchecked FreeCAD will attempt to use lighter versions of preferred colours.</p><p><br/></p><p><br/></p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Monochrome</string>
|
||||||
|
</property>
|
||||||
|
<property name="prefEntry" stdset="0">
|
||||||
|
<cstring>Monochrome</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="prefPath" stdset="0">
|
||||||
|
<cstring>/Mod/TechDraw/Colors</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="8" column="0">
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
@@ -572,7 +651,7 @@
|
|||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><html><head/><body><p><span style=" font-weight:600;">Note:</span> Items in <span style=" font-style:italic;">italics</span> are default values for new objects. They have no effect on existing objects.</p></body></html></string>
|
<string><html><head/><body><p><span style=" font-weight:600;">Note:</span> Items in <span style=" font-style:italic;">italics</span> are default values for new objects. They have no effect on existing objects.</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="wordWrap">
|
<property name="wordWrap">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
|||||||
@@ -61,6 +61,10 @@ void DlgPrefsTechDrawColorsImp::saveSettings()
|
|||||||
ui->pcbMarkup->onSave();
|
ui->pcbMarkup->onSave();
|
||||||
ui->pcbHighlight->onSave();
|
ui->pcbHighlight->onSave();
|
||||||
ui->pcb_Grid->onSave();
|
ui->pcb_Grid->onSave();
|
||||||
|
ui->pcbPageColor->onSave();
|
||||||
|
ui->pcbLightOnDark->onSave();
|
||||||
|
ui->pcbMonochrome->onSave();
|
||||||
|
ui->pcbLightTextColor->onSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlgPrefsTechDrawColorsImp::loadSettings()
|
void DlgPrefsTechDrawColorsImp::loadSettings()
|
||||||
@@ -82,6 +86,10 @@ void DlgPrefsTechDrawColorsImp::loadSettings()
|
|||||||
ui->pcbMarkup->onRestore();
|
ui->pcbMarkup->onRestore();
|
||||||
ui->pcbHighlight->onRestore();
|
ui->pcbHighlight->onRestore();
|
||||||
ui->pcb_Grid->onRestore();
|
ui->pcb_Grid->onRestore();
|
||||||
|
ui->pcbPageColor->onRestore();
|
||||||
|
ui->pcbLightOnDark->onRestore();
|
||||||
|
ui->pcbMonochrome->onRestore();
|
||||||
|
ui->pcbLightTextColor->onRestore();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
140
src/Mod/TechDraw/Gui/DlgStringListEditor.cpp
Normal file
140
src/Mod/TechDraw/Gui/DlgStringListEditor.cpp
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* Copyright (c) 2022 Wanderer Fan <wandererfan@gmail.com> *
|
||||||
|
* *
|
||||||
|
* This file is part of the FreeCAD CAx development system. *
|
||||||
|
* *
|
||||||
|
* This library is free software; you can redistribute it and/or *
|
||||||
|
* modify it under the terms of the GNU Library General Public *
|
||||||
|
* License as published by the Free Software Foundation; either *
|
||||||
|
* version 2 of the License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This library is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU Library General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU Library General Public *
|
||||||
|
* License along with this library; see the file COPYING.LIB. If not, *
|
||||||
|
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||||
|
* Suite 330, Boston, MA 02111-1307, USA *
|
||||||
|
* *
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "PreCompiled.h"
|
||||||
|
#ifndef _PreComp_
|
||||||
|
#include <QList>
|
||||||
|
#include <QListWidgetItem>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <Base/Console.h>// for FC_LOG_LEVEL_INIT
|
||||||
|
#include <Base/Tools.h>
|
||||||
|
|
||||||
|
#include "DlgStringListEditor.h"
|
||||||
|
#include "ui_DlgStringListEditor.h"
|
||||||
|
|
||||||
|
using namespace TechDrawGui;
|
||||||
|
|
||||||
|
/* TRANSLATOR Gui::DlgStringListEditor */
|
||||||
|
|
||||||
|
DlgStringListEditor::DlgStringListEditor(const std::vector<std::string> texts, QWidget* parent,
|
||||||
|
Qt::WindowFlags fl)
|
||||||
|
: QDialog(parent, fl),
|
||||||
|
ui(new Ui_DlgStringListEditor)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
ui->lwTexts->setSortingEnabled(false);
|
||||||
|
|
||||||
|
fillList(texts);
|
||||||
|
|
||||||
|
connect(ui->lwTexts,
|
||||||
|
SIGNAL(itemActivated(QListWidgetItem*)),
|
||||||
|
this,
|
||||||
|
SLOT(slotItemActivated(QListWidgetItem*)));
|
||||||
|
connect(ui->pbAdd, SIGNAL(clicked()), this, SLOT(slotAddItem()));
|
||||||
|
connect(ui->pbRemove, SIGNAL(clicked()), this, SLOT(slotRemoveItem()));
|
||||||
|
connect(ui->bbButtons, SIGNAL(accepted()), this, SLOT(accept()));
|
||||||
|
connect(ui->bbButtons, SIGNAL(rejected()), this, SLOT(reject()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroys the object and frees any allocated resources
|
||||||
|
*/
|
||||||
|
DlgStringListEditor::~DlgStringListEditor()
|
||||||
|
{
|
||||||
|
// no need to delete child widgets, Qt does it all for us
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DlgStringListEditor::fillList(std::vector<std::string> texts)
|
||||||
|
{
|
||||||
|
QString qText;
|
||||||
|
int textCount = texts.size();
|
||||||
|
int i = 0;
|
||||||
|
for (; i < textCount; i++) {
|
||||||
|
qText = Base::Tools::fromStdString(texts[i]);
|
||||||
|
QListWidgetItem* item = new QListWidgetItem(qText);
|
||||||
|
item->setFlags(item->flags() | Qt::ItemIsEditable);
|
||||||
|
ui->lwTexts->addItem(item);
|
||||||
|
}
|
||||||
|
//add a blank line at the end to allow extending the list
|
||||||
|
QListWidgetItem* item = new QListWidgetItem(QString::fromUtf8(""));
|
||||||
|
item->setFlags(item->flags() | Qt::ItemIsEditable);
|
||||||
|
ui->lwTexts->addItem(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DlgStringListEditor::slotItemActivated(QListWidgetItem* item)
|
||||||
|
{
|
||||||
|
ui->lwTexts->editItem(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DlgStringListEditor::slotAddItem()
|
||||||
|
{
|
||||||
|
QString newText = ui->leNewItem->text();
|
||||||
|
QListWidgetItem* item = new QListWidgetItem(newText);
|
||||||
|
item->setFlags(item->flags() | Qt::ItemIsEditable);
|
||||||
|
int row = ui->lwTexts->currentRow();
|
||||||
|
if (row < 0) {
|
||||||
|
//no location set yet, add to end of list
|
||||||
|
ui->lwTexts->addItem(item);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//insert item at current row and push the rest down 1 position
|
||||||
|
ui->lwTexts->insertItem(row, item);
|
||||||
|
}
|
||||||
|
ui->leNewItem->clear();
|
||||||
|
//TODO: how to append to end of list?
|
||||||
|
}
|
||||||
|
|
||||||
|
void DlgStringListEditor::slotRemoveItem()
|
||||||
|
{
|
||||||
|
int row = ui->lwTexts->currentRow();
|
||||||
|
if (row >= 0) {
|
||||||
|
auto item = ui->lwTexts->takeItem(row);
|
||||||
|
delete item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> DlgStringListEditor::getTexts() const
|
||||||
|
{
|
||||||
|
std::vector<std::string> outTexts;
|
||||||
|
for (int iRow = 0; iRow < ui->lwTexts->count(); iRow++) {
|
||||||
|
QString itemText = ui->lwTexts->item(iRow)->text();
|
||||||
|
outTexts.push_back(Base::Tools::toStdString(itemText));
|
||||||
|
}
|
||||||
|
if (outTexts.back().empty()) {
|
||||||
|
outTexts.pop_back();
|
||||||
|
}
|
||||||
|
return outTexts;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DlgStringListEditor::accept()
|
||||||
|
{
|
||||||
|
QDialog::accept();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DlgStringListEditor::reject()
|
||||||
|
{
|
||||||
|
QDialog::reject();
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "moc_DlgStringListEditor.cpp"
|
||||||
62
src/Mod/TechDraw/Gui/DlgStringListEditor.h
Normal file
62
src/Mod/TechDraw/Gui/DlgStringListEditor.h
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* Copyright (c) 2022 Wanderer Fan <wandererfan@gmail.com> *
|
||||||
|
* *
|
||||||
|
* This file is part of the FreeCAD CAx development system. *
|
||||||
|
* *
|
||||||
|
* This library is free software; you can redistribute it and/or *
|
||||||
|
* modify it under the terms of the GNU Library General Public *
|
||||||
|
* License as published by the Free Software Foundation; either *
|
||||||
|
* version 2 of the License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This library is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU Library General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU Library General Public *
|
||||||
|
* License along with this library; see the file COPYING.LIB. If not, *
|
||||||
|
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||||
|
* Suite 330, Boston, MA 02111-1307, USA *
|
||||||
|
* *
|
||||||
|
****************************************************************************/
|
||||||
|
#ifndef GUI_DLGEDITABLETEXT_H
|
||||||
|
#define GUI_DLGEDITABLETEXT_H
|
||||||
|
|
||||||
|
#include <Mod/TechDraw/TechDrawGlobal.h>
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
class QListWidgetItem;
|
||||||
|
|
||||||
|
namespace TechDrawGui {
|
||||||
|
|
||||||
|
class Ui_DlgStringListEditor;
|
||||||
|
class TechDrawGuiExport DlgStringListEditor : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
DlgStringListEditor(const std::vector<std::string> texts,
|
||||||
|
QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags());
|
||||||
|
~DlgStringListEditor();
|
||||||
|
|
||||||
|
std::vector<std::string> getTexts() const;
|
||||||
|
void accept();
|
||||||
|
void reject();
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
void slotItemActivated(QListWidgetItem* item);
|
||||||
|
void slotAddItem();
|
||||||
|
void slotRemoveItem();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void fillList(std::vector<std::string> texts);
|
||||||
|
|
||||||
|
Ui_DlgStringListEditor* ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Gui
|
||||||
|
|
||||||
|
|
||||||
|
#endif // GUI_DLGEDITABLETEXT_H
|
||||||
|
|
||||||
140
src/Mod/TechDraw/Gui/DlgStringListEditor.ui
Normal file
140
src/Mod/TechDraw/Gui/DlgStringListEditor.ui
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>TechDrawGui::DlgStringListEditor</class>
|
||||||
|
<widget class="QDialog" name="TechDrawGui::DlgStringListEditor">
|
||||||
|
<property name="windowModality">
|
||||||
|
<enum>Qt::WindowModal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>360</width>
|
||||||
|
<height>331</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>String List Editor</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="modal">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QListWidget" name="lwTexts">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Double click to edit a line. New lines are added at the current location in the list.</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="editTriggers">
|
||||||
|
<set>QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked</set>
|
||||||
|
</property>
|
||||||
|
<property name="alternatingRowColors">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pbAdd">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset>
|
||||||
|
<normalon>:/icons/list-add.svg</normalon>
|
||||||
|
</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="leNewItem"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pbRemove">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../../Gui/Icons/resource.qrc">
|
||||||
|
<normaloff>:/icons/list-remove.svg</normaloff>:/icons/list-remove.svg</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="bbButtons">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
<property name="centerButtons">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="Resources/TechDraw.qrc"/>
|
||||||
|
<include location="../../../Gui/Icons/resource.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>bbButtons</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>TechDrawGui::DlgStringListEditor</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>179</x>
|
||||||
|
<y>228</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>179</x>
|
||||||
|
<y>139</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>bbButtons</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>TechDrawGui::DlgStringListEditor</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>179</x>
|
||||||
|
<y>228</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>179</x>
|
||||||
|
<y>139</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -91,7 +91,12 @@ App::Color PreferencesGui::sectionLineColor()
|
|||||||
|
|
||||||
QColor PreferencesGui::sectionLineQColor()
|
QColor PreferencesGui::sectionLineQColor()
|
||||||
{
|
{
|
||||||
return sectionLineColor().asValue<QColor>();
|
//if the App::Color version has already lightened the color, we don't want to do it agin
|
||||||
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||||
|
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations");
|
||||||
|
App::Color fcColor;
|
||||||
|
fcColor.setPackedValue(hGrp->GetUnsigned("SectionColor", 0x000000FF));
|
||||||
|
return fcColor.asValue<QColor>();
|
||||||
}
|
}
|
||||||
|
|
||||||
App::Color PreferencesGui::centerColor()
|
App::Color PreferencesGui::centerColor()
|
||||||
@@ -105,7 +110,11 @@ App::Color PreferencesGui::centerColor()
|
|||||||
|
|
||||||
QColor PreferencesGui::centerQColor()
|
QColor PreferencesGui::centerQColor()
|
||||||
{
|
{
|
||||||
return centerColor().asValue<QColor>();
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||||
|
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||||
|
GetGroup("Mod/TechDraw/Decorations");
|
||||||
|
App::Color fcColor = App::Color((uint32_t) hGrp->GetUnsigned("CenterColor", 0x000000FF));
|
||||||
|
return fcColor.asValue<QColor>();
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor PreferencesGui::vertexQColor()
|
QColor PreferencesGui::vertexQColor()
|
||||||
@@ -118,30 +127,39 @@ App::Color PreferencesGui::dimColor()
|
|||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||||
GetGroup("Mod/TechDraw/Dimensions");
|
GetGroup("Mod/TechDraw/Dimensions");
|
||||||
App::Color result;
|
App::Color fcColor;
|
||||||
result.setPackedValue(hGrp->GetUnsigned("Color", 0x000000FF)); //#000000 black
|
fcColor.setPackedValue(hGrp->GetUnsigned("Color", 0x000000FF)); //#000000 black
|
||||||
return result;
|
return fcColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor PreferencesGui::dimQColor()
|
QColor PreferencesGui::dimQColor()
|
||||||
{
|
{
|
||||||
return PreferencesGui::dimColor().asValue<QColor>();
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||||
|
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||||
|
GetGroup("Mod/TechDraw/Dimensions");
|
||||||
|
App::Color fcColor;
|
||||||
|
fcColor.setPackedValue(hGrp->GetUnsigned("Color", 0x000000FF)); //#000000 black
|
||||||
|
return fcColor.asValue<QColor>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
App::Color PreferencesGui::leaderColor()
|
App::Color PreferencesGui::leaderColor()
|
||||||
{
|
{
|
||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||||
GetGroup("Mod/TechDraw/LeaderLine");
|
GetGroup("Mod/TechDraw/LeaderLine");
|
||||||
App::Color result;
|
App::Color fcColor;
|
||||||
result.setPackedValue(hGrp->GetUnsigned("Color", 0x000000FF)); //#000000 black
|
fcColor.setPackedValue(hGrp->GetUnsigned("Color", 0x000000FF)); //#000000 black
|
||||||
return result;
|
return fcColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor PreferencesGui::leaderQColor()
|
QColor PreferencesGui::leaderQColor()
|
||||||
{
|
{
|
||||||
return PreferencesGui::leaderColor().asValue<QColor>();
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||||
|
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||||
|
GetGroup("Mod/TechDraw/LeaderLine");
|
||||||
|
App::Color fcColor;
|
||||||
|
fcColor.setPackedValue(hGrp->GetUnsigned("Color", 0x000000FF)); //#000000 black
|
||||||
|
return fcColor.asValue<QColor>();
|
||||||
}
|
}
|
||||||
|
|
||||||
int PreferencesGui::dimArrowStyle()
|
int PreferencesGui::dimArrowStyle()
|
||||||
@@ -208,20 +226,24 @@ QString PreferencesGui::weldingDirectory()
|
|||||||
return qSymbolDir;
|
return qSymbolDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
App::Color PreferencesGui::gridColor()
|
App::Color PreferencesGui::gridColor()
|
||||||
{
|
{
|
||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||||
GetGroup("Mod/TechDraw/Colors");
|
GetGroup("Mod/TechDraw/Colors");
|
||||||
App::Color result;
|
App::Color fcColor;
|
||||||
result.setPackedValue(hGrp->GetUnsigned("gridColor", 0x000000FF)); //#000000 black
|
fcColor.setPackedValue(hGrp->GetUnsigned("gridColor", 0x000000FF)); //#000000 black
|
||||||
return result;
|
return fcColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor PreferencesGui::gridQColor()
|
QColor PreferencesGui::gridQColor()
|
||||||
{
|
{
|
||||||
return PreferencesGui::gridColor().asValue<QColor>();
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||||
|
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||||
|
GetGroup("Mod/TechDraw/Colors");
|
||||||
|
App::Color fcColor;
|
||||||
|
fcColor.setPackedValue(hGrp->GetUnsigned("gridColor", 0x000000FF)); //#000000 black
|
||||||
|
return fcColor.asValue<QColor>();
|
||||||
}
|
}
|
||||||
|
|
||||||
double PreferencesGui::gridSpacing()
|
double PreferencesGui::gridSpacing()
|
||||||
@@ -241,3 +263,70 @@ bool PreferencesGui::showGrid()
|
|||||||
bool show = hGrp->GetBool("showGrid", false);
|
bool show = hGrp->GetBool("showGrid", false);
|
||||||
return show;
|
return show;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
App::Color PreferencesGui::pageColor()
|
||||||
|
{
|
||||||
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||||
|
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||||
|
GetGroup("Mod/TechDraw/Colors");
|
||||||
|
App::Color result;
|
||||||
|
result.setPackedValue(hGrp->GetUnsigned("PageColor", 0xFFFFFFFF)); //#FFFFFFFF white
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
QColor PreferencesGui::pageQColor()
|
||||||
|
{
|
||||||
|
return PreferencesGui::pageColor().asValue<QColor>();
|
||||||
|
}
|
||||||
|
|
||||||
|
QColor PreferencesGui::getAccessibleQColor(QColor orig)
|
||||||
|
{
|
||||||
|
if (Preferences::lightOnDark() && Preferences::monochrome()) {
|
||||||
|
return lightTextQColor();
|
||||||
|
}
|
||||||
|
if (Preferences::lightOnDark()) {
|
||||||
|
return lightenColor(orig);
|
||||||
|
}
|
||||||
|
return orig;
|
||||||
|
}
|
||||||
|
|
||||||
|
QColor PreferencesGui::lightTextQColor()
|
||||||
|
{
|
||||||
|
return Preferences::lightTextColor().asValue<QColor>();
|
||||||
|
}
|
||||||
|
|
||||||
|
QColor PreferencesGui::reverseColor(QColor orig)
|
||||||
|
{
|
||||||
|
int revRed = 255 - orig.red();
|
||||||
|
int revBlue = 255 - orig.blue();
|
||||||
|
int revGreen = 255 - orig.green();
|
||||||
|
return QColor(revRed, revGreen, revBlue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// largely based on code from https://invent.kde.org/graphics/okular and
|
||||||
|
// https://en.wikipedia.org/wiki/HSL_and_HSV#HSL_to_RGB
|
||||||
|
QColor PreferencesGui::lightenColor(QColor orig)
|
||||||
|
{
|
||||||
|
// get component colours on [0, 255]
|
||||||
|
uchar red = orig.red();
|
||||||
|
uchar blue = orig.blue();
|
||||||
|
uchar green = orig.green();
|
||||||
|
uchar alpha = orig.alpha();
|
||||||
|
|
||||||
|
// shift color values
|
||||||
|
uchar m = std::min( {red, blue, green} );
|
||||||
|
red -= m;
|
||||||
|
blue -= m;
|
||||||
|
green -= m;
|
||||||
|
|
||||||
|
// calculate chroma (colour range)
|
||||||
|
uchar chroma = std::max( {red, blue, green} );
|
||||||
|
|
||||||
|
// calculate lightened colour value
|
||||||
|
uchar newm = 255 - chroma - m;
|
||||||
|
red += newm;
|
||||||
|
green += newm;
|
||||||
|
blue += newm;
|
||||||
|
|
||||||
|
return QColor(red, green, blue, alpha);
|
||||||
|
}
|
||||||
|
|||||||
@@ -55,6 +55,8 @@ static App::Color leaderColor();
|
|||||||
static QColor leaderQColor();
|
static QColor leaderQColor();
|
||||||
static App::Color dimColor();
|
static App::Color dimColor();
|
||||||
static QColor dimQColor();
|
static QColor dimQColor();
|
||||||
|
static App::Color pageColor();
|
||||||
|
static QColor pageQColor();
|
||||||
|
|
||||||
static int dimArrowStyle();
|
static int dimArrowStyle();
|
||||||
static double dimArrowSize();
|
static double dimArrowSize();
|
||||||
@@ -71,6 +73,10 @@ static App::Color gridColor();
|
|||||||
static QColor gridQColor();
|
static QColor gridQColor();
|
||||||
static double gridSpacing();
|
static double gridSpacing();
|
||||||
|
|
||||||
|
static QColor getAccessibleQColor(QColor orig);
|
||||||
|
static QColor lightTextQColor();
|
||||||
|
static QColor reverseColor(QColor orig);
|
||||||
|
static QColor lightenColor(QColor orig);
|
||||||
};
|
};
|
||||||
|
|
||||||
} //end namespace TechDrawGui
|
} //end namespace TechDrawGui
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ void QGEPath::showMarkers(std::vector<QPointF> points)
|
|||||||
//TODO: double r = getMarkerSize();
|
//TODO: double r = getMarkerSize();
|
||||||
// v->setRadius(r);
|
// v->setRadius(r);
|
||||||
v->setRadius(50.0);
|
v->setRadius(50.0);
|
||||||
v->setNormalColor(QColor(Qt::black));
|
v->setNormalColor(PreferencesGui::getAccessibleQColor(QColor(Qt::black)));
|
||||||
v->setZValue(ZVALUE::VERTEX);
|
v->setZValue(ZVALUE::VERTEX);
|
||||||
v->setPos(p);
|
v->setPos(p);
|
||||||
v->show();
|
v->show();
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
#include <Base/Parameter.h>
|
#include <Base/Parameter.h>
|
||||||
|
|
||||||
#include "QGICMark.h"
|
#include "QGICMark.h"
|
||||||
|
#include "PreferencesGui.h"
|
||||||
|
|
||||||
using namespace TechDrawGui;
|
using namespace TechDrawGui;
|
||||||
|
|
||||||
@@ -68,10 +68,7 @@ void QGICMark::setThick(float t)
|
|||||||
|
|
||||||
QColor QGICMark::getCMarkColor()
|
QColor QGICMark::getCMarkColor()
|
||||||
{
|
{
|
||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
return PreferencesGui::centerQColor();
|
||||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors");
|
|
||||||
App::Color fcColor = App::Color((uint32_t) hGrp->GetUnsigned("CMarkColor", 0x08080800));
|
|
||||||
return fcColor.asValue<QColor>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGICMark::setPrettyNormal() {
|
void QGICMark::setPrettyNormal() {
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ QColor QGIEdge::getHiddenColor()
|
|||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors");
|
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors");
|
||||||
App::Color fcColor = App::Color((uint32_t) hGrp->GetUnsigned("HiddenColor", 0x000000FF));
|
App::Color fcColor = App::Color((uint32_t) hGrp->GetUnsigned("HiddenColor", 0x000000FF));
|
||||||
return fcColor.asValue<QColor>();
|
return PreferencesGui::getAccessibleQColor(fcColor.asValue<QColor>());
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::PenStyle QGIEdge::getHiddenStyle()
|
Qt::PenStyle QGIEdge::getHiddenStyle()
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
#include <Base/Parameter.h>
|
#include <Base/Parameter.h>
|
||||||
#include <Mod/TechDraw/App/DrawUtil.h>
|
#include <Mod/TechDraw/App/DrawUtil.h>
|
||||||
|
|
||||||
|
#include "PreferencesGui.h"
|
||||||
#include "QGIFace.h"
|
#include "QGIFace.h"
|
||||||
#include <QByteArrayMatcher>
|
#include <QByteArrayMatcher>
|
||||||
#include "QGCustomImage.h"
|
#include "QGCustomImage.h"
|
||||||
@@ -48,7 +49,6 @@
|
|||||||
#include "Rez.h"
|
#include "Rez.h"
|
||||||
#include "ZVALUE.h"
|
#include "ZVALUE.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace TechDrawGui;
|
using namespace TechDrawGui;
|
||||||
using namespace TechDraw;
|
using namespace TechDraw;
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ QGIFace::QGIFace(int index) :
|
|||||||
|
|
||||||
//setStyle(Qt::NoPen); //don't draw face lines, just fill for debugging
|
//setStyle(Qt::NoPen); //don't draw face lines, just fill for debugging
|
||||||
setStyle(Qt::DashLine);
|
setStyle(Qt::DashLine);
|
||||||
m_geomColor = QColor(Qt::black);
|
m_geomColor = PreferencesGui::getAccessibleQColor(QColor(Qt::black));
|
||||||
setLineWeight(0.5); //0 = cosmetic
|
setLineWeight(0.5); //0 = cosmetic
|
||||||
|
|
||||||
setPrettyNormal();
|
setPrettyNormal();
|
||||||
|
|||||||
@@ -22,13 +22,13 @@
|
|||||||
|
|
||||||
#include "PreCompiled.h"
|
#include "PreCompiled.h"
|
||||||
#ifndef _PreComp_
|
#ifndef _PreComp_
|
||||||
# include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
# include <QGraphicsScene>
|
#include <QGraphicsScene>
|
||||||
# include <QGraphicsSceneMouseEvent>
|
#include <QGraphicsSceneMouseEvent>
|
||||||
# include <QPainter>
|
#include <QPainter>
|
||||||
# include <QPainterPath>
|
#include <QPainterPath>
|
||||||
# include <QVector2D>
|
#include <QVector2D>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <Base/Console.h>
|
#include <Base/Console.h>
|
||||||
@@ -37,10 +37,10 @@
|
|||||||
#include <Mod/TechDraw/App/DrawUtil.h>
|
#include <Mod/TechDraw/App/DrawUtil.h>
|
||||||
#include <Mod/TechDraw/App/LineGroup.h>
|
#include <Mod/TechDraw/App/LineGroup.h>
|
||||||
|
|
||||||
#include "QGILeaderLine.h"
|
|
||||||
#include "PreferencesGui.h"
|
#include "PreferencesGui.h"
|
||||||
#include "QGEPath.h"
|
#include "QGEPath.h"
|
||||||
#include "QGIArrow.h"
|
#include "QGIArrow.h"
|
||||||
|
#include "QGILeaderLine.h"
|
||||||
#include "QGIPrimPath.h"
|
#include "QGIPrimPath.h"
|
||||||
#include "Rez.h"
|
#include "Rez.h"
|
||||||
#include "ViewProviderLeader.h"
|
#include "ViewProviderLeader.h"
|
||||||
@@ -51,14 +51,14 @@ using namespace TechDrawGui;
|
|||||||
using namespace TechDraw;
|
using namespace TechDraw;
|
||||||
|
|
||||||
//**************************************************************
|
//**************************************************************
|
||||||
QGILeaderLine::QGILeaderLine() :
|
QGILeaderLine::QGILeaderLine()
|
||||||
m_parentItem(nullptr),
|
: m_parentItem(nullptr),
|
||||||
m_lineColor(Qt::black),
|
m_lineColor(Qt::black),
|
||||||
m_lineStyle(Qt::SolidLine),
|
m_lineStyle(Qt::SolidLine),
|
||||||
m_hasHover(false),
|
m_hasHover(false),
|
||||||
m_saveX(0.0),
|
m_saveX(0.0),
|
||||||
m_saveY(0.0),
|
m_saveY(0.0),
|
||||||
m_blockDraw(false)
|
m_blockDraw(false)
|
||||||
|
|
||||||
{
|
{
|
||||||
setHandlesChildEvents(false);
|
setHandlesChildEvents(false);
|
||||||
@@ -96,16 +96,16 @@ QGILeaderLine::QGILeaderLine() :
|
|||||||
|
|
||||||
setZValue(ZVALUE::DIMENSION);
|
setZValue(ZVALUE::DIMENSION);
|
||||||
|
|
||||||
QObject::connect(
|
QObject::connect(m_editPath,
|
||||||
m_editPath, SIGNAL(pointsUpdated(QPointF, std::vector<QPointF>)),
|
SIGNAL(pointsUpdated(QPointF, std::vector<QPointF>)),
|
||||||
this , SLOT (onLineEditFinished(QPointF, std::vector<QPointF>))
|
this,
|
||||||
);
|
SLOT(onLineEditFinished(QPointF, std::vector<QPointF>)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGILeaderLine::setLeaderFeature(TechDraw::DrawLeaderLine* feat)
|
void QGILeaderLine::setLeaderFeature(TechDraw::DrawLeaderLine* feat)
|
||||||
{
|
{
|
||||||
// Base::Console().Message("QGILL::setLeaderFeature()\n");
|
// Base::Console().Message("QGILL::setLeaderFeature()\n");
|
||||||
setViewFeature(static_cast<TechDraw::DrawView *>(feat));
|
setViewFeature(static_cast<TechDraw::DrawView*>(feat));
|
||||||
|
|
||||||
float x = Rez::guiX(feat->X.getValue());
|
float x = Rez::guiX(feat->X.getValue());
|
||||||
float y = Rez::guiX(-feat->Y.getValue());
|
float y = Rez::guiX(-feat->Y.getValue());
|
||||||
@@ -117,39 +117,41 @@ void QGILeaderLine::setLeaderFeature(TechDraw::DrawLeaderLine* feat)
|
|||||||
updateView();
|
updateView();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant QGILeaderLine::itemChange(GraphicsItemChange change, const QVariant &value)
|
QVariant QGILeaderLine::itemChange(GraphicsItemChange change, const QVariant& value)
|
||||||
{
|
{
|
||||||
// Base::Console().Message("QGILL::itemChange(%d)\n", change);
|
// Base::Console().Message("QGILL::itemChange(%d)\n", change);
|
||||||
if (change == ItemSelectedHasChanged && scene()) {
|
if (change == ItemSelectedHasChanged && scene()) {
|
||||||
if(isSelected()) {
|
if (isSelected()) {
|
||||||
setPrettySel();
|
setPrettySel();
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
setPrettyNormal();
|
setPrettyNormal();
|
||||||
}
|
}
|
||||||
draw();
|
draw();
|
||||||
} else if(change == ItemSceneChange && scene()) {
|
}
|
||||||
|
else if (change == ItemSceneChange && scene()) {
|
||||||
// nothing special!
|
// nothing special!
|
||||||
}
|
}
|
||||||
return QGIView::itemChange(change, value);
|
return QGIView::itemChange(change, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
//QGILL isn't draggable so skip QGIV::mousePress have event
|
//QGILL isn't draggable so skip QGIV::mousePress have event
|
||||||
void QGILeaderLine::mousePressEvent(QGraphicsSceneMouseEvent * event)
|
void QGILeaderLine::mousePressEvent(QGraphicsSceneMouseEvent* event)
|
||||||
{
|
{
|
||||||
// Base::Console().Message("QGILL::mousePressEvent() - %s\n", getViewName());
|
// Base::Console().Message("QGILL::mousePressEvent() - %s\n", getViewName());
|
||||||
QGraphicsItem::mousePressEvent(event);
|
QGraphicsItem::mousePressEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
//QGILL isn't draggable so skip QGIV::mouseRelease
|
//QGILL isn't draggable so skip QGIV::mouseRelease
|
||||||
void QGILeaderLine::mouseReleaseEvent(QGraphicsSceneMouseEvent * event)
|
void QGILeaderLine::mouseReleaseEvent(QGraphicsSceneMouseEvent* event)
|
||||||
{
|
{
|
||||||
// Base::Console().Message("QGILL::mouseReleaseEvent() - %s\n", getViewName());
|
// Base::Console().Message("QGILL::mouseReleaseEvent() - %s\n", getViewName());
|
||||||
QGraphicsItem::mouseReleaseEvent(event);
|
QGraphicsItem::mouseReleaseEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGILeaderLine::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
void QGILeaderLine::hoverEnterEvent(QGraphicsSceneHoverEvent* event)
|
||||||
{
|
{
|
||||||
// Base::Console().Message("QGILL::hoverEnter() - selected; %d\n", isSelected());
|
// Base::Console().Message("QGILL::hoverEnter() - selected; %d\n", isSelected());
|
||||||
m_hasHover = true;
|
m_hasHover = true;
|
||||||
if (!isSelected()) {
|
if (!isSelected()) {
|
||||||
setPrettyPre();
|
setPrettyPre();
|
||||||
@@ -157,11 +159,11 @@ void QGILeaderLine::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
|||||||
QGIView::hoverEnterEvent(event);
|
QGIView::hoverEnterEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGILeaderLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
void QGILeaderLine::hoverLeaveEvent(QGraphicsSceneHoverEvent* event)
|
||||||
{
|
{
|
||||||
// Base::Console().Message("QGILL::hoverLeave() - selected; %d\n", isSelected());
|
// Base::Console().Message("QGILL::hoverLeave() - selected; %d\n", isSelected());
|
||||||
m_hasHover = false;
|
m_hasHover = false;
|
||||||
if(!isSelected()) {
|
if (!isSelected()) {
|
||||||
setPrettyNormal();
|
setPrettyNormal();
|
||||||
}
|
}
|
||||||
QGIView::hoverLeaveEvent(event);
|
QGIView::hoverLeaveEvent(event);
|
||||||
@@ -169,45 +171,51 @@ void QGILeaderLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
|||||||
|
|
||||||
void QGILeaderLine::onSourceChange(TechDraw::DrawView* newParent)
|
void QGILeaderLine::onSourceChange(TechDraw::DrawView* newParent)
|
||||||
{
|
{
|
||||||
// Base::Console().Message("QGILL::onSoureChange(%s)\n", newParent->getNameInDocument());
|
// Base::Console().Message("QGILL::onSoureChange(%s)\n", newParent->getNameInDocument());
|
||||||
std::string parentName = newParent->getNameInDocument();
|
std::string parentName = newParent->getNameInDocument();
|
||||||
QGIView* qgiParent = getQGIVByName(parentName);
|
QGIView* qgiParent = getQGIVByName(parentName);
|
||||||
if (qgiParent) {
|
if (qgiParent) {
|
||||||
m_parentItem = qgiParent;
|
m_parentItem = qgiParent;
|
||||||
setParentItem(m_parentItem);
|
setParentItem(m_parentItem);
|
||||||
draw();
|
draw();
|
||||||
} else {
|
}
|
||||||
Base::Console().Warning("QGILL::onSourceChange - new parent %s has no QGIView\n", parentName.c_str());
|
else {
|
||||||
|
Base::Console().Warning("QGILL::onSourceChange - new parent %s has no QGIView\n",
|
||||||
|
parentName.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGILeaderLine::setNormalColorAll()
|
void QGILeaderLine::setNormalColorAll()
|
||||||
{
|
{
|
||||||
// Base::Console().Message("QGILL::setNormalColorAll - normal color: %s\n", qPrintable(getNormalColor().name()));
|
// Base::Console().Message("QGILL::setNormalColorAll - normal color: %s\n", qPrintable(getNormalColor().name()));
|
||||||
m_line->setNormalColor(getNormalColor());
|
QColor qc = prefNormalColor();
|
||||||
m_editPath->setNormalColor(getNormalColor());
|
m_line->setNormalColor(qc);
|
||||||
m_arrow1->setNormalColor(getNormalColor());
|
m_editPath->setNormalColor(qc);
|
||||||
m_arrow1->setFillColor(getNormalColor());
|
m_arrow1->setNormalColor(qc);
|
||||||
m_arrow2->setNormalColor(getNormalColor());
|
m_arrow1->setFillColor(qc);
|
||||||
m_arrow2->setFillColor(getNormalColor());
|
m_arrow2->setNormalColor(qc);
|
||||||
|
m_arrow2->setFillColor(qc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGILeaderLine::setPrettyNormal() {
|
void QGILeaderLine::setPrettyNormal()
|
||||||
// Base::Console().Message("QGILL::setPrettyNormal()\n");
|
{
|
||||||
|
// Base::Console().Message("QGILL::setPrettyNormal()\n");
|
||||||
m_line->setPrettyNormal();
|
m_line->setPrettyNormal();
|
||||||
m_arrow1->setPrettyNormal();
|
m_arrow1->setPrettyNormal();
|
||||||
m_arrow2->setPrettyNormal();
|
m_arrow2->setPrettyNormal();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGILeaderLine::setPrettyPre() {
|
void QGILeaderLine::setPrettyPre()
|
||||||
// Base::Console().Message("QGILL::setPrettyPre()\n");
|
{
|
||||||
|
// Base::Console().Message("QGILL::setPrettyPre()\n");
|
||||||
m_line->setPrettyPre();
|
m_line->setPrettyPre();
|
||||||
m_arrow1->setPrettyPre();
|
m_arrow1->setPrettyPre();
|
||||||
m_arrow2->setPrettyPre();
|
m_arrow2->setPrettyPre();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGILeaderLine::setPrettySel() {
|
void QGILeaderLine::setPrettySel()
|
||||||
// Base::Console().Message("QGILL::setPrettySel()\n");
|
{
|
||||||
|
// Base::Console().Message("QGILL::setPrettySel()\n");
|
||||||
m_line->setPrettySel();
|
m_line->setPrettySel();
|
||||||
m_arrow1->setPrettySel();
|
m_arrow1->setPrettySel();
|
||||||
m_arrow2->setPrettySel();
|
m_arrow2->setPrettySel();
|
||||||
@@ -216,36 +224,35 @@ void QGILeaderLine::setPrettySel() {
|
|||||||
|
|
||||||
void QGILeaderLine::closeEdit()
|
void QGILeaderLine::closeEdit()
|
||||||
{
|
{
|
||||||
// Base::Console().Message("QGIL::closeEdit()\n");
|
// Base::Console().Message("QGIL::closeEdit()\n");
|
||||||
if (m_editPath) {
|
if (m_editPath) {
|
||||||
m_editPath->onEndEdit(); //tell QEPath that edit session ended
|
m_editPath->onEndEdit();//tell QEPath that edit session ended
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//signaled from QEPath
|
//signaled from QEPath
|
||||||
void QGILeaderLine::onLineEditFinished(QPointF tipDisplace, std::vector<QPointF> points)
|
void QGILeaderLine::onLineEditFinished(QPointF tipDisplace, std::vector<QPointF> points)
|
||||||
{
|
{
|
||||||
// Base::Console().Message("QGILL::onLineEditFinished(%s, %d)\n",
|
// Base::Console().Message("QGILL::onLineEditFinished(%s, %d)\n",
|
||||||
// TechDraw::DrawUtil::formatVector(tipDisplace).c_str(),
|
// TechDraw::DrawUtil::formatVector(tipDisplace).c_str(),
|
||||||
// points.size());
|
// points.size());
|
||||||
m_blockDraw = true;
|
m_blockDraw = true;
|
||||||
auto featLeader = getFeature();
|
auto featLeader = getFeature();
|
||||||
if (!featLeader)
|
if (!featLeader) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
double baseScale = featLeader->getBaseScale();
|
double baseScale = featLeader->getBaseScale();
|
||||||
|
|
||||||
if ( !(TechDraw::DrawUtil::fpCompare(tipDisplace.x(), 0.0) &&
|
if (!(TechDraw::DrawUtil::fpCompare(tipDisplace.x(), 0.0)
|
||||||
TechDraw::DrawUtil::fpCompare(tipDisplace.y(), 0.0)) ) {
|
&& TechDraw::DrawUtil::fpCompare(tipDisplace.y(), 0.0))) {
|
||||||
//tip was moved. need to change AttachPoint
|
//tip was moved. need to change AttachPoint
|
||||||
QPointF oldAttach = getAttachFromFeature();
|
QPointF oldAttach = getAttachFromFeature();
|
||||||
QPointF newAttach = oldAttach + (tipDisplace / baseScale);
|
QPointF newAttach = oldAttach + (tipDisplace / baseScale);
|
||||||
featLeader->setPosition(Rez::appX(newAttach.x()),
|
featLeader->setPosition(Rez::appX(newAttach.x()), Rez::appX(-newAttach.y()), true);
|
||||||
Rez::appX(- newAttach.y()),
|
|
||||||
true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Base::Vector3d> waypoints;
|
std::vector<Base::Vector3d> waypoints;
|
||||||
for (auto& p: points) {
|
for (auto& p : points) {
|
||||||
QPointF moved = p - tipDisplace;
|
QPointF moved = p - tipDisplace;
|
||||||
Base::Vector3d v(moved.x(), moved.y(), 0.0);
|
Base::Vector3d v(moved.x(), moved.y(), 0.0);
|
||||||
waypoints.push_back(v);
|
waypoints.push_back(v);
|
||||||
@@ -257,7 +264,7 @@ void QGILeaderLine::onLineEditFinished(QPointF tipDisplace, std::vector<QPointF>
|
|||||||
featLeader->adjustLastSegment();
|
featLeader->adjustLastSegment();
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_EMIT editComplete(); //tell task editing is complete
|
Q_EMIT editComplete();//tell task editing is complete
|
||||||
|
|
||||||
m_blockDraw = false;
|
m_blockDraw = false;
|
||||||
m_editPath->hide();
|
m_editPath->hide();
|
||||||
@@ -267,9 +274,10 @@ void QGILeaderLine::onLineEditFinished(QPointF tipDisplace, std::vector<QPointF>
|
|||||||
void QGILeaderLine::startPathEdit()
|
void QGILeaderLine::startPathEdit()
|
||||||
{
|
{
|
||||||
saveState();
|
saveState();
|
||||||
auto featLeader( dynamic_cast<TechDraw::DrawLeaderLine*>(getViewObject()) );
|
auto featLeader(dynamic_cast<TechDraw::DrawLeaderLine*>(getViewObject()));
|
||||||
if (!featLeader)
|
if (!featLeader) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
double scale = featLeader->getScale();
|
double scale = featLeader->getScale();
|
||||||
m_editPath->setScale(scale);
|
m_editPath->setScale(scale);
|
||||||
@@ -280,7 +288,7 @@ void QGILeaderLine::startPathEdit()
|
|||||||
|
|
||||||
void QGILeaderLine::saveState()
|
void QGILeaderLine::saveState()
|
||||||
{
|
{
|
||||||
// Base::Console().Message("QGILL::saveState()\n");
|
// Base::Console().Message("QGILL::saveState()\n");
|
||||||
auto featLeader = getFeature();
|
auto featLeader = getFeature();
|
||||||
if (featLeader) {
|
if (featLeader) {
|
||||||
m_savePoints = featLeader->WayPoints.getValues();
|
m_savePoints = featLeader->WayPoints.getValues();
|
||||||
@@ -291,7 +299,7 @@ void QGILeaderLine::saveState()
|
|||||||
|
|
||||||
void QGILeaderLine::restoreState()
|
void QGILeaderLine::restoreState()
|
||||||
{
|
{
|
||||||
// Base::Console().Message("QGILL::restoreState()\n");
|
// Base::Console().Message("QGILL::restoreState()\n");
|
||||||
auto featLeader = getFeature();
|
auto featLeader = getFeature();
|
||||||
if (featLeader) {
|
if (featLeader) {
|
||||||
featLeader->WayPoints.setValues(m_savePoints);
|
featLeader->WayPoints.setValues(m_savePoints);
|
||||||
@@ -305,52 +313,61 @@ void QGILeaderLine::restoreState()
|
|||||||
|
|
||||||
void QGILeaderLine::updateView(bool update)
|
void QGILeaderLine::updateView(bool update)
|
||||||
{
|
{
|
||||||
// Base::Console().Message("QGIL::updateView() %s\n", getViewObject()->getNameInDocument());
|
// Base::Console().Message("QGIL::updateView() %s\n", getViewObject()->getNameInDocument());
|
||||||
Q_UNUSED(update);
|
Q_UNUSED(update);
|
||||||
auto featLeader( dynamic_cast<TechDraw::DrawLeaderLine*>(getViewObject()) );
|
auto featLeader(dynamic_cast<TechDraw::DrawLeaderLine*>(getViewObject()));
|
||||||
if (!featLeader) {
|
if (!featLeader) {
|
||||||
Base::Console().Warning("QGILL::updateView - no feature!\n");
|
Base::Console().Warning("QGILL::updateView - no feature!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto vp = static_cast<ViewProviderLeader*>(getViewProvider(getViewObject()));
|
auto vp = static_cast<ViewProviderLeader*>(getViewProvider(getViewObject()));
|
||||||
if (!vp)
|
if (!vp) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGILeaderLine::draw()
|
void QGILeaderLine::draw()
|
||||||
{
|
{
|
||||||
// Base::Console().Message("QGILL::draw()- %s\n", getViewObject()->getNameInDocument());
|
// Base::Console().Message("QGILL::draw()- %s\n", getViewObject()->getNameInDocument());
|
||||||
if (m_blockDraw)
|
if (m_blockDraw) {
|
||||||
return;
|
return;
|
||||||
if (!isVisible())
|
}
|
||||||
|
if (!isVisible()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
TechDraw::DrawLeaderLine* featLeader = getFeature();
|
TechDraw::DrawLeaderLine* featLeader = getFeature();
|
||||||
if (!featLeader)
|
if (!featLeader) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
auto vp = static_cast<ViewProviderLeader*>(getViewProvider(getViewObject()));
|
auto vp = static_cast<ViewProviderLeader*>(getViewProvider(getViewObject()));
|
||||||
if (!vp)
|
if (!vp) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
double scale = 1.0;
|
double scale = 1.0;
|
||||||
TechDraw::DrawView* parent = featLeader->getBaseView();
|
TechDraw::DrawView* parent = featLeader->getBaseView();
|
||||||
if (parent)
|
if (parent) {
|
||||||
scale = parent->getScale();
|
scale = parent->getScale();
|
||||||
|
}
|
||||||
|
|
||||||
if (m_editPath->inEdit())
|
if (m_editPath->inEdit()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//********
|
//********
|
||||||
if (featLeader->isLocked())
|
if (featLeader->isLocked()) {
|
||||||
setFlag(QGraphicsItem::ItemIsMovable, false);
|
setFlag(QGraphicsItem::ItemIsMovable, false);
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
setFlag(QGraphicsItem::ItemIsMovable, true);
|
setFlag(QGraphicsItem::ItemIsMovable, true);
|
||||||
|
}
|
||||||
|
|
||||||
m_lineStyle = static_cast<Qt::PenStyle>(vp->LineStyle.getValue());
|
m_lineStyle = static_cast<Qt::PenStyle>(vp->LineStyle.getValue());
|
||||||
double baseScale = featLeader->getBaseScale();
|
double baseScale = featLeader->getBaseScale();
|
||||||
double x = Rez::guiX(featLeader->X.getValue());
|
double x = Rez::guiX(featLeader->X.getValue());
|
||||||
double y = - Rez::guiX(featLeader->Y.getValue());
|
double y = -Rez::guiX(featLeader->Y.getValue());
|
||||||
QPointF aPoint(x, y);
|
QPointF aPoint(x, y);
|
||||||
aPoint *= baseScale;
|
aPoint *= baseScale;
|
||||||
setPos(aPoint);
|
setPos(aPoint);
|
||||||
@@ -359,7 +376,7 @@ void QGILeaderLine::draw()
|
|||||||
m_line->setStyle(m_lineStyle);
|
m_line->setStyle(m_lineStyle);
|
||||||
m_line->setWidth(getLineWidth());
|
m_line->setWidth(getLineWidth());
|
||||||
|
|
||||||
m_line->setPos(0, 0); //make m_line coords == leader coords
|
m_line->setPos(0, 0);//make m_line coords == leader coords
|
||||||
|
|
||||||
std::vector<QPointF> qPoints = getWayPointsFromFeature();
|
std::vector<QPointF> qPoints = getWayPointsFromFeature();
|
||||||
if (featLeader->Scalable.getValue()) {
|
if (featLeader->Scalable.getValue()) {
|
||||||
@@ -374,9 +391,11 @@ void QGILeaderLine::draw()
|
|||||||
|
|
||||||
if (isSelected()) {
|
if (isSelected()) {
|
||||||
setPrettySel();
|
setPrettySel();
|
||||||
} else if (m_hasHover) {
|
}
|
||||||
|
else if (m_hasHover) {
|
||||||
setPrettyPre();
|
setPrettyPre();
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
setPrettyNormal();
|
setPrettyNormal();
|
||||||
}
|
}
|
||||||
update(boundingRect());
|
update(boundingRect());
|
||||||
@@ -384,23 +403,23 @@ void QGILeaderLine::draw()
|
|||||||
|
|
||||||
QPainterPath QGILeaderLine::makeLeaderPath(std::vector<QPointF> qPoints)
|
QPainterPath QGILeaderLine::makeLeaderPath(std::vector<QPointF> qPoints)
|
||||||
{
|
{
|
||||||
// Base::Console().Message("QGILeaderLine::makeLeaderPath()\n");
|
// Base::Console().Message("QGILeaderLine::makeLeaderPath()\n");
|
||||||
QPainterPath result;
|
QPainterPath result;
|
||||||
DrawLeaderLine* featLeader = getFeature();
|
DrawLeaderLine* featLeader = getFeature();
|
||||||
if (!featLeader) {
|
if (!featLeader) {
|
||||||
Base::Console().Message("QGILL::makeLeaderPath - featLeader is nullptr\n");
|
Base::Console().Message("QGILL::makeLeaderPath - featLeader is nullptr\n");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QPointF startAdjVec(0.0, 0.0);
|
QPointF startAdjVec(0.0, 0.0);
|
||||||
double startAdjLength(0.0);
|
double startAdjLength(0.0);
|
||||||
QPointF endAdjVec(0.0, 0.0);
|
QPointF endAdjVec(0.0, 0.0);
|
||||||
double endAdjLength(0.0);
|
double endAdjLength(0.0);
|
||||||
if (qPoints.size() > 1) {
|
if (qPoints.size() > 1) {
|
||||||
//make path adjustment to hide leaderline ends behind arrowheads
|
//make path adjustment to hide leaderline ends behind arrowheads
|
||||||
if (featLeader->StartSymbol.getValue() != ArrowType::NONE) {
|
if (featLeader->StartSymbol.getValue() != ArrowType::NONE) {
|
||||||
startAdjLength = QGIArrow::getOverlapAdjust(featLeader->StartSymbol.getValue(),
|
startAdjLength = QGIArrow::getOverlapAdjust(featLeader->StartSymbol.getValue(),
|
||||||
QGIArrow::getPrefArrowSize());
|
QGIArrow::getPrefArrowSize());
|
||||||
}
|
}
|
||||||
if (featLeader->EndSymbol.getValue() != ArrowType::NONE) {
|
if (featLeader->EndSymbol.getValue() != ArrowType::NONE) {
|
||||||
endAdjLength = QGIArrow::getOverlapAdjust(featLeader->EndSymbol.getValue(),
|
endAdjLength = QGIArrow::getOverlapAdjust(featLeader->EndSymbol.getValue(),
|
||||||
@@ -409,7 +428,7 @@ QPainterPath QGILeaderLine::makeLeaderPath(std::vector<QPointF> qPoints)
|
|||||||
|
|
||||||
//get adjustment directions
|
//get adjustment directions
|
||||||
startAdjVec = qPoints.at(1) - qPoints.front();
|
startAdjVec = qPoints.at(1) - qPoints.front();
|
||||||
endAdjVec = (*(qPoints.end() - 2))- qPoints.back();
|
endAdjVec = (*(qPoints.end() - 2)) - qPoints.back();
|
||||||
|
|
||||||
//get adjustment vectors
|
//get adjustment vectors
|
||||||
QVector2D startTemp(startAdjVec);
|
QVector2D startTemp(startAdjVec);
|
||||||
@@ -420,26 +439,26 @@ QPainterPath QGILeaderLine::makeLeaderPath(std::vector<QPointF> qPoints)
|
|||||||
endAdjVec = endTemp.toPointF() * endAdjLength;
|
endAdjVec = endTemp.toPointF() * endAdjLength;
|
||||||
|
|
||||||
qPoints.front() += startAdjVec;
|
qPoints.front() += startAdjVec;
|
||||||
qPoints.back() += endAdjVec;
|
qPoints.back() += endAdjVec;
|
||||||
result.moveTo(qPoints.front());
|
result.moveTo(qPoints.front());
|
||||||
for (int i = 1; i < (int)qPoints.size(); i++) {
|
for (int i = 1; i < (int)qPoints.size(); i++) {
|
||||||
result.lineTo(qPoints.at(i));
|
result.lineTo(qPoints.at(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QPointF QGILeaderLine::getAttachFromFeature()
|
QPointF QGILeaderLine::getAttachFromFeature()
|
||||||
{
|
{
|
||||||
// Base::Console().Message("QGILL::getAttachFromFeature()\n");
|
// Base::Console().Message("QGILL::getAttachFromFeature()\n");
|
||||||
QPointF result;
|
QPointF result;
|
||||||
TechDraw::DrawLeaderLine* featLeader = getFeature();
|
TechDraw::DrawLeaderLine* featLeader = getFeature();
|
||||||
if((!featLeader) ) {
|
if ((!featLeader)) {
|
||||||
Base::Console().Message("QGIL::getAttachFromLeader - no feature\n");
|
Base::Console().Message("QGIL::getAttachFromLeader - no feature\n");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
double x = Rez::guiX(featLeader->X.getValue());
|
double x = Rez::guiX(featLeader->X.getValue());
|
||||||
double y = - Rez::guiX(featLeader->Y.getValue());
|
double y = -Rez::guiX(featLeader->Y.getValue());
|
||||||
result = QPointF(x, y);
|
result = QPointF(x, y);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -451,11 +470,11 @@ std::vector<QPointF> QGILeaderLine::getWayPointsFromFeature()
|
|||||||
DrawLeaderLine* featLeader = getFeature();
|
DrawLeaderLine* featLeader = getFeature();
|
||||||
if (!featLeader) {
|
if (!featLeader) {
|
||||||
Base::Console().Message("QGILL::getWayPointsFromFeature - featLeader is nullptr\n");
|
Base::Console().Message("QGILL::getWayPointsFromFeature - featLeader is nullptr\n");
|
||||||
return qPoints;
|
return qPoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Base::Vector3d> vPoints = featLeader->WayPoints.getValues();
|
std::vector<Base::Vector3d> vPoints = featLeader->WayPoints.getValues();
|
||||||
for (auto& d: vPoints) {
|
for (auto& d : vPoints) {
|
||||||
QPointF temp(d.x, d.y);
|
QPointF temp(d.x, d.y);
|
||||||
qPoints.push_back(temp);
|
qPoints.push_back(temp);
|
||||||
}
|
}
|
||||||
@@ -467,7 +486,7 @@ std::vector<QPointF> QGILeaderLine::getWayPointsFromFeature()
|
|||||||
|
|
||||||
void QGILeaderLine::setArrows(std::vector<QPointF> pathPoints)
|
void QGILeaderLine::setArrows(std::vector<QPointF> pathPoints)
|
||||||
{
|
{
|
||||||
// Base::Console().Message("QGILL::setArrows()\n");
|
// Base::Console().Message("QGILL::setArrows()\n");
|
||||||
Base::Vector3d stdX(1.0, 0.0, 0.0);
|
Base::Vector3d stdX(1.0, 0.0, 0.0);
|
||||||
TechDraw::DrawLeaderLine* featLeader = getFeature();
|
TechDraw::DrawLeaderLine* featLeader = getFeature();
|
||||||
|
|
||||||
@@ -476,7 +495,7 @@ void QGILeaderLine::setArrows(std::vector<QPointF> pathPoints)
|
|||||||
if (featLeader->StartSymbol.getValue() != ArrowType::NONE) {
|
if (featLeader->StartSymbol.getValue() != ArrowType::NONE) {
|
||||||
m_arrow1->setStyle(featLeader->StartSymbol.getValue());
|
m_arrow1->setStyle(featLeader->StartSymbol.getValue());
|
||||||
m_arrow1->setWidth(getLineWidth());
|
m_arrow1->setWidth(getLineWidth());
|
||||||
// TODO: variable size arrow heads
|
// TODO: variable size arrow heads
|
||||||
m_arrow1->setSize(QGIArrow::getPrefArrowSize());
|
m_arrow1->setSize(QGIArrow::getPrefArrowSize());
|
||||||
m_arrow1->setDirMode(true);
|
m_arrow1->setDirMode(true);
|
||||||
m_arrow1->setDirection(stdX);
|
m_arrow1->setDirection(stdX);
|
||||||
@@ -491,7 +510,8 @@ void QGILeaderLine::setArrows(std::vector<QPointF> pathPoints)
|
|||||||
}
|
}
|
||||||
m_arrow1->draw();
|
m_arrow1->draw();
|
||||||
m_arrow1->show();
|
m_arrow1->show();
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
m_arrow1->hide();
|
m_arrow1->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -511,15 +531,16 @@ void QGILeaderLine::setArrows(std::vector<QPointF> pathPoints)
|
|||||||
}
|
}
|
||||||
m_arrow2->draw();
|
m_arrow2->draw();
|
||||||
m_arrow2->show();
|
m_arrow2->show();
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
m_arrow2->hide();
|
m_arrow2->hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGILeaderLine::drawBorder()
|
void QGILeaderLine::drawBorder()
|
||||||
{
|
{
|
||||||
////Leaders have no border!
|
////Leaders have no border!
|
||||||
// QGIView::drawBorder(); //good for debugging
|
// QGIView::drawBorder(); //good for debugging
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
@@ -527,7 +548,7 @@ void QGILeaderLine::drawBorder()
|
|||||||
|
|
||||||
void QGILeaderLine::abandonEdit()
|
void QGILeaderLine::abandonEdit()
|
||||||
{
|
{
|
||||||
// Base::Console().Message("QGIL::abandonEdit()\n");
|
// Base::Console().Message("QGIL::abandonEdit()\n");
|
||||||
m_editPath->clearMarkers();
|
m_editPath->clearMarkers();
|
||||||
m_editPath->hide();
|
m_editPath->hide();
|
||||||
restoreState();
|
restoreState();
|
||||||
@@ -536,15 +557,15 @@ void QGILeaderLine::abandonEdit()
|
|||||||
double QGILeaderLine::getLineWidth()
|
double QGILeaderLine::getLineWidth()
|
||||||
{
|
{
|
||||||
auto vp = static_cast<ViewProviderLeader*>(getViewProvider(getViewObject()));
|
auto vp = static_cast<ViewProviderLeader*>(getViewProvider(getViewObject()));
|
||||||
if (!vp)
|
if (!vp) {
|
||||||
return Rez::guiX(LineGroup::getDefaultWidth("Graphic"));
|
return Rez::guiX(LineGroup::getDefaultWidth("Graphic"));
|
||||||
|
}
|
||||||
return Rez::guiX(vp->LineWidth.getValue());
|
return Rez::guiX(vp->LineWidth.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
TechDraw::DrawLeaderLine* QGILeaderLine::getFeature()
|
TechDraw::DrawLeaderLine* QGILeaderLine::getFeature()
|
||||||
{
|
{
|
||||||
TechDraw::DrawLeaderLine* result =
|
TechDraw::DrawLeaderLine* result = static_cast<TechDraw::DrawLeaderLine*>(getViewObject());
|
||||||
static_cast<TechDraw::DrawLeaderLine*>(getViewObject());
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -555,12 +576,13 @@ double QGILeaderLine::getEdgeFuzz() const
|
|||||||
|
|
||||||
QColor QGILeaderLine::prefNormalColor()
|
QColor QGILeaderLine::prefNormalColor()
|
||||||
{
|
{
|
||||||
// Base::Console().Message("QGILL::getNormalColor()\n");
|
// Base::Console().Message("QGILL::getNormalColor()\n");
|
||||||
setNormalColor(PreferencesGui::leaderQColor());
|
setNormalColor(PreferencesGui::leaderQColor());
|
||||||
|
|
||||||
auto vp = dynamic_cast<ViewProviderLeader*>(getViewProvider(getViewObject()));
|
auto vp = dynamic_cast<ViewProviderLeader*>(getViewProvider(getViewObject()));
|
||||||
if (vp) {
|
if (vp) {
|
||||||
setNormalColor(vp->Color.getValue().asValue<QColor>());
|
QColor normal = vp->Color.getValue().asValue<QColor>();
|
||||||
|
setNormalColor(PreferencesGui::getAccessibleQColor(normal));
|
||||||
}
|
}
|
||||||
return getNormalColor();
|
return getNormalColor();
|
||||||
}
|
}
|
||||||
@@ -570,14 +592,16 @@ QRectF QGILeaderLine::boundingRect() const
|
|||||||
return childrenBoundingRect();
|
return childrenBoundingRect();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGILeaderLine::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget) {
|
void QGILeaderLine::paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
|
||||||
|
QWidget* widget)
|
||||||
|
{
|
||||||
QStyleOptionGraphicsItem myOption(*option);
|
QStyleOptionGraphicsItem myOption(*option);
|
||||||
myOption.state &= ~QStyle::State_Selected;
|
myOption.state &= ~QStyle::State_Selected;
|
||||||
|
|
||||||
// painter->setPen(Qt::blue);
|
// painter->setPen(Qt::blue);
|
||||||
// painter->drawRect(boundingRect()); //good for debugging
|
// painter->drawRect(boundingRect()); //good for debugging
|
||||||
|
|
||||||
QGIView::paint (painter, &myOption, widget);
|
QGIView::paint(painter, &myOption, widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <Mod/TechDraw/Gui/moc_QGILeaderLine.cpp>
|
#include <Mod/TechDraw/Gui/moc_QGILeaderLine.cpp>
|
||||||
|
|||||||
@@ -36,10 +36,11 @@
|
|||||||
#include "QGIView.h"
|
#include "QGIView.h"
|
||||||
|
|
||||||
|
|
||||||
namespace TechDraw {
|
namespace TechDraw
|
||||||
|
{
|
||||||
class DrawLeaderLine;
|
class DrawLeaderLine;
|
||||||
class DrawView;
|
class DrawView;
|
||||||
}
|
}// namespace TechDraw
|
||||||
|
|
||||||
namespace TechDrawGui
|
namespace TechDrawGui
|
||||||
{
|
{
|
||||||
@@ -50,20 +51,25 @@ class QGEPath;
|
|||||||
|
|
||||||
//*******************************************************************
|
//*******************************************************************
|
||||||
|
|
||||||
class TechDrawGuiExport QGILeaderLine : public QGIView
|
class TechDrawGuiExport QGILeaderLine: public QGIView
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum {Type = QGraphicsItem::UserType + 232};
|
enum
|
||||||
|
{
|
||||||
|
Type = QGraphicsItem::UserType + 232
|
||||||
|
};
|
||||||
|
|
||||||
explicit QGILeaderLine();
|
explicit QGILeaderLine();
|
||||||
~QGILeaderLine() = default;
|
~QGILeaderLine() = default;
|
||||||
|
|
||||||
int type() const override { return Type;}
|
int type() const override
|
||||||
void paint( QPainter * painter,
|
{
|
||||||
const QStyleOptionGraphicsItem * option,
|
return Type;
|
||||||
QWidget * widget = nullptr ) override;
|
}
|
||||||
|
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
|
||||||
|
QWidget* widget = nullptr) override;
|
||||||
QRectF boundingRect() const override;
|
QRectF boundingRect() const override;
|
||||||
|
|
||||||
void drawBorder() override;
|
void drawBorder() override;
|
||||||
@@ -80,10 +86,10 @@ public:
|
|||||||
double getLineWidth();
|
double getLineWidth();
|
||||||
double getEdgeFuzz() const;
|
double getEdgeFuzz() const;
|
||||||
|
|
||||||
void mousePressEvent(QGraphicsSceneMouseEvent * event) override;
|
void mousePressEvent(QGraphicsSceneMouseEvent* event) override;
|
||||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent * event) override;
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent* event) override;
|
||||||
void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override;
|
void hoverEnterEvent(QGraphicsSceneHoverEvent* event) override;
|
||||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override;
|
void hoverLeaveEvent(QGraphicsSceneHoverEvent* event) override;
|
||||||
|
|
||||||
void setPrettyNormal();
|
void setPrettyNormal();
|
||||||
void setPrettyPre();
|
void setPrettyPre();
|
||||||
@@ -92,11 +98,12 @@ public:
|
|||||||
void setLeaderFeature(TechDraw::DrawLeaderLine* feat);
|
void setLeaderFeature(TechDraw::DrawLeaderLine* feat);
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void onLineEditFinished(QPointF tipDisplace, std::vector<QPointF> points); //QGEPath is finished editing points
|
void onLineEditFinished(QPointF tipDisplace,
|
||||||
|
std::vector<QPointF> points);//QGEPath is finished editing points
|
||||||
void onSourceChange(TechDraw::DrawView* newParent) override;
|
void onSourceChange(TechDraw::DrawView* newParent) override;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void editComplete(); //tell caller that edit session is finished
|
void editComplete();//tell caller that edit session is finished
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void draw() override;
|
void draw() override;
|
||||||
@@ -104,8 +111,7 @@ protected:
|
|||||||
std::vector<QPointF> getWayPointsFromFeature();
|
std::vector<QPointF> getWayPointsFromFeature();
|
||||||
QPointF getAttachFromFeature();
|
QPointF getAttachFromFeature();
|
||||||
|
|
||||||
QVariant itemChange( GraphicsItemChange change,
|
QVariant itemChange(GraphicsItemChange change, const QVariant& value) override;
|
||||||
const QVariant &value ) override;
|
|
||||||
|
|
||||||
void saveState();
|
void saveState();
|
||||||
void restoreState();
|
void restoreState();
|
||||||
@@ -116,13 +122,13 @@ protected:
|
|||||||
private:
|
private:
|
||||||
std::vector<QPointF> m_pathPoints;
|
std::vector<QPointF> m_pathPoints;
|
||||||
QGraphicsItem* m_parentItem;
|
QGraphicsItem* m_parentItem;
|
||||||
QGIPrimPath* m_line; //actual leader line
|
QGIPrimPath* m_line;//actual leader line
|
||||||
QColor m_lineColor;
|
QColor m_lineColor;
|
||||||
Qt::PenStyle m_lineStyle;
|
Qt::PenStyle m_lineStyle;
|
||||||
QGIArrow* m_arrow1;
|
QGIArrow* m_arrow1;
|
||||||
QGIArrow* m_arrow2;
|
QGIArrow* m_arrow2;
|
||||||
|
|
||||||
QGEPath* m_editPath; //line editor
|
QGEPath* m_editPath;//line editor
|
||||||
QColor m_editPathColor;
|
QColor m_editPathColor;
|
||||||
|
|
||||||
bool m_hasHover;
|
bool m_hasHover;
|
||||||
@@ -131,9 +137,9 @@ private:
|
|||||||
double m_saveY;
|
double m_saveY;
|
||||||
std::vector<Base::Vector3d> m_savePoints;
|
std::vector<Base::Vector3d> m_savePoints;
|
||||||
|
|
||||||
bool m_blockDraw; //prevent redraws while updating.
|
bool m_blockDraw;//prevent redraws while updating.
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}// namespace TechDrawGui
|
||||||
|
|
||||||
#endif // DRAWINGGUI_QGRAPHICSITEMLEADERLINE_H
|
#endif// DRAWINGGUI_QGRAPHICSITEMLEADERLINE_H
|
||||||
|
|||||||
@@ -23,35 +23,36 @@
|
|||||||
#include "PreCompiled.h"
|
#include "PreCompiled.h"
|
||||||
|
|
||||||
#ifndef _PreComp_
|
#ifndef _PreComp_
|
||||||
# include <QDomDocument>
|
#include <QDomDocument>
|
||||||
# include <QFile>
|
#include <QFile>
|
||||||
# include <QGraphicsSvgItem>
|
#include <QGraphicsColorizeEffect>
|
||||||
# include <QPen>
|
#include <QGraphicsEffect>
|
||||||
# include <QSvgRenderer>
|
#include <QGraphicsSvgItem>
|
||||||
# include <QXmlQuery>
|
#include <QPen>
|
||||||
# include <QXmlResultItems>
|
#include <QSvgRenderer>
|
||||||
#endif // #ifndef _PreComp_
|
#include <QXmlQuery>
|
||||||
|
#include <QXmlResultItems>
|
||||||
|
#endif// #ifndef _PreComp_
|
||||||
|
|
||||||
#include <App/Application.h>
|
#include <App/Application.h>
|
||||||
#include <Base/Console.h>
|
#include <Base/Console.h>
|
||||||
#include <Base/Parameter.h>
|
#include <Base/Parameter.h>
|
||||||
|
|
||||||
#include <Mod/TechDraw/App/DrawUtil.h>
|
|
||||||
#include <Mod/TechDraw/App/DrawSVGTemplate.h>
|
#include <Mod/TechDraw/App/DrawSVGTemplate.h>
|
||||||
|
#include <Mod/TechDraw/App/DrawUtil.h>
|
||||||
#include <Mod/TechDraw/App/QDomNodeModel.h>
|
#include <Mod/TechDraw/App/QDomNodeModel.h>
|
||||||
|
|
||||||
|
#include "PreferencesGui.h"
|
||||||
#include "QGISVGTemplate.h"
|
#include "QGISVGTemplate.h"
|
||||||
#include "QGSPage.h"
|
#include "QGSPage.h"
|
||||||
#include "Rez.h"
|
#include "Rez.h"
|
||||||
#include "TemplateTextField.h"
|
#include "TemplateTextField.h"
|
||||||
#include "ZVALUE.h"
|
#include "ZVALUE.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace TechDrawGui;
|
using namespace TechDrawGui;
|
||||||
|
using namespace TechDraw;
|
||||||
|
|
||||||
QGISVGTemplate::QGISVGTemplate(QGSPage* scene)
|
QGISVGTemplate::QGISVGTemplate(QGSPage* scene) : QGITemplate(scene), firstTime(true)
|
||||||
: QGITemplate(scene),
|
|
||||||
firstTime(true)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
m_svgItem = new QGraphicsSvgItem(this);
|
m_svgItem = new QGraphicsSvgItem(this);
|
||||||
@@ -66,22 +67,15 @@ QGISVGTemplate::QGISVGTemplate(QGSPage* scene)
|
|||||||
|
|
||||||
m_svgItem->setZValue(ZVALUE::SVGTEMPLATE);
|
m_svgItem->setZValue(ZVALUE::SVGTEMPLATE);
|
||||||
setZValue(ZVALUE::SVGTEMPLATE);
|
setZValue(ZVALUE::SVGTEMPLATE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QGISVGTemplate::~QGISVGTemplate()
|
QGISVGTemplate::~QGISVGTemplate() { delete m_svgRender; }
|
||||||
{
|
|
||||||
delete m_svgRender;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QGISVGTemplate::openFile(const QFile &file)
|
void QGISVGTemplate::openFile(const QFile& file) { Q_UNUSED(file); }
|
||||||
{
|
|
||||||
Q_UNUSED(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QGISVGTemplate::load(const QByteArray &svgCode)
|
void QGISVGTemplate::load(const QByteArray& svgCode)
|
||||||
{
|
{
|
||||||
m_svgRender->load(svgCode);
|
m_svgRender->load(svgCode);
|
||||||
|
|
||||||
QSize size = m_svgRender->defaultSize();
|
QSize size = m_svgRender->defaultSize();
|
||||||
m_svgItem->setSharedRenderer(m_svgRender);
|
m_svgItem->setSharedRenderer(m_svgRender);
|
||||||
@@ -92,31 +86,48 @@ void QGISVGTemplate::load(const QByteArray &svgCode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//convert from pixels or mm or inches in svg file to mm page size
|
//convert from pixels or mm or inches in svg file to mm page size
|
||||||
TechDraw::DrawSVGTemplate *tmplte = getSVGTemplate();
|
TechDraw::DrawSVGTemplate* tmplte = getSVGTemplate();
|
||||||
double xaspect, yaspect;
|
double xaspect, yaspect;
|
||||||
xaspect = tmplte->getWidth() / static_cast<double>(size.width());
|
xaspect = tmplte->getWidth() / static_cast<double>(size.width());
|
||||||
yaspect = tmplte->getHeight() / static_cast<double>(size.height());
|
yaspect = tmplte->getHeight() / static_cast<double>(size.height());
|
||||||
|
|
||||||
QTransform qtrans;
|
QTransform qtrans;
|
||||||
qtrans.translate(0.0, Rez::guiX(-tmplte->getHeight()));
|
qtrans.translate(0.0, Rez::guiX(-tmplte->getHeight()));
|
||||||
qtrans.scale(Rez::guiX(xaspect) , Rez::guiX(yaspect));
|
qtrans.scale(Rez::guiX(xaspect), Rez::guiX(yaspect));
|
||||||
m_svgItem->setTransform(qtrans);
|
m_svgItem->setTransform(qtrans);
|
||||||
|
|
||||||
|
if (Preferences::lightOnDark()) {
|
||||||
|
QColor color = PreferencesGui::getAccessibleQColor(QColor(Qt::black));
|
||||||
|
QGraphicsColorizeEffect* colorizeEffect = new QGraphicsColorizeEffect();
|
||||||
|
colorizeEffect->setColor(color);
|
||||||
|
m_svgItem->setGraphicsEffect(colorizeEffect);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//remove and delete any existing graphics effect
|
||||||
|
if (m_svgItem->graphicsEffect()) {
|
||||||
|
m_svgItem->setGraphicsEffect(nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TechDraw::DrawSVGTemplate * QGISVGTemplate::getSVGTemplate()
|
TechDraw::DrawSVGTemplate* QGISVGTemplate::getSVGTemplate()
|
||||||
{
|
{
|
||||||
if(pageTemplate && pageTemplate->isDerivedFrom(TechDraw::DrawSVGTemplate::getClassTypeId()))
|
if (pageTemplate && pageTemplate->isDerivedFrom(TechDraw::DrawSVGTemplate::getClassTypeId())) {
|
||||||
return static_cast<TechDraw::DrawSVGTemplate *>(pageTemplate);
|
return static_cast<TechDraw::DrawSVGTemplate*>(pageTemplate);
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGISVGTemplate::draw()
|
void QGISVGTemplate::draw()
|
||||||
{
|
{
|
||||||
TechDraw::DrawSVGTemplate *tmplte = getSVGTemplate();
|
TechDraw::DrawSVGTemplate* tmplte = getSVGTemplate();
|
||||||
if(!tmplte)
|
if (!tmplte) {
|
||||||
throw Base::RuntimeError("Template Feature not set for QGISVGTemplate");
|
throw Base::RuntimeError("Template Feature not set for QGISVGTemplate");
|
||||||
load(tmplte->processTemplate().toUtf8());
|
}
|
||||||
|
QString templateSvg = tmplte->processTemplate();
|
||||||
|
load(templateSvg.toUtf8());
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGISVGTemplate::updateView(bool update)
|
void QGISVGTemplate::updateView(bool update)
|
||||||
@@ -127,7 +138,7 @@ void QGISVGTemplate::updateView(bool update)
|
|||||||
|
|
||||||
void QGISVGTemplate::createClickHandles()
|
void QGISVGTemplate::createClickHandles()
|
||||||
{
|
{
|
||||||
TechDraw::DrawSVGTemplate *svgTemplate = getSVGTemplate();
|
TechDraw::DrawSVGTemplate* svgTemplate = getSVGTemplate();
|
||||||
if (svgTemplate->isRestoring()) {
|
if (svgTemplate->isRestoring()) {
|
||||||
//the embedded file is not available yet, so just return
|
//the embedded file is not available yet, so just return
|
||||||
return;
|
return;
|
||||||
@@ -141,8 +152,9 @@ void QGISVGTemplate::createClickHandles()
|
|||||||
|
|
||||||
QFile file(templateFilename);
|
QFile file(templateFilename);
|
||||||
if (!file.open(QIODevice::ReadOnly)) {
|
if (!file.open(QIODevice::ReadOnly)) {
|
||||||
Base::Console().Error("QGISVGTemplate::createClickHandles - error opening template file %s\n",
|
Base::Console().Error(
|
||||||
svgTemplate->PageResult.getValue());
|
"QGISVGTemplate::createClickHandles - error opening template file %s\n",
|
||||||
|
svgTemplate->PageResult.getValue());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,37 +172,41 @@ void QGISVGTemplate::createClickHandles()
|
|||||||
query.setFocus(QXmlItem(model.fromDomNode(templateDocElem)));
|
query.setFocus(QXmlItem(model.fromDomNode(templateDocElem)));
|
||||||
|
|
||||||
// XPath query to select all <text> nodes with "freecad:editable" attribute
|
// XPath query to select all <text> nodes with "freecad:editable" attribute
|
||||||
query.setQuery(QString::fromUtf8(
|
query.setQuery(QString::fromUtf8("declare default element namespace \"" SVG_NS_URI "\"; "
|
||||||
"declare default element namespace \"" SVG_NS_URI "\"; "
|
"declare namespace freecad=\"" FREECAD_SVG_NS_URI "\"; "
|
||||||
"declare namespace freecad=\"" FREECAD_SVG_NS_URI "\"; "
|
"//text[@freecad:editable]"));
|
||||||
"//text[@freecad:editable]"));
|
|
||||||
|
|
||||||
QXmlResultItems queryResult;
|
QXmlResultItems queryResult;
|
||||||
query.evaluateTo(&queryResult);
|
query.evaluateTo(&queryResult);
|
||||||
|
|
||||||
//TODO: Find location of special fields (first/third angle) and make graphics items for them
|
//TODO: Find location of special fields (first/third angle) and make graphics items for them
|
||||||
|
|
||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/General");
|
.GetUserParameter()
|
||||||
|
.GetGroup("BaseApp")
|
||||||
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/General");
|
||||||
double editClickBoxSize = Rez::guiX(hGrp->GetFloat("TemplateDotSize", 3.0));
|
double editClickBoxSize = Rez::guiX(hGrp->GetFloat("TemplateDotSize", 3.0));
|
||||||
|
|
||||||
QColor editClickBoxColor = Qt::green;
|
QColor editClickBoxColor = Qt::green;
|
||||||
editClickBoxColor.setAlpha(128); //semi-transparent
|
editClickBoxColor.setAlpha(128);//semi-transparent
|
||||||
|
|
||||||
double width = editClickBoxSize;
|
double width = editClickBoxSize;
|
||||||
double height = editClickBoxSize;
|
double height = editClickBoxSize;
|
||||||
|
|
||||||
while (!queryResult.next().isNull())
|
while (!queryResult.next().isNull()) {
|
||||||
{
|
QDomElement textElement =
|
||||||
QDomElement textElement = model.toDomNode(queryResult.current().toNodeModelIndex()).toElement();
|
model.toDomNode(queryResult.current().toNodeModelIndex()).toElement();
|
||||||
|
|
||||||
QString name = textElement.attribute(QString::fromUtf8("freecad:editable"));
|
QString name = textElement.attribute(QString::fromUtf8("freecad:editable"));
|
||||||
double x = Rez::guiX(textElement.attribute(QString::fromUtf8("x"), QString::fromUtf8("0.0")).toDouble());
|
double x = Rez::guiX(
|
||||||
double y = Rez::guiX(textElement.attribute(QString::fromUtf8("y"), QString::fromUtf8("0.0")).toDouble());
|
textElement.attribute(QString::fromUtf8("x"), QString::fromUtf8("0.0")).toDouble());
|
||||||
|
double y = Rez::guiX(
|
||||||
|
textElement.attribute(QString::fromUtf8("y"), QString::fromUtf8("0.0")).toDouble());
|
||||||
|
|
||||||
if (name.isEmpty()) {
|
if (name.isEmpty()) {
|
||||||
Base::Console().Warning("QGISVGTemplate::createClickHandles - no name for editable text at %f, %f\n",
|
Base::Console().Warning(
|
||||||
x, y);
|
"QGISVGTemplate::createClickHandles - no name for editable text at %f, %f\n", x, y);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,12 +214,12 @@ void QGISVGTemplate::createClickHandles()
|
|||||||
|
|
||||||
double pad = 1.0;
|
double pad = 1.0;
|
||||||
item->setRect(x - pad, Rez::guiX(-svgTemplate->getHeight()) + y - height - pad,
|
item->setRect(x - pad, Rez::guiX(-svgTemplate->getHeight()) + y - height - pad,
|
||||||
width + 2.0*pad, height + 2.0*pad);
|
width + 2.0 * pad, height + 2.0 * pad);
|
||||||
|
|
||||||
QPen myPen;
|
QPen myPen;
|
||||||
myPen.setStyle(Qt::SolidLine);
|
myPen.setStyle(Qt::SolidLine);
|
||||||
myPen.setColor(editClickBoxColor);
|
myPen.setColor(editClickBoxColor);
|
||||||
myPen.setWidth(0); // 0 means "cosmetic pen" - always 1px
|
myPen.setWidth(0);// 0 means "cosmetic pen" - always 1px
|
||||||
item->setPen(myPen);
|
item->setPen(myPen);
|
||||||
|
|
||||||
QBrush myBrush(editClickBoxColor, Qt::SolidPattern);
|
QBrush myBrush(editClickBoxColor, Qt::SolidPattern);
|
||||||
|
|||||||
@@ -32,7 +32,8 @@ class QSvgRenderer;
|
|||||||
class QFile;
|
class QFile;
|
||||||
class QString;
|
class QString;
|
||||||
|
|
||||||
namespace TechDraw {
|
namespace TechDraw
|
||||||
|
{
|
||||||
class DrawSVGTemplate;
|
class DrawSVGTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,33 +43,36 @@ namespace TechDrawGui
|
|||||||
{
|
{
|
||||||
class QGSPage;
|
class QGSPage;
|
||||||
|
|
||||||
class TechDrawGuiExport QGISVGTemplate : public QGITemplate
|
class TechDrawGuiExport QGISVGTemplate: public QGITemplate
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit QGISVGTemplate(QGSPage* scene);
|
explicit QGISVGTemplate(QGSPage* scene);
|
||||||
virtual ~QGISVGTemplate();
|
~QGISVGTemplate() override;
|
||||||
|
|
||||||
enum {Type = QGraphicsItem::UserType + 153};
|
enum
|
||||||
|
{
|
||||||
|
Type = QGraphicsItem::UserType + 153
|
||||||
|
};
|
||||||
int type() const { return Type; }
|
int type() const { return Type; }
|
||||||
|
|
||||||
void draw();
|
void draw();
|
||||||
virtual void updateView(bool update = false);
|
void updateView(bool update = false) override;
|
||||||
|
|
||||||
TechDraw::DrawSVGTemplate *getSVGTemplate();
|
TechDraw::DrawSVGTemplate* getSVGTemplate();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void openFile(const QFile &file);
|
void openFile(const QFile& file);
|
||||||
void load (const QByteArray& svgCode);
|
void load(const QByteArray& svgCode);
|
||||||
void createClickHandles(void);
|
void createClickHandles(void);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool firstTime;
|
bool firstTime;
|
||||||
QGraphicsSvgItem *m_svgItem;
|
QGraphicsSvgItem* m_svgItem;
|
||||||
QSvgRenderer *m_svgRender;
|
QSvgRenderer* m_svgRender;
|
||||||
}; // class QGISVGTemplate
|
};// class QGISVGTemplate
|
||||||
|
|
||||||
}
|
}// namespace TechDrawGui
|
||||||
|
|
||||||
#endif // DRAWINGGUI_QGRAPHICSITEMSVGTEMPLATE_H
|
#endif// DRAWINGGUI_QGRAPHICSITEMSVGTEMPLATE_H
|
||||||
|
|||||||
@@ -325,7 +325,7 @@ QColor QGITile::getTileColor() const
|
|||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors");
|
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors");
|
||||||
App::Color fcColor = App::Color((uint32_t) hGrp->GetUnsigned("TileColor", 0x00000000));
|
App::Color fcColor = App::Color((uint32_t) hGrp->GetUnsigned("TileColor", 0x00000000));
|
||||||
return fcColor.asValue<QColor>();
|
return PreferencesGui::getAccessibleQColor( fcColor.asValue<QColor>());
|
||||||
}
|
}
|
||||||
|
|
||||||
double QGITile::getSymbolWidth() const
|
double QGITile::getSymbolWidth() const
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ QVariant QGIView::itemChange(GraphicsItemChange change, const QVariant &value)
|
|||||||
m_colCurrent = getSelectColor();
|
m_colCurrent = getSelectColor();
|
||||||
// m_selectState = 2;
|
// m_selectState = 2;
|
||||||
} else {
|
} else {
|
||||||
m_colCurrent = PreferencesGui::normalQColor();
|
m_colCurrent = PreferencesGui::getAccessibleQColor(PreferencesGui::normalQColor());
|
||||||
// m_selectState = 0;
|
// m_selectState = 0;
|
||||||
}
|
}
|
||||||
drawBorder();
|
drawBorder();
|
||||||
@@ -268,7 +268,7 @@ void QGIView::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
|||||||
if(isSelected()) {
|
if(isSelected()) {
|
||||||
m_colCurrent = getSelectColor();
|
m_colCurrent = getSelectColor();
|
||||||
} else {
|
} else {
|
||||||
m_colCurrent = PreferencesGui::normalQColor();
|
m_colCurrent = PreferencesGui::getAccessibleQColor(PreferencesGui::normalQColor());
|
||||||
}
|
}
|
||||||
drawBorder();
|
drawBorder();
|
||||||
}
|
}
|
||||||
@@ -709,17 +709,17 @@ void QGIView::setStackFromVP()
|
|||||||
|
|
||||||
QColor QGIView::prefNormalColor()
|
QColor QGIView::prefNormalColor()
|
||||||
{
|
{
|
||||||
return PreferencesGui::normalQColor();
|
return PreferencesGui::getAccessibleQColor(PreferencesGui::normalQColor());
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor QGIView::getPreColor()
|
QColor QGIView::getPreColor()
|
||||||
{
|
{
|
||||||
return PreferencesGui::preselectQColor();
|
return PreferencesGui::getAccessibleQColor(PreferencesGui::preselectQColor());
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor QGIView::getSelectColor()
|
QColor QGIView::getSelectColor()
|
||||||
{
|
{
|
||||||
return PreferencesGui::selectQColor();
|
return PreferencesGui::getAccessibleQColor(PreferencesGui::selectQColor());
|
||||||
}
|
}
|
||||||
|
|
||||||
Base::Reference<ParameterGrp> QGIView::getParmGroupCol()
|
Base::Reference<ParameterGrp> QGIView::getParmGroupCol()
|
||||||
|
|||||||
@@ -39,13 +39,15 @@
|
|||||||
|
|
||||||
#include <App/Application.h>
|
#include <App/Application.h>
|
||||||
#include <Base/Console.h>
|
#include <Base/Console.h>
|
||||||
|
#include <Gui/MainWindow.h>
|
||||||
#include <Gui/Widgets.h>
|
#include <Gui/Widgets.h>
|
||||||
#include <Mod/TechDraw/App/DrawViewAnnotation.h>
|
#include <Mod/TechDraw/App/DrawViewAnnotation.h>
|
||||||
|
#include <Mod/TechDraw/App/Preferences.h>
|
||||||
|
|
||||||
#include "QGIViewAnnotation.h"
|
#include "QGIViewAnnotation.h"
|
||||||
#include "QGCustomText.h"
|
#include "QGCustomText.h"
|
||||||
#include "Rez.h"
|
#include "Rez.h"
|
||||||
|
#include "DlgStringListEditor.h"
|
||||||
|
|
||||||
using namespace TechDrawGui;
|
using namespace TechDrawGui;
|
||||||
|
|
||||||
@@ -135,6 +137,7 @@ void QGIViewAnnotation::drawAnnotation()
|
|||||||
}
|
}
|
||||||
ss << "line-height:" << viewAnno->LineSpace.getValue() << "%; ";
|
ss << "line-height:" << viewAnno->LineSpace.getValue() << "%; ";
|
||||||
App::Color c = viewAnno->TextColor.getValue();
|
App::Color c = viewAnno->TextColor.getValue();
|
||||||
|
c = TechDraw::Preferences::getAccessibleColor(c);
|
||||||
ss << "color:" << c.asHexString() << "; ";
|
ss << "color:" << c.asHexString() << "; ";
|
||||||
ss << "}\n</style>\n</head>\n<body>\n<p>";
|
ss << "}\n</style>\n</head>\n<body>\n<p>";
|
||||||
for(std::vector<std::string>::const_iterator it = annoText.begin(); it != annoText.end(); it++) {
|
for(std::vector<std::string>::const_iterator it = annoText.begin(); it != annoText.end(); it++) {
|
||||||
@@ -173,44 +176,11 @@ void QGIViewAnnotation::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<std::string> &values = annotation->Text.getValues();
|
const std::vector<std::string> &values = annotation->Text.getValues();
|
||||||
QString text;
|
DlgStringListEditor dlg(values, Gui::getMainWindow());
|
||||||
if (!values.empty()) {
|
dlg.setWindowTitle(QString::fromUtf8("Annotation Text Editor"));
|
||||||
text = QString::fromUtf8(values[0].c_str());
|
if (dlg.exec() == QDialog::Accepted) {
|
||||||
|
App::GetApplication().setActiveTransaction("Set Annotation Text");
|
||||||
for (unsigned int i = 1; i < values.size(); ++i) {
|
annotation->Text.setValues(dlg.getTexts());
|
||||||
text += QChar::fromLatin1('\n');
|
App::GetApplication().closeActiveTransaction();
|
||||||
text += QString::fromUtf8(values[i].c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QDialog dialog(nullptr);
|
|
||||||
dialog.setWindowTitle(tr("Text"));
|
|
||||||
|
|
||||||
Gui::PropertyListEditor editor(&dialog);
|
|
||||||
editor.setPlainText(text);
|
|
||||||
|
|
||||||
QDialogButtonBox buttonBox(&dialog);
|
|
||||||
buttonBox.setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
|
||||||
|
|
||||||
QVBoxLayout boxLayout(&dialog);
|
|
||||||
boxLayout.addWidget(&editor);
|
|
||||||
boxLayout.addWidget(&buttonBox);
|
|
||||||
|
|
||||||
connect(&buttonBox, SIGNAL(accepted()), &dialog, SLOT(accept()));
|
|
||||||
connect(&buttonBox, SIGNAL(rejected()), &dialog, SLOT(reject()));
|
|
||||||
if (dialog.exec() == QDialog::Accepted) {
|
|
||||||
QString newText = editor.toPlainText();
|
|
||||||
if (newText != text) {
|
|
||||||
QStringList list = newText.split(QChar::fromLatin1('\n'));
|
|
||||||
std::vector<std::string> newValues;
|
|
||||||
|
|
||||||
for (int i = 0; i < list.size(); ++i) {
|
|
||||||
newValues.push_back(list[i].toStdString());
|
|
||||||
}
|
|
||||||
|
|
||||||
App::GetApplication().setActiveTransaction("Set Annotation Text");
|
|
||||||
annotation->Text.setValues(newValues);
|
|
||||||
App::GetApplication().closeActiveTransaction();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,15 +23,15 @@
|
|||||||
|
|
||||||
#include "PreCompiled.h"
|
#include "PreCompiled.h"
|
||||||
#ifndef _PreComp_
|
#ifndef _PreComp_
|
||||||
# include <cmath>
|
#include <cmath>
|
||||||
# include <string>
|
#include <string>
|
||||||
|
|
||||||
# include <QGraphicsScene>
|
#include <QGraphicsScene>
|
||||||
# include <QGraphicsSceneMouseEvent>
|
#include <QGraphicsSceneMouseEvent>
|
||||||
# include <QPaintDevice>
|
#include <QPaintDevice>
|
||||||
# include <QPainter>
|
#include <QPainter>
|
||||||
# include <QPainterPath>
|
#include <QPainterPath>
|
||||||
# include <QSvgGenerator>
|
#include <QSvgGenerator>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <App/Application.h>
|
#include <App/Application.h>
|
||||||
@@ -41,15 +41,15 @@
|
|||||||
#include <Gui/Tools.h>
|
#include <Gui/Tools.h>
|
||||||
#include <Mod/TechDraw/App/ArrowPropEnum.h>
|
#include <Mod/TechDraw/App/ArrowPropEnum.h>
|
||||||
#include <Mod/TechDraw/App/DrawPage.h>
|
#include <Mod/TechDraw/App/DrawPage.h>
|
||||||
|
#include <Mod/TechDraw/App/DrawUtil.h>
|
||||||
#include <Mod/TechDraw/App/DrawViewBalloon.h>
|
#include <Mod/TechDraw/App/DrawViewBalloon.h>
|
||||||
#include <Mod/TechDraw/App/DrawViewPart.h>
|
#include <Mod/TechDraw/App/DrawViewPart.h>
|
||||||
#include <Mod/TechDraw/App/DrawUtil.h>
|
|
||||||
#include <Mod/TechDraw/App/Geometry.h>
|
#include <Mod/TechDraw/App/Geometry.h>
|
||||||
|
|
||||||
#include "QGIViewBalloon.h"
|
|
||||||
#include "PreferencesGui.h"
|
#include "PreferencesGui.h"
|
||||||
#include "QGIArrow.h"
|
#include "QGIArrow.h"
|
||||||
#include "QGIDimLines.h"
|
#include "QGIDimLines.h"
|
||||||
|
#include "QGIViewBalloon.h"
|
||||||
#include "Rez.h"
|
#include "Rez.h"
|
||||||
#include "ViewProviderBalloon.h"
|
#include "ViewProviderBalloon.h"
|
||||||
#include "ViewProviderViewPart.h"
|
#include "ViewProviderViewPart.h"
|
||||||
@@ -82,18 +82,20 @@ QGIBalloonLabel::QGIBalloonLabel()
|
|||||||
parent = nullptr;
|
parent = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant QGIBalloonLabel::itemChange(GraphicsItemChange change, const QVariant &value)
|
QVariant QGIBalloonLabel::itemChange(GraphicsItemChange change, const QVariant& value)
|
||||||
{
|
{
|
||||||
if (change == ItemSelectedHasChanged && scene()) {
|
if (change == ItemSelectedHasChanged && scene()) {
|
||||||
if(isSelected()) {
|
if (isSelected()) {
|
||||||
Q_EMIT selected(true);
|
Q_EMIT selected(true);
|
||||||
setPrettySel();
|
setPrettySel();
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
Q_EMIT selected(false);
|
Q_EMIT selected(false);
|
||||||
setPrettyNormal();
|
setPrettyNormal();
|
||||||
}
|
}
|
||||||
update();
|
update();
|
||||||
} else if(change == ItemPositionHasChanged && scene()) {
|
}
|
||||||
|
else if (change == ItemPositionHasChanged && scene()) {
|
||||||
setLabelCenter();
|
setLabelCenter();
|
||||||
if (m_drag) {
|
if (m_drag) {
|
||||||
Q_EMIT dragging(m_ctrl);
|
Q_EMIT dragging(m_ctrl);
|
||||||
@@ -103,20 +105,19 @@ QVariant QGIBalloonLabel::itemChange(GraphicsItemChange change, const QVariant &
|
|||||||
return QGraphicsItem::itemChange(change, value);
|
return QGraphicsItem::itemChange(change, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGIBalloonLabel::mousePressEvent(QGraphicsSceneMouseEvent * event)
|
void QGIBalloonLabel::mousePressEvent(QGraphicsSceneMouseEvent* event)
|
||||||
{
|
{
|
||||||
m_ctrl = false;
|
m_ctrl = false;
|
||||||
m_drag = true;
|
m_drag = true;
|
||||||
if(event->modifiers() & Qt::ControlModifier) {
|
if (event->modifiers() & Qt::ControlModifier) {
|
||||||
m_ctrl = true;
|
m_ctrl = true;
|
||||||
}
|
}
|
||||||
QGraphicsItem::mousePressEvent(event);
|
QGraphicsItem::mousePressEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGIBalloonLabel::mouseReleaseEvent(QGraphicsSceneMouseEvent * event)
|
void QGIBalloonLabel::mouseReleaseEvent(QGraphicsSceneMouseEvent* event)
|
||||||
{
|
{
|
||||||
if (QLineF(event->screenPos(), event->buttonDownScreenPos(Qt::LeftButton))
|
if (QLineF(event->screenPos(), event->buttonDownScreenPos(Qt::LeftButton)).length() > 0) {
|
||||||
.length() > 0) {
|
|
||||||
if (scene() && this == scene()->mouseGrabberItem()) {
|
if (scene() && this == scene()->mouseGrabberItem()) {
|
||||||
Q_EMIT dragFinished();
|
Q_EMIT dragFinished();
|
||||||
}
|
}
|
||||||
@@ -126,7 +127,7 @@ void QGIBalloonLabel::mouseReleaseEvent(QGraphicsSceneMouseEvent * event)
|
|||||||
QGraphicsItem::mouseReleaseEvent(event);
|
QGraphicsItem::mouseReleaseEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGIBalloonLabel::mouseDoubleClickEvent(QGraphicsSceneMouseEvent * event)
|
void QGIBalloonLabel::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event)
|
||||||
{
|
{
|
||||||
QGIViewBalloon* qgivBalloon = dynamic_cast<QGIViewBalloon*>(parentItem());
|
QGIViewBalloon* qgivBalloon = dynamic_cast<QGIViewBalloon*>(parentItem());
|
||||||
if (!qgivBalloon) {
|
if (!qgivBalloon) {
|
||||||
@@ -134,7 +135,8 @@ void QGIBalloonLabel::mouseDoubleClickEvent(QGraphicsSceneMouseEvent * event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto ViewProvider = dynamic_cast<ViewProviderBalloon*>(qgivBalloon->getViewProvider(qgivBalloon->getViewObject()));
|
auto ViewProvider = dynamic_cast<ViewProviderBalloon*>(
|
||||||
|
qgivBalloon->getViewProvider(qgivBalloon->getViewObject()));
|
||||||
if (!ViewProvider) {
|
if (!ViewProvider) {
|
||||||
qWarning() << "QGIBalloonLabel::mouseDoubleClickEvent: No valid view provider";
|
qWarning() << "QGIBalloonLabel::mouseDoubleClickEvent: No valid view provider";
|
||||||
return;
|
return;
|
||||||
@@ -144,21 +146,22 @@ void QGIBalloonLabel::mouseDoubleClickEvent(QGraphicsSceneMouseEvent * event)
|
|||||||
QGraphicsItem::mouseDoubleClickEvent(event);
|
QGraphicsItem::mouseDoubleClickEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGIBalloonLabel::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
void QGIBalloonLabel::hoverEnterEvent(QGraphicsSceneHoverEvent* event)
|
||||||
{
|
{
|
||||||
Q_EMIT hover(true);
|
Q_EMIT hover(true);
|
||||||
hasHover = true;
|
hasHover = true;
|
||||||
if (!isSelected()) {
|
if (!isSelected()) {
|
||||||
setPrettyPre();
|
setPrettyPre();
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
setPrettySel();
|
setPrettySel();
|
||||||
}
|
}
|
||||||
QGraphicsItem::hoverEnterEvent(event);
|
QGraphicsItem::hoverEnterEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGIBalloonLabel::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
void QGIBalloonLabel::hoverLeaveEvent(QGraphicsSceneHoverEvent* event)
|
||||||
{
|
{
|
||||||
QGIView *view = dynamic_cast<QGIView *> (parentItem());
|
QGIView* view = dynamic_cast<QGIView*>(parentItem());
|
||||||
assert(view);
|
assert(view);
|
||||||
Q_UNUSED(view);
|
Q_UNUSED(view);
|
||||||
|
|
||||||
@@ -166,7 +169,8 @@ void QGIBalloonLabel::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
|||||||
hasHover = false;
|
hasHover = false;
|
||||||
if (!isSelected()) {
|
if (!isSelected()) {
|
||||||
setPrettyNormal();
|
setPrettyNormal();
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
setPrettySel();
|
setPrettySel();
|
||||||
}
|
}
|
||||||
QGraphicsItem::hoverLeaveEvent(event);
|
QGraphicsItem::hoverLeaveEvent(event);
|
||||||
@@ -177,7 +181,8 @@ QRectF QGIBalloonLabel::boundingRect() const
|
|||||||
return childrenBoundingRect();
|
return childrenBoundingRect();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGIBalloonLabel::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
void QGIBalloonLabel::paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
|
||||||
|
QWidget* widget)
|
||||||
{
|
{
|
||||||
Q_UNUSED(widget);
|
Q_UNUSED(widget);
|
||||||
Q_UNUSED(painter);
|
Q_UNUSED(painter);
|
||||||
@@ -187,10 +192,11 @@ void QGIBalloonLabel::paint(QPainter *painter, const QStyleOptionGraphicsItem *o
|
|||||||
//QGraphicsObject/QGraphicsItem::paint gives link error.
|
//QGraphicsObject/QGraphicsItem::paint gives link error.
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGIBalloonLabel::setPosFromCenter(const double &xCenter, const double &yCenter)
|
void QGIBalloonLabel::setPosFromCenter(const double& xCenter, const double& yCenter)
|
||||||
{
|
{
|
||||||
//set label's Qt position(top, left) given boundingRect center point
|
//set label's Qt position(top, left) given boundingRect center point
|
||||||
setPos(xCenter - m_labelText->boundingRect().width() / 2., yCenter - m_labelText->boundingRect().height() / 2.);
|
setPos(xCenter - m_labelText->boundingRect().width() / 2.,
|
||||||
|
yCenter - m_labelText->boundingRect().height() / 2.);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGIBalloonLabel::setLabelCenter()
|
void QGIBalloonLabel::setLabelCenter()
|
||||||
@@ -240,13 +246,13 @@ void QGIBalloonLabel::setColor(QColor color)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//**************************************************************
|
//**************************************************************
|
||||||
QGIViewBalloon::QGIViewBalloon() :
|
QGIViewBalloon::QGIViewBalloon()
|
||||||
dvBalloon(nullptr),
|
: dvBalloon(nullptr),
|
||||||
hasHover(false),
|
hasHover(false),
|
||||||
m_lineWidth(0.0),
|
m_lineWidth(0.0),
|
||||||
m_obtuse(false),
|
m_obtuse(false),
|
||||||
parent(nullptr),
|
parent(nullptr),
|
||||||
m_dragInProgress(false)
|
m_dragInProgress(false)
|
||||||
{
|
{
|
||||||
m_ctrl = false;
|
m_ctrl = false;
|
||||||
|
|
||||||
@@ -269,7 +275,7 @@ QGIViewBalloon::QGIViewBalloon() :
|
|||||||
balloonShape = new QGIDimLines();
|
balloonShape = new QGIDimLines();
|
||||||
addToGroup(balloonShape);
|
addToGroup(balloonShape);
|
||||||
balloonShape->setNormalColor(prefNormalColor());
|
balloonShape->setNormalColor(prefNormalColor());
|
||||||
balloonShape->setFill(Qt::white, Qt::SolidPattern);
|
balloonShape->setFill(Qt::transparent, Qt::SolidPattern);
|
||||||
balloonShape->setFillOverride(true);
|
balloonShape->setFillOverride(true);
|
||||||
balloonShape->setPrettyNormal();
|
balloonShape->setPrettyNormal();
|
||||||
|
|
||||||
@@ -286,37 +292,30 @@ QGIViewBalloon::QGIViewBalloon() :
|
|||||||
balloonLines->setZValue(ZVALUE::DIMENSION);
|
balloonLines->setZValue(ZVALUE::DIMENSION);
|
||||||
balloonLines->setStyle(Qt::SolidLine);
|
balloonLines->setStyle(Qt::SolidLine);
|
||||||
|
|
||||||
balloonShape->setZValue(ZVALUE::DIMENSION + 1); //above balloonLines!
|
balloonShape->setZValue(ZVALUE::DIMENSION + 1);//above balloonLines!
|
||||||
balloonShape->setStyle(Qt::SolidLine);
|
balloonShape->setStyle(Qt::SolidLine);
|
||||||
|
|
||||||
balloonLabel->setPosFromCenter(0, 0);
|
balloonLabel->setPosFromCenter(0, 0);
|
||||||
|
|
||||||
// connecting the needed slots and signals
|
// connecting the needed slots and signals
|
||||||
QObject::connect(
|
QObject::connect(balloonLabel, SIGNAL(dragging(bool)), this, SLOT(balloonLabelDragged(bool)));
|
||||||
balloonLabel, SIGNAL(dragging(bool)),
|
|
||||||
this , SLOT (balloonLabelDragged(bool)));
|
|
||||||
|
|
||||||
QObject::connect(
|
QObject::connect(balloonLabel, SIGNAL(dragFinished()), this, SLOT(balloonLabelDragFinished()));
|
||||||
balloonLabel, SIGNAL(dragFinished()),
|
|
||||||
this , SLOT (balloonLabelDragFinished()));
|
|
||||||
|
|
||||||
QObject::connect(
|
QObject::connect(balloonLabel, SIGNAL(selected(bool)), this, SLOT(select(bool)));
|
||||||
balloonLabel, SIGNAL(selected(bool)),
|
|
||||||
this , SLOT (select(bool)));
|
|
||||||
|
|
||||||
QObject::connect(
|
QObject::connect(balloonLabel, SIGNAL(hover(bool)), this, SLOT(hover(bool)));
|
||||||
balloonLabel, SIGNAL(hover(bool)),
|
|
||||||
this , SLOT (hover(bool)));
|
|
||||||
|
|
||||||
setZValue(ZVALUE::DIMENSION);
|
setZValue(ZVALUE::DIMENSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant QGIViewBalloon::itemChange(GraphicsItemChange change, const QVariant &value)
|
QVariant QGIViewBalloon::itemChange(GraphicsItemChange change, const QVariant& value)
|
||||||
{
|
{
|
||||||
if (change == ItemSelectedHasChanged && scene()) {
|
if (change == ItemSelectedHasChanged && scene()) {
|
||||||
if(isSelected()) {
|
if (isSelected()) {
|
||||||
balloonLabel->setSelected(true);
|
balloonLabel->setSelected(true);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
balloonLabel->setSelected(false);
|
balloonLabel->setSelected(false);
|
||||||
}
|
}
|
||||||
draw();
|
draw();
|
||||||
@@ -327,7 +326,7 @@ QVariant QGIViewBalloon::itemChange(GraphicsItemChange change, const QVariant &v
|
|||||||
//Set selection state for this and it's children
|
//Set selection state for this and it's children
|
||||||
void QGIViewBalloon::setGroupSelection(bool isSelected)
|
void QGIViewBalloon::setGroupSelection(bool isSelected)
|
||||||
{
|
{
|
||||||
// Base::Console().Message("QGIVB::setGroupSelection(%d)\n", b);
|
// Base::Console().Message("QGIVB::setGroupSelection(%d)\n", b);
|
||||||
setSelected(isSelected);
|
setSelected(isSelected);
|
||||||
balloonLabel->setSelected(isSelected);
|
balloonLabel->setSelected(isSelected);
|
||||||
balloonLines->setSelected(isSelected);
|
balloonLines->setSelected(isSelected);
|
||||||
@@ -336,7 +335,7 @@ void QGIViewBalloon::setGroupSelection(bool isSelected)
|
|||||||
|
|
||||||
void QGIViewBalloon::select(bool state)
|
void QGIViewBalloon::select(bool state)
|
||||||
{
|
{
|
||||||
// Base::Console().Message("QGIVBall::select(%d)\n", state);
|
// Base::Console().Message("QGIVBall::select(%d)\n", state);
|
||||||
setSelected(state);
|
setSelected(state);
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
@@ -347,13 +346,14 @@ void QGIViewBalloon::hover(bool state)
|
|||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGIViewBalloon::setViewPartFeature(TechDraw::DrawViewBalloon *balloonFeat)
|
void QGIViewBalloon::setViewPartFeature(TechDraw::DrawViewBalloon* balloonFeat)
|
||||||
{
|
{
|
||||||
// Base::Console().Message("QGIVB::setViewPartFeature()\n");
|
// Base::Console().Message("QGIVB::setViewPartFeature()\n");
|
||||||
if (!balloonFeat)
|
if (!balloonFeat) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setViewFeature(static_cast<TechDraw::DrawView *>(balloonFeat));
|
setViewFeature(static_cast<TechDraw::DrawView*>(balloonFeat));
|
||||||
dvBalloon = balloonFeat;
|
dvBalloon = balloonFeat;
|
||||||
|
|
||||||
DrawView* balloonParent = nullptr;
|
DrawView* balloonParent = nullptr;
|
||||||
@@ -361,11 +361,12 @@ void QGIViewBalloon::setViewPartFeature(TechDraw::DrawViewBalloon *balloonFeat)
|
|||||||
App::DocumentObject* docObj = balloonFeat->SourceView.getValue();
|
App::DocumentObject* docObj = balloonFeat->SourceView.getValue();
|
||||||
if (docObj) {
|
if (docObj) {
|
||||||
balloonParent = dynamic_cast<DrawView*>(docObj);
|
balloonParent = dynamic_cast<DrawView*>(docObj);
|
||||||
if (balloonParent)
|
if (balloonParent) {
|
||||||
scale = balloonParent->getScale();
|
scale = balloonParent->getScale();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float x = Rez::guiX(balloonFeat->X.getValue() * scale) ;
|
float x = Rez::guiX(balloonFeat->X.getValue() * scale);
|
||||||
float y = Rez::guiX(-balloonFeat->Y.getValue() * scale);
|
float y = Rez::guiX(-balloonFeat->Y.getValue() * scale);
|
||||||
|
|
||||||
balloonLabel->setColor(prefNormalColor());
|
balloonLabel->setColor(prefNormalColor());
|
||||||
@@ -381,25 +382,22 @@ void QGIViewBalloon::setViewPartFeature(TechDraw::DrawViewBalloon *balloonFeat)
|
|||||||
|
|
||||||
void QGIViewBalloon::updateView(bool update)
|
void QGIViewBalloon::updateView(bool update)
|
||||||
{
|
{
|
||||||
// Base::Console().Message("QGIVB::updateView()\n");
|
// Base::Console().Message("QGIVB::updateView()\n");
|
||||||
Q_UNUSED(update);
|
Q_UNUSED(update);
|
||||||
auto balloon( dynamic_cast<TechDraw::DrawViewBalloon*>(getViewObject()) );
|
auto balloon(dynamic_cast<TechDraw::DrawViewBalloon*>(getViewObject()));
|
||||||
if (!balloon)
|
if (!balloon) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto vp = static_cast<ViewProviderBalloon*>(getViewProvider(getViewObject()));
|
auto vp = static_cast<ViewProviderBalloon*>(getViewProvider(getViewObject()));
|
||||||
if (!vp)
|
if (!vp) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (update) {
|
if (update) {
|
||||||
QString labelText = QString::fromUtf8(balloon->Text.getStrValue().data());
|
QString labelText = QString::fromUtf8(balloon->Text.getStrValue().data());
|
||||||
balloonLabel->setDimString(labelText, Rez::guiX(balloon->TextWrapLen.getValue()));
|
balloonLabel->setDimString(labelText, Rez::guiX(balloon->TextWrapLen.getValue()));
|
||||||
balloonLabel->setColor(getNormalColor());
|
setNormalColorAll();
|
||||||
balloonLines->setNormalColor(getNormalColor());
|
|
||||||
balloonShape->setNormalColor(getNormalColor());
|
|
||||||
arrow->setNormalColor(getNormalColor());
|
|
||||||
arrow->setFillColor(getNormalColor());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateBalloon();
|
updateBalloon();
|
||||||
@@ -409,9 +407,9 @@ void QGIViewBalloon::updateView(bool update)
|
|||||||
//update the bubble contents
|
//update the bubble contents
|
||||||
void QGIViewBalloon::updateBalloon(bool obtuse)
|
void QGIViewBalloon::updateBalloon(bool obtuse)
|
||||||
{
|
{
|
||||||
// Base::Console().Message("QGIVB::updateBalloon()\n");
|
// Base::Console().Message("QGIVB::updateBalloon()\n");
|
||||||
(void) obtuse;
|
(void)obtuse;
|
||||||
const auto balloon( dynamic_cast<TechDraw::DrawViewBalloon *>(getViewObject()) );
|
const auto balloon(dynamic_cast<TechDraw::DrawViewBalloon*>(getViewObject()));
|
||||||
if (!balloon) {
|
if (!balloon) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -419,15 +417,14 @@ void QGIViewBalloon::updateBalloon(bool obtuse)
|
|||||||
if (!vp) {
|
if (!vp) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const TechDraw::DrawViewPart *refObj = balloon->getViewPart();
|
const TechDraw::DrawViewPart* refObj = balloon->getViewPart();
|
||||||
if (!refObj) {
|
if (!refObj) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QFont font;
|
QFont font;
|
||||||
font.setFamily(QString::fromUtf8(vp->Font.getValue()));
|
font.setFamily(QString::fromUtf8(vp->Font.getValue()));
|
||||||
font.setPixelSize(exactFontSize(vp->Font.getValue(),
|
font.setPixelSize(exactFontSize(vp->Font.getValue(), vp->Fontsize.getValue()));
|
||||||
vp->Fontsize.getValue()));
|
|
||||||
balloonLabel->setFont(font);
|
balloonLabel->setFont(font);
|
||||||
|
|
||||||
QString labelText = QString::fromUtf8(balloon->Text.getStrValue().data());
|
QString labelText = QString::fromUtf8(balloon->Text.getStrValue().data());
|
||||||
@@ -455,27 +452,30 @@ void QGIViewBalloon::updateBalloon(bool obtuse)
|
|||||||
void QGIViewBalloon::balloonLabelDragged(bool ctrl)
|
void QGIViewBalloon::balloonLabelDragged(bool ctrl)
|
||||||
{
|
{
|
||||||
m_ctrl = ctrl;
|
m_ctrl = ctrl;
|
||||||
auto dvb( dynamic_cast<TechDraw::DrawViewBalloon *>(getViewObject()) );
|
auto dvb(dynamic_cast<TechDraw::DrawViewBalloon*>(getViewObject()));
|
||||||
if (!dvb)
|
if (!dvb) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!m_dragInProgress) { //first drag movement
|
if (!m_dragInProgress) {//first drag movement
|
||||||
m_dragInProgress = true;
|
m_dragInProgress = true;
|
||||||
if (ctrl) { //moving whole thing, remember Origin offset from Bubble
|
if (ctrl) {//moving whole thing, remember Origin offset from Bubble
|
||||||
m_saveOffset = dvb->getOriginOffset();
|
m_saveOffset = dvb->getOriginOffset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// store if origin is also moving to be able to later calc new origin and update feature
|
// store if origin is also moving to be able to later calc new origin and update feature
|
||||||
if (ctrl)
|
if (ctrl) {
|
||||||
m_originDragged = true;
|
m_originDragged = true;
|
||||||
|
}
|
||||||
|
|
||||||
DrawView* balloonParent = getSourceView();
|
DrawView* balloonParent = getSourceView();
|
||||||
if (balloonParent)
|
if (balloonParent) {
|
||||||
// redraw the balloon at the new position
|
// redraw the balloon at the new position
|
||||||
// note that we don't store the new position to the X/Y properties
|
// note that we don't store the new position to the X/Y properties
|
||||||
// since the dragging is not yet finished
|
// since the dragging is not yet finished
|
||||||
drawBalloon(true);
|
drawBalloon(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGIViewBalloon::balloonLabelDragFinished()
|
void QGIViewBalloon::balloonLabelDragFinished()
|
||||||
@@ -483,29 +483,36 @@ void QGIViewBalloon::balloonLabelDragFinished()
|
|||||||
// stores the final drag position for undo
|
// stores the final drag position for undo
|
||||||
|
|
||||||
auto dvb(dynamic_cast<TechDraw::DrawViewBalloon*>(getViewObject()));
|
auto dvb(dynamic_cast<TechDraw::DrawViewBalloon*>(getViewObject()));
|
||||||
if (!dvb)
|
if (!dvb) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
double scale = 1.0;
|
double scale = 1.0;
|
||||||
DrawView* balloonParent = getSourceView();
|
DrawView* balloonParent = getSourceView();
|
||||||
if (balloonParent)
|
if (balloonParent) {
|
||||||
scale = balloonParent->getScale();
|
scale = balloonParent->getScale();
|
||||||
|
}
|
||||||
|
|
||||||
//set feature position (x, y) from graphic position
|
//set feature position (x, y) from graphic position
|
||||||
double x = Rez::appX(balloonLabel->X() / scale),
|
double x = Rez::appX(balloonLabel->X() / scale), y = Rez::appX(balloonLabel->Y() / scale);
|
||||||
y = Rez::appX(balloonLabel->Y() / scale);
|
|
||||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Drag Balloon"));
|
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Drag Balloon"));
|
||||||
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.X = %f", dvb->getNameInDocument(), x);
|
Gui::Command::doCommand(
|
||||||
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.Y = %f", dvb->getNameInDocument(), -y);
|
Gui::Command::Doc, "App.ActiveDocument.%s.X = %f", dvb->getNameInDocument(), x);
|
||||||
|
Gui::Command::doCommand(
|
||||||
|
Gui::Command::Doc, "App.ActiveDocument.%s.Y = %f", dvb->getNameInDocument(), -y);
|
||||||
|
|
||||||
// for the case that origin was also dragged, calc new origin and update feature
|
// for the case that origin was also dragged, calc new origin and update feature
|
||||||
if (m_originDragged) {
|
if (m_originDragged) {
|
||||||
Base::Vector3d pos(x, -y, 0.0);
|
Base::Vector3d pos(x, -y, 0.0);
|
||||||
Base::Vector3d newOrg = pos - m_saveOffset;
|
Base::Vector3d newOrg = pos - m_saveOffset;
|
||||||
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.OriginX = %f",
|
Gui::Command::doCommand(Gui::Command::Doc,
|
||||||
dvb->getNameInDocument(), newOrg.x);
|
"App.ActiveDocument.%s.OriginX = %f",
|
||||||
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.OriginY = %f",
|
dvb->getNameInDocument(),
|
||||||
dvb->getNameInDocument(), newOrg.y);
|
newOrg.x);
|
||||||
|
Gui::Command::doCommand(Gui::Command::Doc,
|
||||||
|
"App.ActiveDocument.%s.OriginY = %f",
|
||||||
|
dvb->getNameInDocument(),
|
||||||
|
newOrg.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
Gui::Command::commitCommand();
|
Gui::Command::commitCommand();
|
||||||
@@ -517,9 +524,9 @@ void QGIViewBalloon::balloonLabelDragFinished()
|
|||||||
//from QGVP::mouseReleaseEvent - pos = eventPos in scene coords?
|
//from QGVP::mouseReleaseEvent - pos = eventPos in scene coords?
|
||||||
void QGIViewBalloon::placeBalloon(QPointF pos)
|
void QGIViewBalloon::placeBalloon(QPointF pos)
|
||||||
{
|
{
|
||||||
// Base::Console().Message("QGIVB::placeBalloon(%s)\n",
|
// Base::Console().Message("QGIVB::placeBalloon(%s)\n",
|
||||||
// DrawUtil::formatVector(pos).c_str());
|
// DrawUtil::formatVector(pos).c_str());
|
||||||
auto balloon( dynamic_cast<TechDraw::DrawViewBalloon*>(getViewObject()) );
|
auto balloon(dynamic_cast<TechDraw::DrawViewBalloon*>(getViewObject()));
|
||||||
if (!balloon) {
|
if (!balloon) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -546,13 +553,13 @@ void QGIViewBalloon::placeBalloon(QPointF pos)
|
|||||||
if (partVP) {
|
if (partVP) {
|
||||||
qgivParent = partVP->getQView();
|
qgivParent = partVP->getQView();
|
||||||
if (qgivParent) {
|
if (qgivParent) {
|
||||||
//tip position is mouse release pos in parentView coords ==> OriginX, OriginY
|
//tip position is mouse release pos in parentView coords ==> OriginX, OriginY
|
||||||
//bubble pos is some arbitrary shift from tip position ==> X, Y
|
//bubble pos is some arbitrary shift from tip position ==> X, Y
|
||||||
viewPos = qgivParent->mapFromScene(pos);
|
viewPos = qgivParent->mapFromScene(pos);
|
||||||
balloon->OriginX.setValue(Rez::appX(viewPos.x()) / balloonParent->getScale());
|
balloon->OriginX.setValue(Rez::appX(viewPos.x()) / balloonParent->getScale());
|
||||||
balloon->OriginY.setValue(-Rez::appX(viewPos.y()) / balloonParent->getScale());
|
balloon->OriginY.setValue(-Rez::appX(viewPos.y()) / balloonParent->getScale());
|
||||||
balloon->X.setValue(Rez::appX((viewPos.x() + 200.0) / balloonParent->getScale() ));
|
balloon->X.setValue(Rez::appX((viewPos.x() + 200.0) / balloonParent->getScale()));
|
||||||
balloon->Y.setValue(- Rez::appX((viewPos.y() - 200.0) / balloonParent->getScale() ));
|
balloon->Y.setValue(-Rez::appX((viewPos.y() - 200.0) / balloonParent->getScale()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -563,8 +570,7 @@ void QGIViewBalloon::placeBalloon(QPointF pos)
|
|||||||
QFont font = balloonLabel->getFont();
|
QFont font = balloonLabel->getFont();
|
||||||
font.setPixelSize(calculateFontPixelSize(vp->Fontsize.getValue()));
|
font.setPixelSize(calculateFontPixelSize(vp->Fontsize.getValue()));
|
||||||
font.setFamily(QString::fromUtf8(vp->Font.getValue()));
|
font.setFamily(QString::fromUtf8(vp->Font.getValue()));
|
||||||
font.setPixelSize(exactFontSize(vp->Font.getValue(),
|
font.setPixelSize(exactFontSize(vp->Font.getValue(), vp->Fontsize.getValue()));
|
||||||
vp->Fontsize.getValue()));
|
|
||||||
balloonLabel->setFont(font);
|
balloonLabel->setFont(font);
|
||||||
|
|
||||||
prepareGeometryChange();
|
prepareGeometryChange();
|
||||||
@@ -584,14 +590,14 @@ void QGIViewBalloon::draw()
|
|||||||
|
|
||||||
void QGIViewBalloon::drawBalloon(bool dragged)
|
void QGIViewBalloon::drawBalloon(bool dragged)
|
||||||
{
|
{
|
||||||
// Base::Console().Message("QGIVB::draw()\n");
|
// Base::Console().Message("QGIVB::draw()\n");
|
||||||
if (!isVisible()) {
|
if (!isVisible()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TechDraw::DrawViewBalloon *balloon = dynamic_cast<TechDraw::DrawViewBalloon *>(getViewObject());
|
TechDraw::DrawViewBalloon* balloon = dynamic_cast<TechDraw::DrawViewBalloon*>(getViewObject());
|
||||||
if((!balloon) || //nothing to draw, don't try
|
if ((!balloon) ||//nothing to draw, don't try
|
||||||
(!balloon->isDerivedFrom(TechDraw::DrawViewBalloon::getClassTypeId()))) {
|
(!balloon->isDerivedFrom(TechDraw::DrawViewBalloon::getClassTypeId()))) {
|
||||||
balloonLabel->hide();
|
balloonLabel->hide();
|
||||||
hide();
|
hide();
|
||||||
return;
|
return;
|
||||||
@@ -600,11 +606,11 @@ void QGIViewBalloon::drawBalloon(bool dragged)
|
|||||||
balloonLabel->show();
|
balloonLabel->show();
|
||||||
show();
|
show();
|
||||||
|
|
||||||
const TechDraw::DrawViewPart *refObj = balloon->getViewPart();
|
const TechDraw::DrawViewPart* refObj = balloon->getViewPart();
|
||||||
if (!refObj) {
|
if (!refObj) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(!refObj->hasGeometry()) { // nothing to draw yet (restoring)
|
if (!refObj->hasGeometry()) {// nothing to draw yet (restoring)
|
||||||
balloonLabel->hide();
|
balloonLabel->hide();
|
||||||
hide();
|
hide();
|
||||||
return;
|
return;
|
||||||
@@ -646,110 +652,143 @@ void QGIViewBalloon::drawBalloon(bool dragged)
|
|||||||
|
|
||||||
if (balloon->isLocked()) {
|
if (balloon->isLocked()) {
|
||||||
balloonLabel->setFlag(QGraphicsItem::ItemIsMovable, false);
|
balloonLabel->setFlag(QGraphicsItem::ItemIsMovable, false);
|
||||||
} else
|
}
|
||||||
|
else {
|
||||||
balloonLabel->setFlag(QGraphicsItem::ItemIsMovable, true);
|
balloonLabel->setFlag(QGraphicsItem::ItemIsMovable, true);
|
||||||
|
}
|
||||||
|
|
||||||
Base::Vector3d dLineStart;
|
Base::Vector3d dLineStart;
|
||||||
Base::Vector3d kinkPoint;
|
Base::Vector3d kinkPoint;
|
||||||
double kinkLength = Rez::guiX(balloon->KinkLength.getValue());
|
double kinkLength = Rez::guiX(balloon->KinkLength.getValue());
|
||||||
|
|
||||||
const char *balloonType = balloon->BubbleShape.getValueAsString();
|
const char* balloonType = balloon->BubbleShape.getValueAsString();
|
||||||
|
|
||||||
float scale = balloon->ShapeScale.getValue();
|
float scale = balloon->ShapeScale.getValue();
|
||||||
double offsetLR = 0;
|
double offsetLR = 0;
|
||||||
double offsetUD = 0;
|
double offsetUD = 0;
|
||||||
QPainterPath balloonPath;
|
QPainterPath balloonPath;
|
||||||
|
|
||||||
if (strcmp(balloonType, "Circular") == 0) {
|
if (strcmp(balloonType, "Circular") == 0) {
|
||||||
double balloonRadius = sqrt(pow((textHeight / 2.0), 2) + pow((textWidth / 2.0), 2));
|
double balloonRadius = sqrt(pow((textHeight / 2.0), 2) + pow((textWidth / 2.0), 2));
|
||||||
balloonRadius = balloonRadius * scale;
|
balloonRadius = balloonRadius * scale;
|
||||||
balloonPath.moveTo(lblCenter.x, lblCenter.y);
|
balloonPath.moveTo(lblCenter.x, lblCenter.y);
|
||||||
balloonPath.addEllipse(lblCenter.x - balloonRadius, lblCenter.y - balloonRadius, balloonRadius * 2, balloonRadius * 2);
|
balloonPath.addEllipse(lblCenter.x - balloonRadius,
|
||||||
offsetLR = balloonRadius;
|
lblCenter.y - balloonRadius,
|
||||||
} else if (strcmp(balloonType, "None") == 0) {
|
balloonRadius * 2,
|
||||||
|
balloonRadius * 2);
|
||||||
|
offsetLR = balloonRadius;
|
||||||
|
}
|
||||||
|
else if (strcmp(balloonType, "None") == 0) {
|
||||||
balloonPath = QPainterPath();
|
balloonPath = QPainterPath();
|
||||||
offsetLR = (textWidth / 2.0) + Rez::guiX(2.0);
|
offsetLR = (textWidth / 2.0) + Rez::guiX(2.0);
|
||||||
} else if (strcmp(balloonType, "Rectangle") == 0) {
|
}
|
||||||
|
else if (strcmp(balloonType, "Rectangle") == 0) {
|
||||||
//Add some room
|
//Add some room
|
||||||
textHeight = (textHeight * scale) + Rez::guiX(1.0);
|
textHeight = (textHeight * scale) + Rez::guiX(1.0);
|
||||||
// we add some textWidth later because we first need to handle the text separators
|
// we add some textWidth later because we first need to handle the text separators
|
||||||
if (balloonLabel->getVerticalSep()) {
|
if (balloonLabel->getVerticalSep()) {
|
||||||
for (auto& sep : balloonLabel->getSeps()) {
|
for (auto& sep : balloonLabel->getSeps()) {
|
||||||
balloonPath.moveTo(lblCenter.x - (textWidth / 2.0) + sep, lblCenter.y - (textHeight / 2.0));
|
balloonPath.moveTo(lblCenter.x - (textWidth / 2.0) + sep,
|
||||||
balloonPath.lineTo(lblCenter.x - (textWidth / 2.0) + sep, lblCenter.y + (textHeight / 2.0));
|
lblCenter.y - (textHeight / 2.0));
|
||||||
|
balloonPath.lineTo(lblCenter.x - (textWidth / 2.0) + sep,
|
||||||
|
lblCenter.y + (textHeight / 2.0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
textWidth = (textWidth * scale) + Rez::guiX(2.0);
|
textWidth = (textWidth * scale) + Rez::guiX(2.0);
|
||||||
balloonPath.addRect(lblCenter.x - (textWidth / 2.0), lblCenter.y - (textHeight / 2.0), textWidth, textHeight);
|
balloonPath.addRect(lblCenter.x - (textWidth / 2.0),
|
||||||
offsetLR = (textWidth / 2.0);
|
lblCenter.y - (textHeight / 2.0),
|
||||||
} else if (strcmp(balloonType, "Triangle") == 0) {
|
textWidth,
|
||||||
|
textHeight);
|
||||||
|
offsetLR = (textWidth / 2.0);
|
||||||
|
}
|
||||||
|
else if (strcmp(balloonType, "Triangle") == 0) {
|
||||||
double radius = sqrt(pow((textHeight / 2.0), 2) + pow((textWidth / 2.0), 2));
|
double radius = sqrt(pow((textHeight / 2.0), 2) + pow((textWidth / 2.0), 2));
|
||||||
radius = radius * scale;
|
radius = radius * scale;
|
||||||
radius += Rez::guiX(3.0);
|
radius += Rez::guiX(3.0);
|
||||||
offsetLR = (tan(30 * M_PI / 180) * radius);
|
offsetLR = (tan(30 * M_PI / 180) * radius);
|
||||||
QPolygonF triangle;
|
QPolygonF triangle;
|
||||||
double startAngle = -M_PI / 2;
|
double startAngle = -M_PI / 2;
|
||||||
double angle = startAngle;
|
double angle = startAngle;
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
triangle += QPointF(lblCenter.x + (radius * cos(angle)), lblCenter.y + (radius * sin(angle)));
|
triangle +=
|
||||||
|
QPointF(lblCenter.x + (radius * cos(angle)), lblCenter.y + (radius * sin(angle)));
|
||||||
angle += (2 * M_PI / 3);
|
angle += (2 * M_PI / 3);
|
||||||
}
|
}
|
||||||
balloonPath.moveTo(lblCenter.x + (radius * cos(startAngle)), lblCenter.y + (radius * sin(startAngle)));
|
balloonPath.moveTo(lblCenter.x + (radius * cos(startAngle)),
|
||||||
|
lblCenter.y + (radius * sin(startAngle)));
|
||||||
balloonPath.addPolygon(triangle);
|
balloonPath.addPolygon(triangle);
|
||||||
} else if (strcmp(balloonType, "Inspection") == 0) {
|
}
|
||||||
|
else if (strcmp(balloonType, "Inspection") == 0) {
|
||||||
//Add some room
|
//Add some room
|
||||||
textWidth = (textWidth * scale) + Rez::guiX(2.0);
|
textWidth = (textWidth * scale) + Rez::guiX(2.0);
|
||||||
textHeight = (textHeight * scale) + Rez::guiX(1.0);
|
textHeight = (textHeight * scale) + Rez::guiX(1.0);
|
||||||
QPointF textBoxCorner(lblCenter.x - (textWidth / 2.0), lblCenter.y - (textHeight / 2.0));
|
QPointF textBoxCorner(lblCenter.x - (textWidth / 2.0), lblCenter.y - (textHeight / 2.0));
|
||||||
balloonPath.moveTo(textBoxCorner);
|
balloonPath.moveTo(textBoxCorner);
|
||||||
balloonPath.lineTo(textBoxCorner.x() + textWidth, textBoxCorner.y());
|
balloonPath.lineTo(textBoxCorner.x() + textWidth, textBoxCorner.y());
|
||||||
balloonPath.arcTo(textBoxCorner.x() + textWidth - (textHeight / 2.0), textBoxCorner.y(), textHeight, textHeight, 90, -180);
|
balloonPath.arcTo(textBoxCorner.x() + textWidth - (textHeight / 2.0),
|
||||||
|
textBoxCorner.y(),
|
||||||
|
textHeight,
|
||||||
|
textHeight,
|
||||||
|
90,
|
||||||
|
-180);
|
||||||
balloonPath.lineTo(textBoxCorner.x(), textBoxCorner.y() + textHeight);
|
balloonPath.lineTo(textBoxCorner.x(), textBoxCorner.y() + textHeight);
|
||||||
balloonPath.arcTo(textBoxCorner.x() - (textHeight / 2), textBoxCorner.y(), textHeight, textHeight, -90, -180);
|
balloonPath.arcTo(textBoxCorner.x() - (textHeight / 2),
|
||||||
offsetLR = (textWidth / 2.0) + (textHeight / 2.0);
|
textBoxCorner.y(),
|
||||||
} else if (strcmp(balloonType, "Square") == 0) {
|
textHeight,
|
||||||
|
textHeight,
|
||||||
|
-90,
|
||||||
|
-180);
|
||||||
|
offsetLR = (textWidth / 2.0) + (textHeight / 2.0);
|
||||||
|
}
|
||||||
|
else if (strcmp(balloonType, "Square") == 0) {
|
||||||
//Add some room
|
//Add some room
|
||||||
textWidth = (textWidth * scale) + Rez::guiX(2.0);
|
textWidth = (textWidth * scale) + Rez::guiX(2.0);
|
||||||
textHeight = (textHeight * scale) + Rez::guiX(1.0);
|
textHeight = (textHeight * scale) + Rez::guiX(1.0);
|
||||||
double max = std::max(textWidth, textHeight);
|
double max = std::max(textWidth, textHeight);
|
||||||
balloonPath.addRect(lblCenter.x -(max / 2.0), lblCenter.y - (max / 2.0), max, max);
|
balloonPath.addRect(lblCenter.x - (max / 2.0), lblCenter.y - (max / 2.0), max, max);
|
||||||
offsetLR = (max / 2.0);
|
offsetLR = (max / 2.0);
|
||||||
} else if (strcmp(balloonType, "Hexagon") == 0) {
|
}
|
||||||
|
else if (strcmp(balloonType, "Hexagon") == 0) {
|
||||||
double radius = sqrt(pow((textHeight / 2.0), 2) + pow((textWidth / 2.0), 2));
|
double radius = sqrt(pow((textHeight / 2.0), 2) + pow((textWidth / 2.0), 2));
|
||||||
radius = radius * scale;
|
radius = radius * scale;
|
||||||
radius += Rez::guiX(1.0);
|
radius += Rez::guiX(1.0);
|
||||||
offsetLR = radius;
|
offsetLR = radius;
|
||||||
QPolygonF triangle;
|
QPolygonF triangle;
|
||||||
double startAngle = -2 * M_PI / 3;
|
double startAngle = -2 * M_PI / 3;
|
||||||
double angle = startAngle;
|
double angle = startAngle;
|
||||||
for (int i = 0; i < 7; i++) {
|
for (int i = 0; i < 7; i++) {
|
||||||
triangle += QPointF(lblCenter.x + (radius * cos(angle)), lblCenter.y + (radius * sin(angle)));
|
triangle +=
|
||||||
|
QPointF(lblCenter.x + (radius * cos(angle)), lblCenter.y + (radius * sin(angle)));
|
||||||
angle += (2 * M_PI / 6);
|
angle += (2 * M_PI / 6);
|
||||||
}
|
}
|
||||||
balloonPath.moveTo(lblCenter.x + (radius * cos(startAngle)), lblCenter.y + (radius * sin(startAngle)));
|
balloonPath.moveTo(lblCenter.x + (radius * cos(startAngle)),
|
||||||
|
lblCenter.y + (radius * sin(startAngle)));
|
||||||
balloonPath.addPolygon(triangle);
|
balloonPath.addPolygon(triangle);
|
||||||
}
|
}
|
||||||
else if (strcmp(balloonType, "Line") == 0) {
|
else if (strcmp(balloonType, "Line") == 0) {
|
||||||
textHeight = textHeight*scale + Rez::guiX(0.5);
|
textHeight = textHeight * scale + Rez::guiX(0.5);
|
||||||
textWidth = textWidth*scale + Rez::guiX(1.0);
|
textWidth = textWidth * scale + Rez::guiX(1.0);
|
||||||
|
|
||||||
offsetLR = textWidth/2.0;
|
offsetLR = textWidth / 2.0;
|
||||||
offsetUD = textHeight/2.0;
|
offsetUD = textHeight / 2.0;
|
||||||
|
|
||||||
balloonPath.moveTo(lblCenter.x - textWidth/2.0, lblCenter.y + offsetUD);
|
balloonPath.moveTo(lblCenter.x - textWidth / 2.0, lblCenter.y + offsetUD);
|
||||||
balloonPath.lineTo(lblCenter.x + textWidth/2.0, lblCenter.y + offsetUD);
|
balloonPath.lineTo(lblCenter.x + textWidth / 2.0, lblCenter.y + offsetUD);
|
||||||
}
|
}
|
||||||
|
|
||||||
balloonShape->setPath(balloonPath);
|
balloonShape->setPath(balloonPath);
|
||||||
|
|
||||||
offsetLR = (lblCenter.x < arrowTipX) ? offsetLR : -offsetLR ;
|
offsetLR = (lblCenter.x < arrowTipX) ? offsetLR : -offsetLR;
|
||||||
|
|
||||||
if (DrawUtil::fpCompare(kinkLength, 0.0) && strcmp(balloonType, "Line")) { //if no kink, then dLine start sb on line from center to arrow
|
if (DrawUtil::fpCompare(kinkLength, 0.0)
|
||||||
|
&& strcmp(balloonType,
|
||||||
|
"Line")) {//if no kink, then dLine start sb on line from center to arrow
|
||||||
dLineStart = lblCenter;
|
dLineStart = lblCenter;
|
||||||
kinkPoint = dLineStart;
|
kinkPoint = dLineStart;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
dLineStart.y = lblCenter.y + offsetUD;
|
dLineStart.y = lblCenter.y + offsetUD;
|
||||||
dLineStart.x = lblCenter.x + offsetLR ;
|
dLineStart.x = lblCenter.x + offsetLR;
|
||||||
kinkLength = (lblCenter.x < arrowTipX) ? kinkLength : -kinkLength;
|
kinkLength = (lblCenter.x < arrowTipX) ? kinkLength : -kinkLength;
|
||||||
kinkPoint.y = dLineStart.y;
|
kinkPoint.y = dLineStart.y;
|
||||||
kinkPoint.x = dLineStart.x + kinkLength;
|
kinkPoint.x = dLineStart.x + kinkLength;
|
||||||
@@ -762,41 +801,45 @@ void QGIViewBalloon::drawBalloon(bool dragged)
|
|||||||
double xAdj = 0.0;
|
double xAdj = 0.0;
|
||||||
double yAdj = 0.0;
|
double yAdj = 0.0;
|
||||||
int endType = balloon->EndType.getValue();
|
int endType = balloon->EndType.getValue();
|
||||||
double arrowAdj = QGIArrow::getOverlapAdjust(endType,
|
double arrowAdj = QGIArrow::getOverlapAdjust(
|
||||||
balloon->EndTypeScale.getValue()*QGIArrow::getPrefArrowSize());
|
endType, balloon->EndTypeScale.getValue() * QGIArrow::getPrefArrowSize());
|
||||||
|
|
||||||
if (endType == ArrowType::NONE) {
|
if (endType == ArrowType::NONE) {
|
||||||
arrow->hide();
|
arrow->hide();
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
arrow->setStyle(endType);
|
arrow->setStyle(endType);
|
||||||
|
|
||||||
arrow->setSize(balloon->EndTypeScale.getValue()*QGIArrow::getPrefArrowSize());
|
arrow->setSize(balloon->EndTypeScale.getValue() * QGIArrow::getPrefArrowSize());
|
||||||
arrow->draw();
|
arrow->draw();
|
||||||
|
|
||||||
Base::Vector3d arrowTipPos(arrowTipX, arrowTipY, 0.0);
|
Base::Vector3d arrowTipPos(arrowTipX, arrowTipY, 0.0);
|
||||||
Base::Vector3d dirballoonLinesLine;
|
Base::Vector3d dirballoonLinesLine;
|
||||||
if (!DrawUtil::fpCompare(kinkLength, 0.0)) {
|
if (!DrawUtil::fpCompare(kinkLength, 0.0)) {
|
||||||
dirballoonLinesLine = (arrowTipPos - kinkPoint).Normalize();
|
dirballoonLinesLine = (arrowTipPos - kinkPoint).Normalize();
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
dirballoonLinesLine = (arrowTipPos - dLineStart).Normalize();
|
dirballoonLinesLine = (arrowTipPos - dLineStart).Normalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
float arAngle = atan2(dirballoonLinesLine.y, dirballoonLinesLine.x) * 180 / M_PI;
|
float arAngle = atan2(dirballoonLinesLine.y, dirballoonLinesLine.x) * 180 / M_PI;
|
||||||
|
|
||||||
arrow->setPos(arrowTipX, arrowTipY);
|
arrow->setPos(arrowTipX, arrowTipY);
|
||||||
if ( (endType == ArrowType::FILLED_TRIANGLE) &&
|
if ((endType == ArrowType::FILLED_TRIANGLE) && (prefOrthoPyramid())) {
|
||||||
(prefOrthoPyramid()) ) {
|
|
||||||
if (arAngle < 0.0) {
|
if (arAngle < 0.0) {
|
||||||
arAngle += 360.0;
|
arAngle += 360.0;
|
||||||
}
|
}
|
||||||
//set the angle to closest cardinal direction
|
//set the angle to closest cardinal direction
|
||||||
if ( (45.0 < arAngle) && (arAngle < 135.0) ) {
|
if ((45.0 < arAngle) && (arAngle < 135.0)) {
|
||||||
arAngle = 90.0;
|
arAngle = 90.0;
|
||||||
} else if ( (135.0 < arAngle) && (arAngle < 225.0) ) {
|
}
|
||||||
|
else if ((135.0 < arAngle) && (arAngle < 225.0)) {
|
||||||
arAngle = 180.0;
|
arAngle = 180.0;
|
||||||
} else if ( (225.0 < arAngle) && (arAngle < 315.0) ) {
|
}
|
||||||
|
else if ((225.0 < arAngle) && (arAngle < 315.0)) {
|
||||||
arAngle = 270.0;
|
arAngle = 270.0;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
arAngle = 0;
|
arAngle = 0;
|
||||||
}
|
}
|
||||||
double radAngle = arAngle * M_PI / 180.0;
|
double radAngle = arAngle * M_PI / 180.0;
|
||||||
@@ -820,15 +863,18 @@ void QGIViewBalloon::drawBalloon(bool dragged)
|
|||||||
// redraw the Balloon and the parent View
|
// redraw the Balloon and the parent View
|
||||||
if (hasHover && !isSelected()) {
|
if (hasHover && !isSelected()) {
|
||||||
setPrettyPre();
|
setPrettyPre();
|
||||||
} else if (isSelected()) {
|
}
|
||||||
|
else if (isSelected()) {
|
||||||
setPrettySel();
|
setPrettySel();
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
setPrettyNormal();
|
setPrettyNormal();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parentItem()) {
|
if (parentItem()) {
|
||||||
parentItem()->update();
|
parentItem()->update();
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
Base::Console().Log("INFO - QGIVB::draw - no parent to update\n");
|
Base::Console().Log("INFO - QGIVB::draw - no parent to update\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -838,16 +884,16 @@ void QGIViewBalloon::setPrettyPre(void)
|
|||||||
arrow->setPrettyPre();
|
arrow->setPrettyPre();
|
||||||
//TODO: primPath needs override for fill
|
//TODO: primPath needs override for fill
|
||||||
//balloonShape->setFillOverride(true); //don't fill with pre or select colours.
|
//balloonShape->setFillOverride(true); //don't fill with pre or select colours.
|
||||||
// balloonShape->setFill(Qt::white, Qt::NoBrush);
|
// balloonShape->setFill(Qt::white, Qt::NoBrush);
|
||||||
balloonShape->setPrettyPre();
|
balloonShape->setPrettyPre();
|
||||||
balloonLines->setPrettyPre();
|
balloonLines->setPrettyPre();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGIViewBalloon::setPrettySel(void)
|
void QGIViewBalloon::setPrettySel(void)
|
||||||
{
|
{
|
||||||
// Base::Console().Message("QGIVBal::setPrettySel()\n");
|
// Base::Console().Message("QGIVBal::setPrettySel()\n");
|
||||||
arrow->setPrettySel();
|
arrow->setPrettySel();
|
||||||
// balloonShape->setFill(Qt::white, Qt::NoBrush);
|
// balloonShape->setFill(Qt::white, Qt::NoBrush);
|
||||||
balloonShape->setPrettySel();
|
balloonShape->setPrettySel();
|
||||||
balloonLines->setPrettySel();
|
balloonLines->setPrettySel();
|
||||||
}
|
}
|
||||||
@@ -855,7 +901,7 @@ void QGIViewBalloon::setPrettySel(void)
|
|||||||
void QGIViewBalloon::setPrettyNormal(void)
|
void QGIViewBalloon::setPrettyNormal(void)
|
||||||
{
|
{
|
||||||
arrow->setPrettyNormal();
|
arrow->setPrettyNormal();
|
||||||
// balloonShape->setFill(Qt::white, Qt::SolidPattern);
|
// balloonShape->setFill(Qt::white, Qt::SolidPattern);
|
||||||
balloonShape->setPrettyNormal();
|
balloonShape->setPrettyNormal();
|
||||||
balloonLines->setPrettyNormal();
|
balloonLines->setPrettyNormal();
|
||||||
}
|
}
|
||||||
@@ -863,11 +909,13 @@ void QGIViewBalloon::setPrettyNormal(void)
|
|||||||
|
|
||||||
void QGIViewBalloon::drawBorder(void)
|
void QGIViewBalloon::drawBorder(void)
|
||||||
{
|
{
|
||||||
//Dimensions have no border!
|
//Dimensions have no border!
|
||||||
// Base::Console().Message("TRACE - QGIViewDimension::drawBorder - doing nothing!\n");
|
// Base::Console().Message("TRACE - QGIViewDimension::drawBorder - doing nothing!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGIViewBalloon::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget) {
|
void QGIViewBalloon::paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
|
||||||
|
QWidget* widget)
|
||||||
|
{
|
||||||
QStyleOptionGraphicsItem myOption(*option);
|
QStyleOptionGraphicsItem myOption(*option);
|
||||||
myOption.state &= ~QStyle::State_Selected;
|
myOption.state &= ~QStyle::State_Selected;
|
||||||
|
|
||||||
@@ -876,19 +924,20 @@ void QGIViewBalloon::paint ( QPainter * painter, const QStyleOptionGraphicsItem
|
|||||||
setPens();
|
setPens();
|
||||||
if (svg) {
|
if (svg) {
|
||||||
setSvgPens();
|
setSvgPens();
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
setPens();
|
setPens();
|
||||||
}
|
}
|
||||||
QGIView::paint (painter, &myOption, widget);
|
QGIView::paint(painter, &myOption, widget);
|
||||||
setPens();
|
setPens();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGIViewBalloon::setSvgPens(void)
|
void QGIViewBalloon::setSvgPens(void)
|
||||||
{
|
{
|
||||||
double svgLineFactor = 3.0; //magic number. should be a setting somewhere.
|
double svgLineFactor = 3.0;//magic number. should be a setting somewhere.
|
||||||
balloonLines->setWidth(m_lineWidth/svgLineFactor);
|
balloonLines->setWidth(m_lineWidth / svgLineFactor);
|
||||||
balloonShape->setWidth(m_lineWidth/svgLineFactor);
|
balloonShape->setWidth(m_lineWidth / svgLineFactor);
|
||||||
arrow->setWidth(arrow->getWidth()/svgLineFactor);
|
arrow->setWidth(arrow->getWidth() / svgLineFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGIViewBalloon::setPens(void)
|
void QGIViewBalloon::setPens(void)
|
||||||
@@ -898,16 +947,26 @@ void QGIViewBalloon::setPens(void)
|
|||||||
arrow->setWidth(m_lineWidth);
|
arrow->setWidth(m_lineWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QGIViewBalloon::setNormalColorAll()
|
||||||
|
{
|
||||||
|
QColor qc = prefNormalColor();
|
||||||
|
balloonLabel->setColor(qc);
|
||||||
|
balloonLines->setNormalColor(qc);
|
||||||
|
balloonShape->setNormalColor(qc);
|
||||||
|
arrow->setNormalColor(qc);
|
||||||
|
arrow->setFillColor(qc);
|
||||||
|
}
|
||||||
|
|
||||||
QColor QGIViewBalloon::prefNormalColor()
|
QColor QGIViewBalloon::prefNormalColor()
|
||||||
{
|
{
|
||||||
setNormalColor(PreferencesGui::dimQColor());
|
setNormalColor(PreferencesGui::getAccessibleQColor(PreferencesGui::dimQColor()));
|
||||||
|
|
||||||
ViewProviderBalloon* vpBalloon = nullptr;
|
ViewProviderBalloon* vpBalloon = nullptr;
|
||||||
Gui::ViewProvider* vp = getViewProvider(getBalloonFeat());
|
Gui::ViewProvider* vp = getViewProvider(getBalloonFeat());
|
||||||
if (vp) {
|
if (vp) {
|
||||||
vpBalloon = dynamic_cast<ViewProviderBalloon*>(vp);
|
vpBalloon = dynamic_cast<ViewProviderBalloon*>(vp);
|
||||||
if (vpBalloon) {
|
if (vpBalloon) {
|
||||||
App::Color fcColor = vpBalloon->Color.getValue();
|
App::Color fcColor = Preferences::getAccessibleColor(vpBalloon->Color.getValue());
|
||||||
setNormalColor(fcColor.asValue<QColor>());
|
setNormalColor(fcColor.asValue<QColor>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -924,9 +983,11 @@ int QGIViewBalloon::prefDefaultArrow() const
|
|||||||
//when would you want a crooked pyramid?
|
//when would you want a crooked pyramid?
|
||||||
bool QGIViewBalloon::prefOrthoPyramid() const
|
bool QGIViewBalloon::prefOrthoPyramid() const
|
||||||
{
|
{
|
||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
|
||||||
.GetGroup("BaseApp")->GetGroup("Preferences")->
|
.GetUserParameter()
|
||||||
GetGroup("Mod/TechDraw/Decorations");
|
.GetGroup("BaseApp")
|
||||||
|
->GetGroup("Preferences")
|
||||||
|
->GetGroup("Mod/TechDraw/Decorations");
|
||||||
bool ortho = hGrp->GetBool("PyramidOrtho", true);
|
bool ortho = hGrp->GetBool("PyramidOrtho", true);
|
||||||
return ortho;
|
return ortho;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,15 +38,17 @@
|
|||||||
#include "QGIView.h"
|
#include "QGIView.h"
|
||||||
|
|
||||||
|
|
||||||
namespace TechDraw {
|
namespace TechDraw
|
||||||
|
{
|
||||||
class DrawViewBalloon;
|
class DrawViewBalloon;
|
||||||
class DrawView;
|
class DrawView;
|
||||||
}
|
}// namespace TechDraw
|
||||||
|
|
||||||
namespace TechDraw {
|
namespace TechDraw
|
||||||
|
{
|
||||||
class BaseGeom;
|
class BaseGeom;
|
||||||
class AOC;
|
class AOC;
|
||||||
}
|
}// namespace TechDraw
|
||||||
|
|
||||||
namespace TechDrawGui
|
namespace TechDrawGui
|
||||||
{
|
{
|
||||||
@@ -54,29 +56,43 @@ class QGIArrow;
|
|||||||
class QGIDimLines;
|
class QGIDimLines;
|
||||||
class QGIViewBalloon;
|
class QGIViewBalloon;
|
||||||
|
|
||||||
class QGIBalloonLabel : public QGraphicsObject
|
class QGIBalloonLabel: public QGraphicsObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QGIBalloonLabel();
|
QGIBalloonLabel();
|
||||||
~QGIBalloonLabel() = default;
|
~QGIBalloonLabel() = default;
|
||||||
|
|
||||||
enum {Type = QGraphicsItem::UserType + 141};
|
enum
|
||||||
int type() const override { return Type;}
|
{
|
||||||
|
Type = QGraphicsItem::UserType + 141
|
||||||
|
};
|
||||||
|
int type() const override
|
||||||
|
{
|
||||||
|
return Type;
|
||||||
|
}
|
||||||
|
|
||||||
QRectF boundingRect() const override;
|
QRectF boundingRect() const override;
|
||||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent* event) override;
|
||||||
void paint( QPainter *painter,
|
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
|
||||||
const QStyleOptionGraphicsItem *option,
|
QWidget* widget = nullptr) override;
|
||||||
QWidget *widget = nullptr ) override;
|
|
||||||
void setLabelCenter();
|
void setLabelCenter();
|
||||||
void setPosFromCenter(const double &xCenter, const double &yCenter);
|
void setPosFromCenter(const double& xCenter, const double& yCenter);
|
||||||
double X() const { return posX; }
|
double X() const
|
||||||
double Y() const { return posY; } //minus posY?
|
{
|
||||||
|
return posX;
|
||||||
|
}
|
||||||
|
double Y() const
|
||||||
|
{
|
||||||
|
return posY;
|
||||||
|
}//minus posY?
|
||||||
|
|
||||||
void setFont(QFont font);
|
void setFont(QFont font);
|
||||||
QFont getFont() { return m_labelText->font(); }
|
QFont getFont()
|
||||||
|
{
|
||||||
|
return m_labelText->font();
|
||||||
|
}
|
||||||
void setDimString(QString text);
|
void setDimString(QString text);
|
||||||
void setDimString(QString text, qreal maxWidth);
|
void setDimString(QString text, qreal maxWidth);
|
||||||
void setPrettySel();
|
void setPrettySel();
|
||||||
@@ -84,16 +100,37 @@ public:
|
|||||||
void setPrettyNormal();
|
void setPrettyNormal();
|
||||||
void setColor(QColor color);
|
void setColor(QColor color);
|
||||||
|
|
||||||
void setQBalloon(QGIViewBalloon* qBalloon) { parent = qBalloon;}
|
void setQBalloon(QGIViewBalloon* qBalloon)
|
||||||
|
{
|
||||||
|
parent = qBalloon;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QGCustomText* getDimText() { return m_labelText; }
|
QGCustomText* getDimText()
|
||||||
|
{
|
||||||
|
return m_labelText;
|
||||||
|
}
|
||||||
|
|
||||||
void setDimText(QGCustomText* newText) { m_labelText = newText; }
|
void setDimText(QGCustomText* newText)
|
||||||
bool getVerticalSep() const { return verticalSep; }
|
{
|
||||||
void setVerticalSep(bool sep) { verticalSep = sep; }
|
m_labelText = newText;
|
||||||
std::vector<int> getSeps() const { return seps; }
|
}
|
||||||
void setSeps(std::vector<int> newSeps) { seps = newSeps; }
|
bool getVerticalSep() const
|
||||||
|
{
|
||||||
|
return verticalSep;
|
||||||
|
}
|
||||||
|
void setVerticalSep(bool sep)
|
||||||
|
{
|
||||||
|
verticalSep = sep;
|
||||||
|
}
|
||||||
|
std::vector<int> getSeps() const
|
||||||
|
{
|
||||||
|
return seps;
|
||||||
|
}
|
||||||
|
void setSeps(std::vector<int> newSeps)
|
||||||
|
{
|
||||||
|
seps = newSeps;
|
||||||
|
}
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void dragging(bool state);
|
void dragging(bool state);
|
||||||
@@ -102,16 +139,16 @@ Q_SIGNALS:
|
|||||||
void dragFinished();
|
void dragFinished();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
|
QVariant itemChange(GraphicsItemChange change, const QVariant& value) override;
|
||||||
void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
|
void mousePressEvent(QGraphicsSceneMouseEvent* event) override;
|
||||||
void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override;
|
void hoverEnterEvent(QGraphicsSceneHoverEvent* event) override;
|
||||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override;
|
void hoverLeaveEvent(QGraphicsSceneHoverEvent* event) override;
|
||||||
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override;
|
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool hasHover;
|
bool hasHover;
|
||||||
|
|
||||||
QGIViewBalloon *parent;
|
QGIViewBalloon* parent;
|
||||||
bool verticalSep;
|
bool verticalSep;
|
||||||
std::vector<int> seps;
|
std::vector<int> seps;
|
||||||
|
|
||||||
@@ -126,24 +163,29 @@ private:
|
|||||||
|
|
||||||
//*******************************************************************
|
//*******************************************************************
|
||||||
|
|
||||||
class TechDrawGuiExport QGIViewBalloon : public QGIView
|
class TechDrawGuiExport QGIViewBalloon: public QGIView
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum {Type = QGraphicsItem::UserType + 140};
|
enum
|
||||||
|
{
|
||||||
|
Type = QGraphicsItem::UserType + 140
|
||||||
|
};
|
||||||
|
|
||||||
explicit QGIViewBalloon();
|
explicit QGIViewBalloon();
|
||||||
~QGIViewBalloon() = default;
|
~QGIViewBalloon() = default;
|
||||||
|
|
||||||
void setViewPartFeature(TechDraw::DrawViewBalloon *balloonFeat);
|
void setViewPartFeature(TechDraw::DrawViewBalloon* balloonFeat);
|
||||||
int type() const override { return Type;}
|
int type() const override
|
||||||
|
{
|
||||||
|
return Type;
|
||||||
|
}
|
||||||
|
|
||||||
void drawBorder() override;
|
void drawBorder() override;
|
||||||
void updateView(bool update = false) override;
|
void updateView(bool update = false) override;
|
||||||
void paint( QPainter * painter,
|
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
|
||||||
const QStyleOptionGraphicsItem * option,
|
QWidget* widget = nullptr) override;
|
||||||
QWidget * widget = nullptr ) override;
|
|
||||||
|
|
||||||
QString getLabelText();
|
QString getLabelText();
|
||||||
void placeBalloon(QPointF pos);
|
void placeBalloon(QPointF pos);
|
||||||
@@ -152,12 +194,20 @@ public:
|
|||||||
void setPrettyNormal();
|
void setPrettyNormal();
|
||||||
|
|
||||||
void setGroupSelection(bool isSelected) override;
|
void setGroupSelection(bool isSelected) override;
|
||||||
virtual QGIBalloonLabel* getBalloonLabel() { return balloonLabel; }
|
virtual QGIBalloonLabel* getBalloonLabel()
|
||||||
|
{
|
||||||
|
return balloonLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setNormalColorAll();
|
||||||
QColor prefNormalColor();
|
QColor prefNormalColor();
|
||||||
int prefDefaultArrow() const;
|
int prefDefaultArrow() const;
|
||||||
bool prefOrthoPyramid() const;
|
bool prefOrthoPyramid() const;
|
||||||
TechDraw::DrawViewBalloon* getBalloonFeat() { return dvBalloon; }
|
|
||||||
|
TechDraw::DrawViewBalloon* getBalloonFeat()
|
||||||
|
{
|
||||||
|
return dvBalloon;
|
||||||
|
}
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void balloonLabelDragged(bool ctrl);
|
void balloonLabelDragged(bool ctrl);
|
||||||
@@ -169,16 +219,15 @@ public Q_SLOTS:
|
|||||||
protected:
|
protected:
|
||||||
void draw() override;
|
void draw() override;
|
||||||
void drawBalloon(bool dragged = false);
|
void drawBalloon(bool dragged = false);
|
||||||
QVariant itemChange( GraphicsItemChange change,
|
QVariant itemChange(GraphicsItemChange change, const QVariant& value) override;
|
||||||
const QVariant &value ) override;
|
|
||||||
virtual void setSvgPens();
|
virtual void setSvgPens();
|
||||||
virtual void setPens();
|
virtual void setPens();
|
||||||
QString getPrecision();
|
QString getPrecision();
|
||||||
void parentViewMousePressed(QGIView *view, QPointF pos);
|
void parentViewMousePressed(QGIView* view, QPointF pos);
|
||||||
TechDraw::DrawView* getSourceView() const;
|
TechDraw::DrawView* getSourceView() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TechDraw::DrawViewBalloon *dvBalloon;
|
TechDraw::DrawViewBalloon* dvBalloon;
|
||||||
bool hasHover;
|
bool hasHover;
|
||||||
QGIBalloonLabel* balloonLabel;
|
QGIBalloonLabel* balloonLabel;
|
||||||
QGIDimLines* balloonLines;
|
QGIDimLines* balloonLines;
|
||||||
@@ -186,7 +235,7 @@ private:
|
|||||||
QGIArrow* arrow;
|
QGIArrow* arrow;
|
||||||
double m_lineWidth;
|
double m_lineWidth;
|
||||||
bool m_obtuse;
|
bool m_obtuse;
|
||||||
QGIView *parent; //used to create edit dialog
|
QGIView* parent;//used to create edit dialog
|
||||||
|
|
||||||
bool m_dragInProgress;
|
bool m_dragInProgress;
|
||||||
bool m_originDragged = false;
|
bool m_originDragged = false;
|
||||||
@@ -194,6 +243,6 @@ private:
|
|||||||
Base::Vector3d m_saveOffset;
|
Base::Vector3d m_saveOffset;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
}// namespace TechDrawGui
|
||||||
|
|
||||||
#endif // TECHDRAWGUI_QGIVBALLOON_H
|
#endif// TECHDRAWGUI_QGIVBALLOON_H
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -482,8 +482,7 @@ void QGIViewPart::drawViewPart()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Draw Edges
|
// Draw Edges
|
||||||
QColor edgeColor = PreferencesGui::normalQColor();
|
QColor edgeColor = PreferencesGui::getAccessibleQColor(PreferencesGui::normalQColor());
|
||||||
|
|
||||||
const TechDraw::BaseGeomPtrVector& geoms = viewPart->getEdgeGeometry();
|
const TechDraw::BaseGeomPtrVector& geoms = viewPart->getEdgeGeometry();
|
||||||
TechDraw::BaseGeomPtrVector::const_iterator itGeom = geoms.begin();
|
TechDraw::BaseGeomPtrVector::const_iterator itGeom = geoms.begin();
|
||||||
QGIEdge* item;
|
QGIEdge* item;
|
||||||
@@ -530,7 +529,8 @@ void QGIViewPart::drawViewPart()
|
|||||||
else {
|
else {
|
||||||
TechDraw::GeomFormat* gf = viewPart->getGeomFormatBySelection(i);
|
TechDraw::GeomFormat* gf = viewPart->getGeomFormatBySelection(i);
|
||||||
if (gf) {
|
if (gf) {
|
||||||
item->setNormalColor(gf->m_format.m_color.asValue<QColor>());
|
App::Color color = Preferences::getAccessibleColor(gf->m_format.m_color);
|
||||||
|
item->setNormalColor(color.asValue<QColor>());
|
||||||
item->setWidth(gf->m_format.m_weight * lineScaleFactor);
|
item->setWidth(gf->m_format.m_weight * lineScaleFactor);
|
||||||
item->setStyle(gf->m_format.m_style);
|
item->setStyle(gf->m_format.m_style);
|
||||||
showItem = gf->m_format.m_visible;
|
showItem = gf->m_format.m_visible;
|
||||||
@@ -571,8 +571,7 @@ void QGIViewPart::drawViewPart()
|
|||||||
->GetGroup("Preferences")
|
->GetGroup("Preferences")
|
||||||
->GetGroup("Mod/TechDraw/General");
|
->GetGroup("Mod/TechDraw/General");
|
||||||
double vertexScaleFactor = hGrp->GetFloat("VertexScale", 3.0);
|
double vertexScaleFactor = hGrp->GetFloat("VertexScale", 3.0);
|
||||||
QColor vertexColor = PreferencesGui::vertexQColor();
|
QColor vertexColor = PreferencesGui::getAccessibleQColor(PreferencesGui::vertexQColor());
|
||||||
|
|
||||||
bool showVertices = true;
|
bool showVertices = true;
|
||||||
bool showCenterMarks = true;
|
bool showCenterMarks = true;
|
||||||
if (getFrameState()) {//frames are on
|
if (getFrameState()) {//frames are on
|
||||||
@@ -637,7 +636,8 @@ bool QGIViewPart::formatGeomFromCosmetic(std::string cTag, QGIEdge* item)
|
|||||||
auto partFeat(dynamic_cast<TechDraw::DrawViewPart*>(getViewObject()));
|
auto partFeat(dynamic_cast<TechDraw::DrawViewPart*>(getViewObject()));
|
||||||
TechDraw::CosmeticEdge* ce = partFeat ? partFeat->getCosmeticEdge(cTag) : nullptr;
|
TechDraw::CosmeticEdge* ce = partFeat ? partFeat->getCosmeticEdge(cTag) : nullptr;
|
||||||
if (ce) {
|
if (ce) {
|
||||||
item->setNormalColor(ce->m_format.m_color.asValue<QColor>());
|
App::Color color = Preferences::getAccessibleColor(ce->m_format.m_color);
|
||||||
|
item->setNormalColor(color.asValue<QColor>());
|
||||||
item->setWidth(ce->m_format.m_weight * lineScaleFactor);
|
item->setWidth(ce->m_format.m_weight * lineScaleFactor);
|
||||||
item->setStyle(ce->m_format.m_style);
|
item->setStyle(ce->m_format.m_style);
|
||||||
result = ce->m_format.m_visible;
|
result = ce->m_format.m_visible;
|
||||||
@@ -653,7 +653,8 @@ bool QGIViewPart::formatGeomFromCenterLine(std::string cTag, QGIEdge* item)
|
|||||||
auto partFeat(dynamic_cast<TechDraw::DrawViewPart*>(getViewObject()));
|
auto partFeat(dynamic_cast<TechDraw::DrawViewPart*>(getViewObject()));
|
||||||
TechDraw::CenterLine* cl = partFeat ? partFeat->getCenterLine(cTag) : nullptr;
|
TechDraw::CenterLine* cl = partFeat ? partFeat->getCenterLine(cTag) : nullptr;
|
||||||
if (cl) {
|
if (cl) {
|
||||||
item->setNormalColor(cl->m_format.m_color.asValue<QColor>());
|
App::Color color = Preferences::getAccessibleColor(cl->m_format.m_color);
|
||||||
|
item->setNormalColor(color.asValue<QColor>());
|
||||||
item->setWidth(cl->m_format.m_weight * lineScaleFactor);
|
item->setWidth(cl->m_format.m_weight * lineScaleFactor);
|
||||||
item->setStyle(cl->m_format.m_style);
|
item->setStyle(cl->m_format.m_style);
|
||||||
result = cl->m_format.m_visible;
|
result = cl->m_format.m_visible;
|
||||||
@@ -800,7 +801,8 @@ void QGIViewPart::drawSectionLine(TechDraw::DrawViewSection* viewSection, bool b
|
|||||||
addToGroup(sectionLine);
|
addToGroup(sectionLine);
|
||||||
sectionLine->setSymbol(const_cast<char*>(viewSection->SectionSymbol.getValue()));
|
sectionLine->setSymbol(const_cast<char*>(viewSection->SectionSymbol.getValue()));
|
||||||
sectionLine->setSectionStyle(vp->SectionLineStyle.getValue());
|
sectionLine->setSectionStyle(vp->SectionLineStyle.getValue());
|
||||||
sectionLine->setSectionColor(vp->SectionLineColor.getValue().asValue<QColor>());
|
App::Color color = Preferences::getAccessibleColor(vp->SectionLineColor.getValue());
|
||||||
|
sectionLine->setSectionColor(color.asValue<QColor>());
|
||||||
sectionLine->setPathMode(false);
|
sectionLine->setPathMode(false);
|
||||||
|
|
||||||
//find the ends of the section line
|
//find the ends of the section line
|
||||||
@@ -883,7 +885,8 @@ void QGIViewPart::drawComplexSectionLine(TechDraw::DrawViewSection* viewSection,
|
|||||||
addToGroup(sectionLine);
|
addToGroup(sectionLine);
|
||||||
sectionLine->setSymbol(const_cast<char*>(viewSection->SectionSymbol.getValue()));
|
sectionLine->setSymbol(const_cast<char*>(viewSection->SectionSymbol.getValue()));
|
||||||
sectionLine->setSectionStyle(vp->SectionLineStyle.getValue());
|
sectionLine->setSectionStyle(vp->SectionLineStyle.getValue());
|
||||||
sectionLine->setSectionColor(vp->SectionLineColor.getValue().asValue<QColor>());
|
App::Color color = Preferences::getAccessibleColor(vp->SectionLineColor.getValue());
|
||||||
|
sectionLine->setSectionColor(color.asValue<QColor>());
|
||||||
sectionLine->setPathMode(true);
|
sectionLine->setPathMode(true);
|
||||||
sectionLine->setPath(wirePath);
|
sectionLine->setPath(wirePath);
|
||||||
sectionLine->setEnds(vStart, vEnd);
|
sectionLine->setEnds(vStart, vEnd);
|
||||||
@@ -988,7 +991,8 @@ void QGIViewPart::drawHighlight(TechDraw::DrawViewDetail* viewDetail, bool b)
|
|||||||
scene()->addItem(highlight);
|
scene()->addItem(highlight);
|
||||||
highlight->setReference(viewDetail->Reference.getValue());
|
highlight->setReference(viewDetail->Reference.getValue());
|
||||||
highlight->setStyle((Qt::PenStyle)vp->HighlightLineStyle.getValue());
|
highlight->setStyle((Qt::PenStyle)vp->HighlightLineStyle.getValue());
|
||||||
highlight->setColor(vp->HighlightLineColor.getValue().asValue<QColor>());
|
App::Color color = Preferences::getAccessibleColor(vp->HighlightLineColor.getValue());
|
||||||
|
highlight->setColor(color.asValue<QColor>());
|
||||||
highlight->setFeatureName(viewDetail->getNameInDocument());
|
highlight->setFeatureName(viewDetail->getNameInDocument());
|
||||||
highlight->setInteractive(true);
|
highlight->setInteractive(true);
|
||||||
|
|
||||||
|
|||||||
@@ -23,11 +23,12 @@
|
|||||||
|
|
||||||
#include "PreCompiled.h"
|
#include "PreCompiled.h"
|
||||||
#ifndef _PreComp_
|
#ifndef _PreComp_
|
||||||
# include <cmath>
|
#include <QGraphicsColorizeEffect>
|
||||||
# include <sstream>
|
#include <QGraphicsEffect>
|
||||||
|
#include <QGraphicsItem>
|
||||||
# include <QGraphicsItem>
|
#include <QRectF>
|
||||||
# include <QRectF>
|
#include <cmath>
|
||||||
|
#include <sstream>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <Base/Console.h>
|
#include <Base/Console.h>
|
||||||
@@ -36,13 +37,14 @@
|
|||||||
#include <Mod/TechDraw/App/DrawViewDraft.h>
|
#include <Mod/TechDraw/App/DrawViewDraft.h>
|
||||||
#include <Mod/TechDraw/App/DrawViewSymbol.h>
|
#include <Mod/TechDraw/App/DrawViewSymbol.h>
|
||||||
|
|
||||||
#include "QGIViewSymbol.h"
|
#include "PreferencesGui.h"
|
||||||
#include "QGCustomSvg.h"
|
#include "QGCustomSvg.h"
|
||||||
#include "QGDisplayArea.h"
|
#include "QGDisplayArea.h"
|
||||||
|
#include "QGIViewSymbol.h"
|
||||||
#include "Rez.h"
|
#include "Rez.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace TechDrawGui;
|
using namespace TechDrawGui;
|
||||||
|
using namespace TechDraw;
|
||||||
|
|
||||||
QGIViewSymbol::QGIViewSymbol()
|
QGIViewSymbol::QGIViewSymbol()
|
||||||
{
|
{
|
||||||
@@ -67,21 +69,19 @@ QGIViewSymbol::~QGIViewSymbol()
|
|||||||
// m_svgItem belongs to this group and will be deleted by Qt
|
// m_svgItem belongs to this group and will be deleted by Qt
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGIViewSymbol::setViewSymbolFeature(TechDraw::DrawViewSymbol *obj)
|
void QGIViewSymbol::setViewSymbolFeature(TechDraw::DrawViewSymbol* obj)
|
||||||
{
|
{
|
||||||
// called from QGVPage. (once)
|
// called from QGVPage. (once)
|
||||||
setViewFeature(static_cast<TechDraw::DrawView *>(obj));
|
setViewFeature(static_cast<TechDraw::DrawView*>(obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGIViewSymbol::updateView(bool update)
|
void QGIViewSymbol::updateView(bool update)
|
||||||
{
|
{
|
||||||
auto viewSymbol( dynamic_cast<TechDraw::DrawViewSymbol *>(getViewObject()) );
|
auto viewSymbol(dynamic_cast<TechDraw::DrawViewSymbol*>(getViewObject()));
|
||||||
if (!viewSymbol)
|
if (!viewSymbol)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (update ||
|
if (update || viewSymbol->isTouched() || viewSymbol->Symbol.isTouched()) {
|
||||||
viewSymbol->isTouched() ||
|
|
||||||
viewSymbol->Symbol.isTouched()) {
|
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,20 +104,21 @@ void QGIViewSymbol::draw()
|
|||||||
|
|
||||||
void QGIViewSymbol::drawSvg()
|
void QGIViewSymbol::drawSvg()
|
||||||
{
|
{
|
||||||
auto viewSymbol( dynamic_cast<TechDraw::DrawViewSymbol *>(getViewObject()) );
|
auto viewSymbol(dynamic_cast<TechDraw::DrawViewSymbol*>(getViewObject()));
|
||||||
if (!viewSymbol)
|
if (!viewSymbol)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
double rezfactor = Rez::getRezFactor();
|
double rezfactor = Rez::getRezFactor();
|
||||||
double scaling = viewSymbol->getScale();
|
double scaling = viewSymbol->getScale();
|
||||||
double pxMm = 3.78; //96px/25.4mm ( CSS/SVG defined value of 96 pixels per inch)
|
double pxMm = 3.78;//96px/25.4mm ( CSS/SVG defined value of 96 pixels per inch)
|
||||||
// double pxMm = 3.54; //90px/25.4mm ( inkscape value version <= 0.91)
|
// double pxMm = 3.54; //90px/25.4mm ( inkscape value version <= 0.91)
|
||||||
//some software uses different px/in, so symbol will need Scale adjusted.
|
//some software uses different px/in, so symbol will need Scale adjusted.
|
||||||
//Arch/Draft views are in px and need to be scaled @ rezfactor px/mm to ensure proper representation
|
//Arch/Draft views are in px and need to be scaled @ rezfactor px/mm to ensure proper representation
|
||||||
if (viewSymbol->isDerivedFrom(TechDraw::DrawViewArch::getClassTypeId()) ||
|
if (viewSymbol->isDerivedFrom(TechDraw::DrawViewArch::getClassTypeId())
|
||||||
viewSymbol->isDerivedFrom(TechDraw::DrawViewDraft::getClassTypeId()) ) {
|
|| viewSymbol->isDerivedFrom(TechDraw::DrawViewDraft::getClassTypeId())) {
|
||||||
scaling = scaling * rezfactor;
|
scaling = scaling * rezfactor;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
scaling = scaling * rezfactor / pxMm;
|
scaling = scaling * rezfactor / pxMm;
|
||||||
}
|
}
|
||||||
m_svgItem->setScale(scaling);
|
m_svgItem->setScale(scaling);
|
||||||
@@ -135,9 +136,23 @@ void QGIViewSymbol::symbolToSvg(QByteArray qba)
|
|||||||
|
|
||||||
prepareGeometryChange();
|
prepareGeometryChange();
|
||||||
if (!m_svgItem->load(&qba)) {
|
if (!m_svgItem->load(&qba)) {
|
||||||
Base::Console().Error("Error - Could not load Symbol into SVG renderer for %s\n", getViewName());
|
Base::Console().Error("Error - Could not load Symbol into SVG renderer for %s\n",
|
||||||
|
getViewName());
|
||||||
}
|
}
|
||||||
m_svgItem->centerAt(0., 0.);
|
m_svgItem->centerAt(0., 0.);
|
||||||
|
|
||||||
|
if (Preferences::lightOnDark()) {
|
||||||
|
QColor color = PreferencesGui::getAccessibleQColor(QColor(Qt::black));
|
||||||
|
QGraphicsColorizeEffect* colorizeEffect = new QGraphicsColorizeEffect();
|
||||||
|
colorizeEffect->setColor(color);
|
||||||
|
m_svgItem->setGraphicsEffect(colorizeEffect);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//remove and delete any existing graphics effect
|
||||||
|
if (m_svgItem->graphicsEffect()) {
|
||||||
|
m_svgItem->setGraphicsEffect(nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGIViewSymbol::rotateView()
|
void QGIViewSymbol::rotateView()
|
||||||
@@ -147,4 +162,3 @@ void QGIViewSymbol::rotateView()
|
|||||||
double rot = getViewObject()->Rotation.getValue();
|
double rot = getViewObject()->Rotation.getValue();
|
||||||
m_displayArea->setRotation(-rot);
|
m_displayArea->setRotation(-rot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
#include <Base/Console.h>
|
#include <Base/Console.h>
|
||||||
#include <Mod/TechDraw/App/DrawUtil.h>
|
#include <Mod/TechDraw/App/DrawUtil.h>
|
||||||
|
|
||||||
|
#include "PreferencesGui.h"
|
||||||
#include "QGTracker.h"
|
#include "QGTracker.h"
|
||||||
#include "QGIView.h"
|
#include "QGIView.h"
|
||||||
#include "QGSPage.h"
|
#include "QGSPage.h"
|
||||||
@@ -480,7 +481,7 @@ QColor QGTracker::getTrackerColor()
|
|||||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
|
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
|
||||||
GetGroup("Preferences")->GetGroup("Mod/TechDraw/Tracker");
|
GetGroup("Preferences")->GetGroup("Mod/TechDraw/Tracker");
|
||||||
App::Color trackColor = App::Color((uint32_t) hGrp->GetUnsigned("TrackerColor", 0xFF000000));
|
App::Color trackColor = App::Color((uint32_t) hGrp->GetUnsigned("TrackerColor", 0xFF000000));
|
||||||
result = trackColor.asValue<QColor>();
|
result = PreferencesGui::getAccessibleQColor(trackColor.asValue<QColor>());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -338,7 +338,7 @@ void QGVPage::drawBackground(QPainter *painter, const QRectF &)
|
|||||||
QRectF paperRect(0, -pageHeight, pageWidth, pageHeight);
|
QRectF paperRect(0, -pageHeight, pageWidth, pageHeight);
|
||||||
QPolygon poly = mapFromScene(paperRect);
|
QPolygon poly = mapFromScene(paperRect);
|
||||||
|
|
||||||
QBrush pageBrush(Qt::white);
|
QBrush pageBrush(PreferencesGui::pageQColor());
|
||||||
painter->setBrush(pageBrush);
|
painter->setBrush(pageBrush);
|
||||||
|
|
||||||
painter->drawRect(poly.boundingRect());
|
painter->drawRect(poly.boundingRect());
|
||||||
|
|||||||
@@ -25,14 +25,14 @@
|
|||||||
#include "PreCompiled.h"
|
#include "PreCompiled.h"
|
||||||
|
|
||||||
#ifndef _PreComp_
|
#ifndef _PreComp_
|
||||||
# include <QAction>
|
#include <QAction>
|
||||||
# include <QList>
|
#include <QList>
|
||||||
# include <QMenu>
|
#include <QMenu>
|
||||||
# include <QMessageBox>
|
#include <QMessageBox>
|
||||||
# include <QPointer>
|
#include <QPointer>
|
||||||
# include <QTextStream>
|
#include <QTextStream>
|
||||||
# include <boost_signals2.hpp>
|
#include <boost/signals2/connection.hpp>
|
||||||
# include <boost/signals2/connection.hpp>
|
#include <boost_signals2.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <App/Document.h>
|
#include <App/Document.h>
|
||||||
@@ -44,14 +44,15 @@
|
|||||||
#include <Gui/MainWindow.h>
|
#include <Gui/MainWindow.h>
|
||||||
#include <Gui/ViewProviderDocumentObject.h>
|
#include <Gui/ViewProviderDocumentObject.h>
|
||||||
|
|
||||||
#include <Mod/TechDraw/App/DrawPage.h>
|
|
||||||
#include <Mod/TechDraw/App/DrawView.h>
|
|
||||||
#include <Mod/TechDraw/App/DrawProjGroupItem.h>
|
|
||||||
#include <Mod/TechDraw/App/DrawViewDimension.h>
|
|
||||||
#include <Mod/TechDraw/App/DrawViewBalloon.h>
|
|
||||||
#include <Mod/TechDraw/App/DrawLeaderLine.h>
|
|
||||||
#include <Mod/TechDraw/App/DrawRichAnno.h>
|
|
||||||
#include <Mod/TechDraw/App/DrawHatch.h>
|
#include <Mod/TechDraw/App/DrawHatch.h>
|
||||||
|
#include <Mod/TechDraw/App/DrawLeaderLine.h>
|
||||||
|
#include <Mod/TechDraw/App/DrawPage.h>
|
||||||
|
#include <Mod/TechDraw/App/DrawProjGroupItem.h>
|
||||||
|
#include <Mod/TechDraw/App/DrawRichAnno.h>
|
||||||
|
#include <Mod/TechDraw/App/DrawTemplate.h>
|
||||||
|
#include <Mod/TechDraw/App/DrawView.h>
|
||||||
|
#include <Mod/TechDraw/App/DrawViewBalloon.h>
|
||||||
|
#include <Mod/TechDraw/App/DrawViewDimension.h>
|
||||||
#include <Mod/TechDraw/App/DrawWeldSymbol.h>
|
#include <Mod/TechDraw/App/DrawWeldSymbol.h>
|
||||||
|
|
||||||
#include "MDIViewPage.h"
|
#include "MDIViewPage.h"
|
||||||
@@ -59,9 +60,9 @@
|
|||||||
#include "QGITemplate.h"
|
#include "QGITemplate.h"
|
||||||
#include "QGSPage.h"
|
#include "QGSPage.h"
|
||||||
#include "QGVPage.h"
|
#include "QGVPage.h"
|
||||||
#include "ViewProviderTemplate.h"
|
|
||||||
#include "ViewProviderPage.h"
|
#include "ViewProviderPage.h"
|
||||||
#include "ViewProviderPageExtension.h"
|
#include "ViewProviderPageExtension.h"
|
||||||
|
#include "ViewProviderTemplate.h"
|
||||||
|
|
||||||
using namespace TechDrawGui;
|
using namespace TechDrawGui;
|
||||||
using namespace TechDraw;
|
using namespace TechDraw;
|
||||||
@@ -77,38 +78,38 @@ PROPERTY_SOURCE(TechDrawGui::ViewProviderPage, Gui::ViewProviderDocumentObject)
|
|||||||
// Construction/Destruction
|
// Construction/Destruction
|
||||||
|
|
||||||
ViewProviderPage::ViewProviderPage()
|
ViewProviderPage::ViewProviderPage()
|
||||||
: m_mdiView(nullptr),
|
: m_mdiView(nullptr), m_pageName(""), m_graphicsView(nullptr), m_graphicsScene(nullptr)
|
||||||
m_pageName(""),
|
|
||||||
m_graphicsView(nullptr),
|
|
||||||
m_graphicsScene(nullptr)
|
|
||||||
{
|
{
|
||||||
initExtension(this);
|
initExtension(this);
|
||||||
|
|
||||||
sPixmap = "TechDraw_TreePage";
|
sPixmap = "TechDraw_TreePage";
|
||||||
static const char *group = "Grid";
|
static const char* group = "Grid";
|
||||||
|
|
||||||
ADD_PROPERTY_TYPE(ShowFrames ,(true), group, App::Prop_None, "Show or hide View frames and Labels on this Page");
|
ADD_PROPERTY_TYPE(ShowFrames, (true), group, App::Prop_None,
|
||||||
ADD_PROPERTY_TYPE(ShowGrid ,(PreferencesGui::showGrid()), group, App::Prop_None, "Show or hide a grid on this Page");
|
"Show or hide View frames and Labels on this Page");
|
||||||
ADD_PROPERTY_TYPE(GridSpacing, (PreferencesGui::gridSpacing()), group, (App::PropertyType::Prop_None),
|
ADD_PROPERTY_TYPE(ShowGrid, (PreferencesGui::showGrid()), group, App::Prop_None,
|
||||||
"Grid line spacing in mm");
|
"Show or hide a grid on this Page");
|
||||||
|
ADD_PROPERTY_TYPE(GridSpacing, (PreferencesGui::gridSpacing()), group,
|
||||||
|
(App::PropertyType::Prop_None), "Grid line spacing in mm");
|
||||||
|
|
||||||
ShowFrames.setStatus(App::Property::Hidden, true);
|
ShowFrames.setStatus(App::Property::Hidden, true);
|
||||||
DisplayMode.setStatus(App::Property::Hidden, true);
|
DisplayMode.setStatus(App::Property::Hidden, true);
|
||||||
|
|
||||||
m_graphicsScene = new QGSPage(this);
|
m_graphicsScene = new QGSPage(this);
|
||||||
m_graphicsScene->setItemIndexMethod(QGraphicsScene::NoIndex); //this prevents crash when deleting dims.
|
m_graphicsScene->setItemIndexMethod(
|
||||||
//scene(view?) indices of dirty regions gets
|
QGraphicsScene::NoIndex);//this prevents crash when deleting dims.
|
||||||
//out of sync. missing prepareGeometryChange
|
//scene(view?) indices of dirty regions gets
|
||||||
//somewhere???? QTBUG-18021???
|
//out of sync. missing prepareGeometryChange
|
||||||
|
//somewhere???? QTBUG-18021???
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewProviderPage::~ViewProviderPage()
|
ViewProviderPage::~ViewProviderPage()
|
||||||
{
|
{
|
||||||
removeMDIView(); //if the MDIViewPage is still in MainWindow, remove it.
|
removeMDIView();//if the MDIViewPage is still in MainWindow, remove it.
|
||||||
m_graphicsScene->deleteLater();
|
m_graphicsScene->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewProviderPage::attach(App::DocumentObject *pcFeat)
|
void ViewProviderPage::attach(App::DocumentObject* pcFeat)
|
||||||
{
|
{
|
||||||
ViewProviderDocumentObject::attach(pcFeat);
|
ViewProviderDocumentObject::attach(pcFeat);
|
||||||
|
|
||||||
@@ -118,7 +119,8 @@ void ViewProviderPage::attach(App::DocumentObject *pcFeat)
|
|||||||
connectGuiRepaint = feature->signalGuiPaint.connect(bnd);
|
connectGuiRepaint = feature->signalGuiPaint.connect(bnd);
|
||||||
m_pageName = feature->getNameInDocument();
|
m_pageName = feature->getNameInDocument();
|
||||||
m_graphicsScene->setObjectName(QString::fromLocal8Bit(m_pageName.c_str()));
|
m_graphicsScene->setObjectName(QString::fromLocal8Bit(m_pageName.c_str()));
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
Base::Console().Log("VPP::attach has no Feature!\n");
|
Base::Console().Log("VPP::attach has no Feature!\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -136,13 +138,15 @@ std::vector<std::string> ViewProviderPage::getDisplayModes() const
|
|||||||
return StrList;
|
return StrList;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewProviderPage::onChanged(const App::Property *prop)
|
void ViewProviderPage::onChanged(const App::Property* prop)
|
||||||
{
|
{
|
||||||
if (prop == &(ShowGrid)) {
|
if (prop == &(ShowGrid)) {
|
||||||
setGrid();
|
setGrid();
|
||||||
} else if (prop == &(GridSpacing)) {
|
}
|
||||||
|
else if (prop == &(GridSpacing)) {
|
||||||
setGrid();
|
setGrid();
|
||||||
} else if (prop == &Visibility) {
|
}
|
||||||
|
else if (prop == &Visibility) {
|
||||||
//Visibility changes are handled in VPDO::onChanged -> show() or hide()
|
//Visibility changes are handled in VPDO::onChanged -> show() or hide()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,25 +161,28 @@ void ViewProviderPage::updateData(const App::Property* prop)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (prop == &(page->KeepUpdated)) {
|
if (prop == &(page->KeepUpdated)) {
|
||||||
if (getDrawPage()->KeepUpdated.getValue()) {
|
if (getDrawPage()->KeepUpdated.getValue()) {
|
||||||
sPixmap = "TechDraw_TreePage";
|
sPixmap = "TechDraw_TreePage";
|
||||||
} else {
|
}
|
||||||
sPixmap = "TechDraw_TreePageUnsync";
|
else {
|
||||||
}
|
sPixmap = "TechDraw_TreePageUnsync";
|
||||||
signalChangeIcon();
|
}
|
||||||
//if the template is changed, rebuild the visual
|
signalChangeIcon();
|
||||||
} else if (prop == &(page->Template)) {
|
//if the template is changed, rebuild the visual
|
||||||
if (!page->isUnsetting()) {
|
}
|
||||||
//check if a template has been added to scene first?
|
else if (prop == &(page->Template)) {
|
||||||
|
if (!page->isUnsetting()) {
|
||||||
|
//check if a template has been added to scene first?
|
||||||
m_graphicsScene->matchSceneRectToTemplate();
|
m_graphicsScene->matchSceneRectToTemplate();
|
||||||
m_graphicsScene->updateTemplate();
|
m_graphicsScene->updateTemplate();
|
||||||
}
|
}
|
||||||
} else if (prop == &(page->Label)) {
|
}
|
||||||
if (m_mdiView &&
|
else if (prop == &(page->Label)) {
|
||||||
!page->isUnsetting()) {
|
if (m_mdiView && !page->isUnsetting()) {
|
||||||
m_mdiView->setTabText(page->Label.getValue());
|
m_mdiView->setTabText(page->Label.getValue());
|
||||||
}
|
}
|
||||||
} else if (prop == &page->Views) {
|
}
|
||||||
|
else if (prop == &page->Views) {
|
||||||
if (!page->isUnsetting())
|
if (!page->isUnsetting())
|
||||||
m_graphicsScene->fixOrphans();
|
m_graphicsScene->fixOrphans();
|
||||||
}
|
}
|
||||||
@@ -183,7 +190,7 @@ void ViewProviderPage::updateData(const App::Property* prop)
|
|||||||
Gui::ViewProviderDocumentObject::updateData(prop);
|
Gui::ViewProviderDocumentObject::updateData(prop);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ViewProviderPage::onDelete(const std::vector<std::string> &)
|
bool ViewProviderPage::onDelete(const std::vector<std::string>&)
|
||||||
{
|
{
|
||||||
// warn the user if the Page is not empty
|
// warn the user if the Page is not empty
|
||||||
// but don't do this if there is just the template
|
// but don't do this if there is just the template
|
||||||
@@ -202,25 +209,26 @@ bool ViewProviderPage::onDelete(const std::vector<std::string> &)
|
|||||||
isTemplate = false;
|
isTemplate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!objs.empty() && !isTemplate)
|
if (!objs.empty() && !isTemplate) {
|
||||||
{
|
|
||||||
// generate dialog
|
// generate dialog
|
||||||
QString bodyMessage;
|
QString bodyMessage;
|
||||||
QTextStream bodyMessageStream(&bodyMessage);
|
QTextStream bodyMessageStream(&bodyMessage);
|
||||||
bodyMessageStream << qApp->translate("Std_Delete",
|
bodyMessageStream << qApp->translate(
|
||||||
|
"Std_Delete",
|
||||||
"The page is not empty, therefore the\nfollowing referencing objects might be lost:");
|
"The page is not empty, therefore the\nfollowing referencing objects might be lost:");
|
||||||
bodyMessageStream << '\n';
|
bodyMessageStream << '\n';
|
||||||
for (auto ObjIterator : objs)
|
for (auto ObjIterator : objs)
|
||||||
bodyMessageStream << '\n' << QString::fromUtf8(ObjIterator->Label.getValue());
|
bodyMessageStream << '\n' << QString::fromUtf8(ObjIterator->Label.getValue());
|
||||||
bodyMessageStream << "\n\n" << QObject::tr("Are you sure you want to continue?");
|
bodyMessageStream << "\n\n" << QObject::tr("Are you sure you want to continue?");
|
||||||
// show and evaluate the dialog
|
// show and evaluate the dialog
|
||||||
int DialogResult = QMessageBox::warning(Gui::getMainWindow(),
|
int DialogResult = QMessageBox::warning(
|
||||||
qApp->translate("Std_Delete", "Object dependencies"), bodyMessage,
|
Gui::getMainWindow(), qApp->translate("Std_Delete", "Object dependencies"), bodyMessage,
|
||||||
QMessageBox::Yes, QMessageBox::No);
|
QMessageBox::Yes, QMessageBox::No);
|
||||||
if (DialogResult == QMessageBox::Yes) {
|
if (DialogResult == QMessageBox::Yes) {
|
||||||
removeMDIView();
|
removeMDIView();
|
||||||
return true;
|
return true;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -233,24 +241,26 @@ void ViewProviderPage::setupContextMenu(QMenu* menu, QObject* receiver, const ch
|
|||||||
{
|
{
|
||||||
Gui::ViewProviderDocumentObject::setupContextMenu(menu, receiver, member);
|
Gui::ViewProviderDocumentObject::setupContextMenu(menu, receiver, member);
|
||||||
QAction* act = menu->addAction(QObject::tr("Show drawing"), receiver, member);
|
QAction* act = menu->addAction(QObject::tr("Show drawing"), receiver, member);
|
||||||
act->setData(QVariant((int) _SHOWDRAWING));
|
act->setData(QVariant((int)_SHOWDRAWING));
|
||||||
QAction* act2 = menu->addAction(QObject::tr("Toggle KeepUpdated"), receiver, member);
|
QAction* act2 = menu->addAction(QObject::tr("Toggle KeepUpdated"), receiver, member);
|
||||||
act2->setData(QVariant((int) _TOGGLEUPDATE));
|
act2->setData(QVariant((int)_TOGGLEUPDATE));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ViewProviderPage::setEdit(int ModNum)
|
bool ViewProviderPage::setEdit(int ModNum)
|
||||||
{
|
{
|
||||||
if (ModNum == _SHOWDRAWING) {
|
if (ModNum == _SHOWDRAWING) {
|
||||||
showMDIViewPage(); // show the drawing
|
showMDIViewPage();// show the drawing
|
||||||
return false; //finished editing
|
return false; //finished editing
|
||||||
} else if (ModNum == _TOGGLEUPDATE) {
|
}
|
||||||
auto page = getDrawPage();
|
else if (ModNum == _TOGGLEUPDATE) {
|
||||||
if (page) {
|
auto page = getDrawPage();
|
||||||
page->KeepUpdated.setValue(!page->KeepUpdated.getValue());
|
if (page) {
|
||||||
page->recomputeFeature();
|
page->KeepUpdated.setValue(!page->KeepUpdated.getValue());
|
||||||
}
|
page->recomputeFeature();
|
||||||
return false;
|
}
|
||||||
} else {
|
return false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
return Gui::ViewProviderDocumentObject::setEdit(ModNum);
|
return Gui::ViewProviderDocumentObject::setEdit(ModNum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -279,7 +289,7 @@ void ViewProviderPage::show(void)
|
|||||||
void ViewProviderPage::hide(void)
|
void ViewProviderPage::hide(void)
|
||||||
{
|
{
|
||||||
if (getMDIView()) {
|
if (getMDIView()) {
|
||||||
getMDIView()->hide(); //this doesn't remove the mdiViewPage from the mainWindow
|
getMDIView()->hide();//this doesn't remove the mdiViewPage from the mainWindow
|
||||||
removeMDIView();
|
removeMDIView();
|
||||||
}
|
}
|
||||||
ViewProviderDocumentObject::hide();
|
ViewProviderDocumentObject::hide();
|
||||||
@@ -287,15 +297,17 @@ void ViewProviderPage::hide(void)
|
|||||||
|
|
||||||
bool ViewProviderPage::showMDIViewPage()
|
bool ViewProviderPage::showMDIViewPage()
|
||||||
{
|
{
|
||||||
if (m_mdiView.isNull()){
|
if (m_mdiView.isNull()) {
|
||||||
createMDIViewPage();
|
createMDIViewPage();
|
||||||
m_graphicsScene->addChildrenToPage();
|
m_graphicsScene->addChildrenToPage();
|
||||||
m_graphicsScene->updateTemplate(true);
|
m_graphicsScene->updateTemplate(true);
|
||||||
m_graphicsScene->redrawAllViews();
|
m_graphicsScene->redrawAllViews();
|
||||||
m_graphicsScene->fixOrphans(true);
|
m_graphicsScene->fixOrphans(true);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
m_graphicsScene->redrawAllViews();
|
m_graphicsScene->redrawAllViews();
|
||||||
m_graphicsScene->fixOrphans(true);
|
m_graphicsScene->fixOrphans(true);
|
||||||
|
m_graphicsView->update();
|
||||||
}
|
}
|
||||||
m_graphicsView->centerOnPage();
|
m_graphicsView->centerOnPage();
|
||||||
|
|
||||||
@@ -311,8 +323,7 @@ bool ViewProviderPage::showMDIViewPage()
|
|||||||
|
|
||||||
void ViewProviderPage::createMDIViewPage()
|
void ViewProviderPage::createMDIViewPage()
|
||||||
{
|
{
|
||||||
Gui::Document* doc = Gui::Application::Instance->getDocument
|
Gui::Document* doc = Gui::Application::Instance->getDocument(pcObject->getDocument());
|
||||||
(pcObject->getDocument());
|
|
||||||
m_mdiView = new MDIViewPage(this, doc, Gui::getMainWindow());
|
m_mdiView = new MDIViewPage(this, doc, Gui::getMainWindow());
|
||||||
if (!m_graphicsView) {
|
if (!m_graphicsView) {
|
||||||
m_graphicsView = new QGVPage(this, m_graphicsScene, m_mdiView);
|
m_graphicsView = new QGVPage(this, m_graphicsScene, m_mdiView);
|
||||||
@@ -334,13 +345,15 @@ void ViewProviderPage::createMDIViewPage()
|
|||||||
//NOTE: removing MDIViewPage (parent) destroys QGVPage (eventually)
|
//NOTE: removing MDIViewPage (parent) destroys QGVPage (eventually)
|
||||||
void ViewProviderPage::removeMDIView(void)
|
void ViewProviderPage::removeMDIView(void)
|
||||||
{
|
{
|
||||||
if (!m_mdiView.isNull()) { //m_mdiView is a QPointer
|
if (!m_mdiView.isNull()) {//m_mdiView is a QPointer
|
||||||
QList<QWidget*> wList= Gui::getMainWindow()->windows();
|
QList<QWidget*> wList = Gui::getMainWindow()->windows();
|
||||||
if (wList.contains(m_mdiView)) {
|
if (wList.contains(m_mdiView)) {
|
||||||
Gui::getMainWindow()->removeWindow(m_mdiView);
|
Gui::getMainWindow()->removeWindow(m_mdiView);
|
||||||
m_mdiView = nullptr; //m_mdiView will eventually be deleted and
|
m_mdiView = nullptr; //m_mdiView will eventually be deleted and
|
||||||
m_graphicsView = nullptr; //will take m_graphicsView with it
|
m_graphicsView = nullptr;//will take m_graphicsView with it
|
||||||
Gui::MDIView* aw = Gui::getMainWindow()->activeWindow(); //WF: this bit should be in the remove window logic, not here.
|
Gui::MDIView* aw =
|
||||||
|
Gui::getMainWindow()
|
||||||
|
->activeWindow();//WF: this bit should be in the remove window logic, not here.
|
||||||
if (aw)
|
if (aw)
|
||||||
aw->showMaximized();
|
aw->showMaximized();
|
||||||
}
|
}
|
||||||
@@ -355,11 +368,30 @@ MDIViewPage* ViewProviderPage::getMDIViewPage() const
|
|||||||
return m_mdiView;
|
return m_mdiView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DrawTemplate* ViewProviderPage::getTemplate() const
|
||||||
|
{
|
||||||
|
return dynamic_cast<DrawTemplate*>(getDrawPage()->Template.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QGITemplate* ViewProviderPage::getQTemplate() const
|
||||||
|
{
|
||||||
|
Gui::Document* guiDoc = Gui::Application::Instance->getDocument(getDrawPage()->getDocument());
|
||||||
|
if (guiDoc) {
|
||||||
|
Gui::ViewProvider* vp = guiDoc->getViewProvider(getTemplate());
|
||||||
|
auto vpTemplate = dynamic_cast<ViewProviderTemplate*>(vp);
|
||||||
|
if (vpTemplate) {
|
||||||
|
return vpTemplate->getQTemplate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<App::DocumentObject*> ViewProviderPage::claimChildren(void) const
|
std::vector<App::DocumentObject*> ViewProviderPage::claimChildren(void) const
|
||||||
{
|
{
|
||||||
std::vector<App::DocumentObject*> temp;
|
std::vector<App::DocumentObject*> temp;
|
||||||
|
|
||||||
App::DocumentObject *templateFeat = nullptr;
|
App::DocumentObject* templateFeat = nullptr;
|
||||||
templateFeat = getDrawPage()->Template.getValue();
|
templateFeat = getDrawPage()->Template.getValue();
|
||||||
|
|
||||||
if (templateFeat) {
|
if (templateFeat) {
|
||||||
@@ -376,58 +408,51 @@ std::vector<App::DocumentObject*> ViewProviderPage::claimChildren(void) const
|
|||||||
// DrawHatch
|
// DrawHatch
|
||||||
// DrawWeldSymbol
|
// DrawWeldSymbol
|
||||||
|
|
||||||
const std::vector<App::DocumentObject *> &views = getDrawPage()->Views.getValues();
|
const std::vector<App::DocumentObject*>& views = getDrawPage()->Views.getValues();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
for (std::vector<App::DocumentObject *>::const_iterator it = views.begin(); it != views.end(); ++it) {
|
for (std::vector<App::DocumentObject*>::const_iterator it = views.begin();
|
||||||
TechDraw::DrawView* featView = dynamic_cast<TechDraw::DrawView*> (*it);
|
it != views.end(); ++it) {
|
||||||
App::DocumentObject *docObj = *it;
|
TechDraw::DrawView* featView = dynamic_cast<TechDraw::DrawView*>(*it);
|
||||||
|
App::DocumentObject* docObj = *it;
|
||||||
//DrawRichAnno with no parent is child of Page
|
//DrawRichAnno with no parent is child of Page
|
||||||
TechDraw::DrawRichAnno* dra = dynamic_cast<TechDraw::DrawRichAnno*> (*it);
|
TechDraw::DrawRichAnno* dra = dynamic_cast<TechDraw::DrawRichAnno*>(*it);
|
||||||
if (dra) {
|
if (dra) {
|
||||||
if (!dra->AnnoParent.getValue()) {
|
if (!dra->AnnoParent.getValue()) {
|
||||||
temp.push_back(*it); //no parent, belongs to page
|
temp.push_back(*it);//no parent, belongs to page
|
||||||
}
|
}
|
||||||
continue; //has a parent somewhere else
|
continue;//has a parent somewhere else
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't collect if dimension, projection group item, hatch or member of ClipGroup as these should be grouped elsewhere
|
// Don't collect if dimension, projection group item, hatch or member of ClipGroup as these should be grouped elsewhere
|
||||||
if (docObj->isDerivedFrom(TechDraw::DrawProjGroupItem::getClassTypeId()) ||
|
if (docObj->isDerivedFrom(TechDraw::DrawProjGroupItem::getClassTypeId())
|
||||||
docObj->isDerivedFrom(TechDraw::DrawViewDimension::getClassTypeId()) ||
|
|| docObj->isDerivedFrom(TechDraw::DrawViewDimension::getClassTypeId())
|
||||||
docObj->isDerivedFrom(TechDraw::DrawHatch::getClassTypeId()) ||
|
|| docObj->isDerivedFrom(TechDraw::DrawHatch::getClassTypeId())
|
||||||
docObj->isDerivedFrom(TechDraw::DrawViewBalloon::getClassTypeId()) ||
|
|| docObj->isDerivedFrom(TechDraw::DrawViewBalloon::getClassTypeId())
|
||||||
docObj->isDerivedFrom(TechDraw::DrawRichAnno::getClassTypeId()) ||
|
|| docObj->isDerivedFrom(TechDraw::DrawRichAnno::getClassTypeId())
|
||||||
docObj->isDerivedFrom(TechDraw::DrawLeaderLine::getClassTypeId()) ||
|
|| docObj->isDerivedFrom(TechDraw::DrawLeaderLine::getClassTypeId())
|
||||||
docObj->isDerivedFrom(TechDraw::DrawWeldSymbol::getClassTypeId()) ||
|
|| docObj->isDerivedFrom(TechDraw::DrawWeldSymbol::getClassTypeId())
|
||||||
(featView && featView->isInClip()) )
|
|| (featView && featView->isInClip()))
|
||||||
continue;
|
continue;
|
||||||
else
|
else
|
||||||
temp.push_back(*it);
|
temp.push_back(*it);
|
||||||
}
|
}
|
||||||
return temp;
|
return temp;
|
||||||
} catch (...) {
|
}
|
||||||
|
catch (...) {
|
||||||
return std::vector<App::DocumentObject*>();
|
return std::vector<App::DocumentObject*>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ViewProviderPage::isShow(void) const
|
bool ViewProviderPage::isShow(void) const { return Visibility.getValue(); }
|
||||||
{
|
|
||||||
return Visibility.getValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ViewProviderPage::getFrameState()
|
bool ViewProviderPage::getFrameState() { return ShowFrames.getValue(); }
|
||||||
{
|
|
||||||
return ShowFrames.getValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ViewProviderPage::setFrameState(bool state)
|
void ViewProviderPage::setFrameState(bool state) { ShowFrames.setValue(state); }
|
||||||
{
|
|
||||||
ShowFrames.setValue(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ViewProviderPage::toggleFrameState()
|
void ViewProviderPage::toggleFrameState()
|
||||||
{
|
{
|
||||||
// Base::Console().Message("VPP::toggleFrameState()\n");
|
// Base::Console().Message("VPP::toggleFrameState()\n");
|
||||||
if (m_graphicsScene) {
|
if (m_graphicsScene) {
|
||||||
setFrameState(!getFrameState());
|
setFrameState(!getFrameState());
|
||||||
m_graphicsScene->refreshViews();
|
m_graphicsScene->refreshViews();
|
||||||
@@ -437,8 +462,8 @@ void ViewProviderPage::toggleFrameState()
|
|||||||
|
|
||||||
void ViewProviderPage::setTemplateMarkers(bool state)
|
void ViewProviderPage::setTemplateMarkers(bool state)
|
||||||
{
|
{
|
||||||
// Base::Console().Message("VPP::setTemplateMarkers(%d)\n", state);
|
// Base::Console().Message("VPP::setTemplateMarkers(%d)\n", state);
|
||||||
App::DocumentObject *templateFeat = nullptr;
|
App::DocumentObject* templateFeat = nullptr;
|
||||||
templateFeat = getDrawPage()->Template.getValue();
|
templateFeat = getDrawPage()->Template.getValue();
|
||||||
Gui::Document* guiDoc = Gui::Application::Instance->getDocument(templateFeat->getDocument());
|
Gui::Document* guiDoc = Gui::Application::Instance->getDocument(templateFeat->getDocument());
|
||||||
Gui::ViewProvider* vp = guiDoc->getViewProvider(templateFeat);
|
Gui::ViewProvider* vp = guiDoc->getViewProvider(templateFeat);
|
||||||
@@ -452,7 +477,7 @@ void ViewProviderPage::setTemplateMarkers(bool state)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ViewProviderPage::canDelete(App::DocumentObject *obj) const
|
bool ViewProviderPage::canDelete(App::DocumentObject* obj) const
|
||||||
{
|
{
|
||||||
// deletions from a page don't necessarily destroy anything
|
// deletions from a page don't necessarily destroy anything
|
||||||
// thus we can pass this action
|
// thus we can pass this action
|
||||||
@@ -472,11 +497,11 @@ bool ViewProviderPage::canDragObject(App::DocumentObject* docObj) const
|
|||||||
return getVPPExtension()->extensionCanDragObject(docObj);
|
return getVPPExtension()->extensionCanDragObject(docObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ViewProviderPage::canDropObjectEx(App::DocumentObject* obj, App::DocumentObject *owner,
|
bool ViewProviderPage::canDropObjectEx(App::DocumentObject* obj, App::DocumentObject* owner,
|
||||||
const char *subname, const std::vector<std::string> &elements) const
|
const char* subname,
|
||||||
|
const std::vector<std::string>& elements) const
|
||||||
{
|
{
|
||||||
return getVPPExtension()->extensionCanDropObjectEx(obj, owner, subname, elements);
|
return getVPPExtension()->extensionCanDropObjectEx(obj, owner, subname, elements);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ViewProviderPage::canDropObject(App::DocumentObject* docObj) const
|
bool ViewProviderPage::canDropObject(App::DocumentObject* docObj) const
|
||||||
@@ -510,12 +535,9 @@ TechDraw::DrawPage* ViewProviderPage::getDrawPage() const
|
|||||||
return dynamic_cast<TechDraw::DrawPage*>(pcObject);
|
return dynamic_cast<TechDraw::DrawPage*>(pcObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
Gui::MDIView *ViewProviderPage::getMDIView() const
|
Gui::MDIView* ViewProviderPage::getMDIView() const { return m_mdiView.data(); }
|
||||||
{
|
|
||||||
return m_mdiView.data();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ViewProviderPage::setGrid()
|
void ViewProviderPage::setGrid()
|
||||||
{
|
{
|
||||||
TechDraw::DrawPage* dp = getDrawPage();
|
TechDraw::DrawPage* dp = getDrawPage();
|
||||||
if (!dp) {
|
if (!dp) {
|
||||||
@@ -533,7 +555,8 @@ void ViewProviderPage::setGrid()
|
|||||||
if (ShowGrid.getValue()) {
|
if (ShowGrid.getValue()) {
|
||||||
widget->showGrid(true);
|
widget->showGrid(true);
|
||||||
widget->makeGrid(pageWidth, pageHeight, gridStep);
|
widget->makeGrid(pageWidth, pageHeight, gridStep);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
widget->showGrid(false);
|
widget->showGrid(false);
|
||||||
}
|
}
|
||||||
widget->updateViewport();
|
widget->updateViewport();
|
||||||
@@ -547,7 +570,4 @@ ViewProviderPageExtension* ViewProviderPage::getVPPExtension() const
|
|||||||
return vppe;
|
return vppe;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* ViewProviderPage::whoAmI() const
|
const char* ViewProviderPage::whoAmI() const { return m_pageName.c_str(); }
|
||||||
{
|
|
||||||
return m_pageName.c_str();
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -26,26 +26,30 @@
|
|||||||
|
|
||||||
#include <Mod/TechDraw/TechDrawGlobal.h>
|
#include <Mod/TechDraw/TechDrawGlobal.h>
|
||||||
|
|
||||||
#include <boost_signals2.hpp>
|
|
||||||
#include <QPointer>
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QPointer>
|
||||||
|
#include <boost_signals2.hpp>
|
||||||
|
|
||||||
#include <App/PropertyUnits.h>
|
#include <App/PropertyUnits.h>
|
||||||
#include <Gui/ViewProviderDocumentObject.h>
|
#include <Gui/ViewProviderDocumentObject.h>
|
||||||
#include <ViewProviderPageExtension.h>
|
#include <ViewProviderPageExtension.h>
|
||||||
|
|
||||||
namespace TechDraw{
|
namespace TechDraw
|
||||||
class DrawPage;
|
{
|
||||||
}
|
class DrawPage;
|
||||||
|
class DrawTemplate;
|
||||||
|
}// namespace TechDraw
|
||||||
|
|
||||||
namespace TechDrawGui {
|
namespace TechDrawGui
|
||||||
|
{
|
||||||
|
|
||||||
class MDIViewPage;
|
class MDIViewPage;
|
||||||
class QGVPage;
|
class QGVPage;
|
||||||
class QGSPage;
|
class QGSPage;
|
||||||
|
class QGITemplate;
|
||||||
|
|
||||||
class TechDrawGuiExport ViewProviderPage : public Gui::ViewProviderDocumentObject,
|
class TechDrawGuiExport ViewProviderPage: public Gui::ViewProviderDocumentObject,
|
||||||
public ViewProviderPageExtension
|
public ViewProviderPageExtension
|
||||||
{
|
{
|
||||||
PROPERTY_HEADER_WITH_OVERRIDE(TechDrawGui::ViewProviderPage);
|
PROPERTY_HEADER_WITH_OVERRIDE(TechDrawGui::ViewProviderPage);
|
||||||
|
|
||||||
@@ -55,11 +59,11 @@ public:
|
|||||||
/// destructor
|
/// destructor
|
||||||
~ViewProviderPage() override;
|
~ViewProviderPage() override;
|
||||||
|
|
||||||
App::PropertyBool ShowFrames;
|
App::PropertyBool ShowFrames;
|
||||||
App::PropertyBool ShowGrid;
|
App::PropertyBool ShowGrid;
|
||||||
App::PropertyDistance GridSpacing;
|
App::PropertyDistance GridSpacing;
|
||||||
|
|
||||||
void attach(App::DocumentObject *) override;
|
void attach(App::DocumentObject*) override;
|
||||||
void setDisplayMode(const char* ModeName) override;
|
void setDisplayMode(const char* ModeName) override;
|
||||||
|
|
||||||
bool canDragObjects() const override;
|
bool canDragObjects() const override;
|
||||||
@@ -69,10 +73,10 @@ public:
|
|||||||
void dropObject(App::DocumentObject* docObj) override;
|
void dropObject(App::DocumentObject* docObj) override;
|
||||||
void constDropObject(App::DocumentObject* docObj) const;
|
void constDropObject(App::DocumentObject* docObj) const;
|
||||||
|
|
||||||
bool canDropObjectEx(App::DocumentObject *obj, App::DocumentObject *owner,
|
bool canDropObjectEx(App::DocumentObject* obj, App::DocumentObject* owner, const char* subname,
|
||||||
const char *subname, const std::vector<std::string> &elements) const override;
|
const std::vector<std::string>& elements) const override;
|
||||||
|
|
||||||
bool useNewSelectionModel() const override {return false;}
|
bool useNewSelectionModel() const override { return false; }
|
||||||
/// returns a list of all possible modes
|
/// returns a list of all possible modes
|
||||||
std::vector<std::string> getDisplayModes() const override;
|
std::vector<std::string> getDisplayModes() const override;
|
||||||
/// Hides the view provider
|
/// Hides the view provider
|
||||||
@@ -87,11 +91,13 @@ public:
|
|||||||
/// Is called by the tree if the user double click on the object
|
/// Is called by the tree if the user double click on the object
|
||||||
bool doubleClicked() override;
|
bool doubleClicked() override;
|
||||||
void setupContextMenu(QMenu*, QObject*, const char*) override;
|
void setupContextMenu(QMenu*, QObject*, const char*) override;
|
||||||
bool onDelete(const std::vector<std::string> &) override;
|
bool onDelete(const std::vector<std::string>&) override;
|
||||||
void onChanged(const App::Property *prop) override;
|
void onChanged(const App::Property* prop) override;
|
||||||
void updateData(const App::Property* prop) override;
|
void updateData(const App::Property* prop) override;
|
||||||
|
|
||||||
TechDraw::DrawPage* getDrawPage() const;
|
TechDraw::DrawPage* getDrawPage() const;
|
||||||
|
TechDraw::DrawTemplate* getTemplate() const;
|
||||||
|
QGITemplate* getQTemplate(void) const;
|
||||||
|
|
||||||
//slots & connections
|
//slots & connections
|
||||||
void onGuiRepaint(const TechDraw::DrawPage* dp);
|
void onGuiRepaint(const TechDraw::DrawPage* dp);
|
||||||
@@ -103,7 +109,7 @@ public:
|
|||||||
bool showMDIViewPage();
|
bool showMDIViewPage();
|
||||||
void removeMDIView();
|
void removeMDIView();
|
||||||
|
|
||||||
Gui::MDIView *getMDIView() const override;
|
Gui::MDIView* getMDIView() const override;
|
||||||
|
|
||||||
bool getFrameState();
|
bool getFrameState();
|
||||||
void setFrameState(bool state);
|
void setFrameState(bool state);
|
||||||
@@ -112,10 +118,10 @@ public:
|
|||||||
|
|
||||||
bool canDelete(App::DocumentObject* obj) const override;
|
bool canDelete(App::DocumentObject* obj) const override;
|
||||||
|
|
||||||
void setGrid();
|
void setGrid();
|
||||||
|
|
||||||
QGSPage* getQGSPage(void) {return m_graphicsScene;}
|
QGSPage* getQGSPage(void) { return m_graphicsScene; }
|
||||||
QGVPage* getQGVPage(void) {return m_graphicsView;}
|
QGVPage* getQGVPage(void) { return m_graphicsView; }
|
||||||
|
|
||||||
ViewProviderPageExtension* getVPPExtension() const;
|
ViewProviderPageExtension* getVPPExtension() const;
|
||||||
|
|
||||||
@@ -132,7 +138,7 @@ private:
|
|||||||
QGSPage* m_graphicsScene;
|
QGSPage* m_graphicsScene;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace TechDrawGui
|
}// namespace TechDrawGui
|
||||||
|
|
||||||
|
|
||||||
#endif // DRAWINGGUI_VIEWPROVIDERPAGE_H
|
#endif// DRAWINGGUI_VIEWPROVIDERPAGE_H
|
||||||
|
|||||||
Reference in New Issue
Block a user