[TD]Allow forced redraw of Page
This commit is contained in:
@@ -50,6 +50,7 @@
|
||||
#include "DrawViewPart.h"
|
||||
#include "DrawViewDimension.h"
|
||||
#include "DrawViewBalloon.h"
|
||||
#include "DrawLeaderLine.h"
|
||||
|
||||
#include <Mod/TechDraw/App/DrawPagePy.h> // generated from DrawPagePy.xml
|
||||
|
||||
@@ -75,6 +76,7 @@ DrawPage::DrawPage(void)
|
||||
{
|
||||
static const char *group = "Page";
|
||||
nowUnsetting = false;
|
||||
forceRedraw(false);
|
||||
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/General");
|
||||
@@ -127,17 +129,7 @@ void DrawPage::onChanged(const App::Property* prop)
|
||||
!isUnsetting()) {
|
||||
//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());
|
||||
auto views(Views.getValues());
|
||||
for (auto& v: views) {
|
||||
//check for children of current view
|
||||
if (v->isDerivedFrom(TechDraw::DrawViewCollection::getClassTypeId())) {
|
||||
auto dvc = static_cast<TechDraw::DrawViewCollection*>(v);
|
||||
for (auto& vv: dvc->Views.getValues()) {
|
||||
vv->touch();
|
||||
}
|
||||
}
|
||||
v->recomputeFeature(); //get all views up to date
|
||||
}
|
||||
updateAllViews();
|
||||
}
|
||||
} else if (prop == &Template) {
|
||||
if (!isRestoring() &&
|
||||
@@ -339,6 +331,7 @@ void DrawPage::onDocumentRestored()
|
||||
App::DocumentObject::onDocumentRestored();
|
||||
}
|
||||
|
||||
//should really be called "updateMostViews". can still be problems to due execution order.
|
||||
void DrawPage::updateAllViews()
|
||||
{
|
||||
std::vector<App::DocumentObject*> featViews = getAllViews();
|
||||
@@ -358,6 +351,14 @@ void DrawPage::updateAllViews()
|
||||
dim->recomputeFeature();
|
||||
}
|
||||
}
|
||||
|
||||
//third, try to execute all leader lines. may not work if parent DVP isn't ready.
|
||||
for(it = featViews.begin(); it != featViews.end(); ++it) {
|
||||
TechDraw::DrawLeaderLine *line = dynamic_cast<TechDraw::DrawLeaderLine *>(*it);
|
||||
if (line != nullptr) {
|
||||
line->recomputeFeature();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<App::DocumentObject*> DrawPage::getAllViews(void)
|
||||
|
||||
@@ -101,6 +101,8 @@ public:
|
||||
void updateAllViews(void);
|
||||
static bool GlobalUpdateDrawings(void);
|
||||
static bool AllowPageOverride(void);
|
||||
void forceRedraw(bool b) { m_forceRedraw = b; }
|
||||
bool forceRedraw(void) { return m_forceRedraw; }
|
||||
|
||||
protected:
|
||||
void onBeforeChange(const App::Property* prop) override;
|
||||
@@ -108,6 +110,7 @@ protected:
|
||||
virtual void onDocumentRestored() override;
|
||||
virtual void unsetupObject() override;
|
||||
|
||||
bool m_forceRedraw;
|
||||
|
||||
private:
|
||||
static const char* ProjectionTypeEnums[];
|
||||
|
||||
@@ -367,9 +367,11 @@ bool DrawView::keepUpdated(void)
|
||||
bool result = false;
|
||||
|
||||
bool pageUpdate = false;
|
||||
bool force = false;
|
||||
TechDraw::DrawPage *page = findParentPage();
|
||||
if(page) {
|
||||
pageUpdate = page->KeepUpdated.getValue();
|
||||
force = page->forceRedraw();
|
||||
}
|
||||
|
||||
if (DrawPage::GlobalUpdateDrawings() &&
|
||||
@@ -380,6 +382,9 @@ bool DrawView::keepUpdated(void)
|
||||
pageUpdate) {
|
||||
result = true;
|
||||
}
|
||||
if (force) { //when do we turn this off??
|
||||
result = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -94,9 +94,10 @@ void DrawViewSymbol::onChanged(const App::Property* prop)
|
||||
App::DocumentObjectExecReturn *DrawViewSymbol::execute(void)
|
||||
{
|
||||
// Base::Console().Message("DVS::execute() \n");
|
||||
if (!keepUpdated()) {
|
||||
return App::DocumentObject::StdReturn;
|
||||
}
|
||||
// //dvs::execute is pretty fast. doesn't need to be blocked?
|
||||
// if (!keepUpdated()) {
|
||||
// return App::DocumentObject::StdReturn;
|
||||
// }
|
||||
|
||||
std::string svg = Symbol.getValue();
|
||||
const std::vector<std::string>& editText = EditableTexts.getValues();
|
||||
|
||||
Reference in New Issue
Block a user