Skip to content

Commit

Permalink
Merge pull request #212 from WandererFan/TDFix
Browse files Browse the repository at this point in the history
TechDraw: 2 Minor Fixes
  • Loading branch information
yorikvanhavre committed Jul 12, 2016
2 parents 2ac560e + 3c2222b commit 8f84b19
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
13 changes: 7 additions & 6 deletions src/Mod/TechDraw/App/DrawView.cpp
Expand Up @@ -70,10 +70,12 @@ DrawView::DrawView(void)
ScaleType.setEnums(ScaleTypeEnums);
ADD_PROPERTY_TYPE(ScaleType,((long)0),group, App::Prop_None, "Scale Type");
ADD_PROPERTY_TYPE(Scale ,(1.0),group,App::Prop_None,"Scale factor of the view");
Scale.setStatus(App::Property::ReadOnly,true);

autoPos = true;

if (isRestoring()) {
autoPos = false;
} else {
autoPos = true;
}
}

DrawView::~DrawView()
Expand Down Expand Up @@ -119,14 +121,13 @@ void DrawView::onChanged(const App::Property* prop)
TechDraw::DrawPage *page = findParentPage();
if(page) {
if(std::abs(page->Scale.getValue() - Scale.getValue()) > FLT_EPSILON) {
Scale.setValue(page->Scale.getValue()); // Recalculate scale from page
Scale.setValue(page->Scale.getValue()); // Reset scale from page
Scale.touch();
}
}
Scale.setStatus(App::Property::ReadOnly,true);
App::GetApplication().signalChangePropertyEditor(Scale);
} else if (ScaleType.isValue("Custom") &&
Scale.testStatus(App::Property::ReadOnly)) {
} else if ( ScaleType.isValue("Custom") ) {
Scale.setStatus(App::Property::ReadOnly,false);
App::GetApplication().signalChangePropertyEditor(Scale);
}
Expand Down
4 changes: 3 additions & 1 deletion src/Mod/TechDraw/Gui/QGIView.cpp
Expand Up @@ -251,7 +251,9 @@ void QGIView::updateView(bool update)

if (update ||
getViewObject()->Rotation.isTouched()) {
//NOTE: QPainterPaths have to be rotated individually. This transform handles everything else.
//NOTE: QPainterPaths have to be rotated individually. This transform handles Rotation for everything else.
//Scale is handled in GeometryObject for DVP & descendents
//Objects not descended from DVP must setScale for themselves
double rot = getViewObject()->Rotation.getValue();
QPointF centre = boundingRect().center();
setTransform(QTransform().translate(centre.x(), centre.y()).rotate(-rot).translate(-centre.x(), -centre.y()));
Expand Down
5 changes: 4 additions & 1 deletion src/Mod/TechDraw/Gui/QGIViewSymbol.cpp
Expand Up @@ -89,7 +89,6 @@ void QGIViewSymbol::updateView(bool update)
}

if (viewSymbol->Scale.isTouched()) {
setScale(viewSymbol->Scale.getValue());
draw();
}

Expand All @@ -102,6 +101,10 @@ void QGIViewSymbol::draw()
return;
}

//note: svg's are overscaled by (72 pixels(pts actually) /in)*(1 in/25.4 mm) = 2.834645669 (could be 96/25.4(CSS)? 110/25.4?)
//due to 1 sceneUnit (1mm) = 1 pixel for some QtSvg functions
TechDraw::DrawViewSymbol *viewSymbol = dynamic_cast<TechDraw::DrawViewSymbol *>(getViewObject());
setScale(viewSymbol->Scale.getValue());
drawSvg();
if (borderVisible) {
drawBorder();
Expand Down

0 comments on commit 8f84b19

Please sign in to comment.