[TD]Add parameters to control drawing update
This commit is contained in:
@@ -78,7 +78,7 @@ DrawPage::DrawPage(void)
|
||||
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/General");
|
||||
bool autoUpdate = hGrp->GetBool("KeepPagesUpToDate", 1l);
|
||||
bool autoUpdate = hGrp->GetBool("KeepPagesUpToDate", true); //this is the default value for new pages!
|
||||
|
||||
ADD_PROPERTY_TYPE(KeepUpdated, (autoUpdate), group, (App::PropertyType)(App::Prop_Output), "Keep page in sync with model");
|
||||
ADD_PROPERTY_TYPE(Template, (0), group, (App::PropertyType)(App::Prop_None), "Attached Template");
|
||||
@@ -324,14 +324,23 @@ void DrawPage::requestPaint(void)
|
||||
signalGuiPaint(this);
|
||||
}
|
||||
|
||||
//this doesn't work right because there is no guaranteed of the restoration order
|
||||
void DrawPage::onDocumentRestored()
|
||||
{
|
||||
//control drawing updates on restore based on Preference
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/General");
|
||||
bool autoUpdate = hGrp->GetBool("KeepPagesUpToDate", 1l);
|
||||
KeepUpdated.setValue(autoUpdate);
|
||||
if (GlobalUpdateDrawings() &&
|
||||
KeepUpdated.getValue()) {
|
||||
updateAllViews();
|
||||
} else if (!GlobalUpdateDrawings() &&
|
||||
AllowPageOverride() &&
|
||||
KeepUpdated.getValue()) {
|
||||
updateAllViews();
|
||||
}
|
||||
|
||||
App::DocumentObject::onDocumentRestored();
|
||||
}
|
||||
|
||||
void DrawPage::updateAllViews()
|
||||
{
|
||||
std::vector<App::DocumentObject*> featViews = getAllViews();
|
||||
std::vector<App::DocumentObject*>::const_iterator it = featViews.begin();
|
||||
//first, make sure all the Parts have been executed so GeometryObjects exist
|
||||
@@ -349,7 +358,6 @@ void DrawPage::onDocumentRestored()
|
||||
dim->recomputeFeature();
|
||||
}
|
||||
}
|
||||
App::DocumentObject::onDocumentRestored();
|
||||
}
|
||||
|
||||
std::vector<App::DocumentObject*> DrawPage::getAllViews(void)
|
||||
@@ -439,6 +447,23 @@ void DrawPage::handleChangedPropertyType(
|
||||
}
|
||||
}
|
||||
|
||||
bool DrawPage::GlobalUpdateDrawings(void)
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/General");
|
||||
bool result = hGrp->GetBool("GlobalUpdateDrawings", true);
|
||||
return result;
|
||||
}
|
||||
|
||||
bool DrawPage::AllowPageOverride(void)
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/General");
|
||||
bool result = hGrp->GetBool("AllowPageOverride", true);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// Python Drawing feature ---------------------------------------------------------
|
||||
|
||||
namespace App {
|
||||
|
||||
@@ -97,6 +97,10 @@ public:
|
||||
DrawViewPart *balloonParent; //could be many balloons on page?
|
||||
|
||||
int getNextBalloonIndex(void);
|
||||
|
||||
void updateAllViews(void);
|
||||
static bool GlobalUpdateDrawings(void);
|
||||
static bool AllowPageOverride(void);
|
||||
|
||||
protected:
|
||||
void onBeforeChange(const App::Property* prop) override;
|
||||
|
||||
@@ -365,10 +365,22 @@ void DrawView::handleChangedPropertyType(
|
||||
bool DrawView::keepUpdated(void)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
bool pageUpdate = false;
|
||||
TechDraw::DrawPage *page = findParentPage();
|
||||
if(page) {
|
||||
result = page->KeepUpdated.getValue();
|
||||
pageUpdate = page->KeepUpdated.getValue();
|
||||
}
|
||||
|
||||
if (DrawPage::GlobalUpdateDrawings() &&
|
||||
pageUpdate) {
|
||||
result = true;
|
||||
} else if (!DrawPage::GlobalUpdateDrawings() &&
|
||||
DrawPage::AllowPageOverride() &&
|
||||
pageUpdate) {
|
||||
result = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,12 +7,15 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>558</width>
|
||||
<height>935</height>
|
||||
<height>1095</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>TechDraw General</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Default value for new Page</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="gbMisc">
|
||||
@@ -141,25 +144,6 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="Gui::PrefCheckBox" name="cb_PageUpdate">
|
||||
<property name="toolTip">
|
||||
<string>Update Pages as scheduled or skip</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Keep Pages Up to Date</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>KeepPagesUpToDate</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/TechDraw/General</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="Gui::PrefCheckBox" name="cb_AutoDist">
|
||||
<property name="toolTip">
|
||||
<string>Automatically distribute secondary views.</string>
|
||||
@@ -178,6 +162,76 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Drawing Updates</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="Gui::PrefCheckBox" name="cb_Global">
|
||||
<property name="toolTip">
|
||||
<string>Update drawings with changes in 3D model</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Update with 3D (Global Policy)</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>GlobalUpdateDrawings</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/TechDraw/General</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="Gui::PrefCheckBox" name="cb_Override">
|
||||
<property name="toolTip">
|
||||
<string>Allow Page to override Global update setting</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Allow Page Override</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>AllowPageOverride</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/TechDraw/General</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="Gui::PrefCheckBox" name="cb_PageUpdate">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Update Pages as scheduled or skip updates. This is the default setting for new Pages.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Keep Page Up to Date (default)</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>KeepPagesUpToDate</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/TechDraw/General</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
||||
@@ -50,6 +50,8 @@ void DlgPrefsTechDrawImp::saveSettings()
|
||||
cb_Faces->onSave();
|
||||
cb_SectionEdges->onSave();
|
||||
cb_PageUpdate->onSave();
|
||||
cb_Global->onSave();
|
||||
cb_Override->onSave();
|
||||
cb_AutoDist->onSave();
|
||||
|
||||
pcb_Normal->onSave();
|
||||
@@ -81,6 +83,8 @@ void DlgPrefsTechDrawImp::loadSettings()
|
||||
cb_Faces->onRestore();
|
||||
cb_SectionEdges->onRestore();
|
||||
cb_PageUpdate->onRestore();
|
||||
cb_Global->onRestore();
|
||||
cb_Override->onRestore();
|
||||
cb_AutoDist->onRestore();
|
||||
|
||||
pcb_Normal->onRestore();
|
||||
|
||||
@@ -259,8 +259,8 @@ bool ViewProviderPage::showMDIViewPage()
|
||||
Gui::getMainWindow()->addWindow(m_mdiView);
|
||||
m_mdiView->viewAll(); //this is empty function
|
||||
m_mdiView->showMaximized();
|
||||
if(!getDrawPage()->KeepUpdated.getValue())
|
||||
getDrawPage()->KeepUpdated.setValue(true);
|
||||
// if(!getDrawPage()->KeepUpdated.getValue())
|
||||
// getDrawPage()->KeepUpdated.setValue(true);
|
||||
} else {
|
||||
m_mdiView->updateDrawing(true);
|
||||
m_mdiView->redrawAllViews();
|
||||
|
||||
Reference in New Issue
Block a user