Merge pull request #19433 from tritao/gui-general-code-cleanups
Gui: General code cleanups
This commit is contained in:
@@ -557,7 +557,7 @@ const char* InterpreterSingleton::init(int argc, char* argv[])
|
||||
PyRun_SimpleString(
|
||||
"# Check for virtualenv, and activate if present.\n"
|
||||
"# See "
|
||||
"https://virtualenv.pypa.io/en/latest/userguide/"
|
||||
"https://virtualenv.pypa.io/en/latest/"
|
||||
"#using-virtualenv-without-bin-python\n"
|
||||
"import os\n"
|
||||
"import sys\n"
|
||||
|
||||
@@ -185,33 +185,7 @@ public:
|
||||
const SelectionChanges *pOriginalMsg = nullptr;
|
||||
};
|
||||
|
||||
} //namespace Gui
|
||||
|
||||
|
||||
|
||||
// Export an instance of the base class (to avoid warning C4275, see also
|
||||
// C++ Language Reference/General Rules and Limitations on MSDN for more details.)
|
||||
//
|
||||
// For compiler gcc4.1 we need to define the template class outside namespace 'Gui'
|
||||
// otherwise we get the compiler error:
|
||||
// 'explicit instantiation of 'class Base::Subject<const Gui::SelectionChanges&>'
|
||||
// in namespace 'Gui' (which does not enclose namespace 'Base')
|
||||
//
|
||||
// It seems that this construct is not longer needed for gcc4.4 and even leads to
|
||||
// errors under Mac OS X. Thus, we check for version between 4.1 and 4.4.
|
||||
// It seems that for Mac OS X this can be completely ignored
|
||||
|
||||
#if defined(__GNUC__) && defined(__GNUC_MINOR__) && !defined(FC_OS_MACOSX)
|
||||
#define GNUC_VERSION (((__GNUC__)<<16)+((__GNUC_MINOR__)<<8))
|
||||
#if GNUC_VERSION >= 0x040100 && GNUC_VERSION < 0x040400
|
||||
template class GuiExport Base::Subject<const Gui::SelectionChanges&>;
|
||||
#endif
|
||||
#undef GNUC_VERSION
|
||||
#endif
|
||||
|
||||
namespace Gui
|
||||
{
|
||||
class ViewProviderDocumentObject;
|
||||
class ViewProviderDocumentObject;
|
||||
|
||||
/**
|
||||
* The SelectionObserver class simplifies the step to write classes that listen
|
||||
@@ -465,7 +439,7 @@ public:
|
||||
*
|
||||
* @param pDocName: document name. If no document name is given the objects
|
||||
* of the active are returned. If nothing for this Document is selected an
|
||||
* empty vector is returned. If document name is "*", then all document is
|
||||
* empty vector is returned. If document name is "*", then all documents are
|
||||
* considered.
|
||||
* @param typeId: specify the type of object to be returned.
|
||||
* @param resolve: sub-object resolving mode.
|
||||
@@ -473,7 +447,7 @@ public:
|
||||
* 1 resolve sub-object with old style element name
|
||||
* 2 resolve sub-object with new style element name
|
||||
* @param single: if set to true, then it will return an empty vector if
|
||||
* there is more than one selections.
|
||||
* there is more than one selection.
|
||||
*
|
||||
* @return The returned vector reflects the sequence of selection.
|
||||
*/
|
||||
|
||||
@@ -486,8 +486,6 @@ void View3DInventorViewer::init()
|
||||
// increase refcount before passing it to setScenegraph(), to avoid
|
||||
// premature destruction
|
||||
pcViewProviderRoot->ref();
|
||||
// is not really working with Coin3D.
|
||||
//redrawOverlayOnSelectionChange(pcSelection);
|
||||
setSceneGraph(pcViewProviderRoot);
|
||||
// Event callback node
|
||||
pEventCallback = new SoEventCallback();
|
||||
@@ -810,7 +808,7 @@ bool View3DInventorViewer::searchNode(SoNode* node) const
|
||||
searchAction.setInterest(SoSearchAction::FIRST);
|
||||
searchAction.apply(this->getSceneGraph());
|
||||
SoPath* selectionPath = searchAction.getPath();
|
||||
return selectionPath ? true : false;
|
||||
return selectionPath != nullptr;
|
||||
}
|
||||
|
||||
bool View3DInventorViewer::hasViewProvider(ViewProvider* pcProvider) const
|
||||
|
||||
@@ -96,10 +96,10 @@ ViewProvider::ViewProvider()
|
||||
setStatus(UpdateData, true);
|
||||
|
||||
|
||||
// SoFCSeparater and SoFCSelectionRoot can both track render cache setting.
|
||||
// SoFCSeparator and SoFCSelectionRoot can both track render cache setting.
|
||||
// We change to SoFCSelectionRoot so that we can dynamically change full
|
||||
// selection mode (full highlight vs. boundbox). Note that comparing to
|
||||
// SoFCSeparater, there are some small overhead with SoFCSelectionRoot for
|
||||
// SoFCSeparator, there are some small overhead with SoFCSelectionRoot for
|
||||
// selection context tracking.
|
||||
//
|
||||
// pcRoot = new SoFCSeparator(true);
|
||||
@@ -906,6 +906,7 @@ std::vector< App::DocumentObject* > ViewProvider::claimChildren3D() const
|
||||
}
|
||||
return vec;
|
||||
}
|
||||
|
||||
bool ViewProvider::getElementPicked(const SoPickedPoint *pp, std::string &subname) const {
|
||||
if(!isSelectable())
|
||||
return false;
|
||||
|
||||
@@ -178,7 +178,7 @@ public:
|
||||
* @param append: If true, pPath will be first appended with the root node and
|
||||
* the mode switch node of this view provider.
|
||||
*
|
||||
* @return the coint detail of the subelement
|
||||
* @return the coin detail of the subelement
|
||||
*
|
||||
* If this view provider links to other view provider, then the
|
||||
* implementation of getDetailPath() shall also append all intermediate
|
||||
|
||||
@@ -48,8 +48,7 @@ class ViewProviderDocumentObject;
|
||||
*/
|
||||
class GuiExport ViewProviderExtension : public App::Extension
|
||||
{
|
||||
|
||||
//The cass does not have properties itself, but it is important to provide the property access
|
||||
//The class does not have properties itself, but it is important to provide the property access
|
||||
//functions.
|
||||
EXTENSION_PROPERTY_HEADER_WITH_OVERRIDE(Gui::ViewProviderExtension);
|
||||
|
||||
@@ -124,7 +123,6 @@ public:
|
||||
|
||||
private:
|
||||
bool m_ignoreOverlayIcon = false;
|
||||
//Gui::ViewProviderDocumentObject* m_viewBase = nullptr;
|
||||
};
|
||||
|
||||
} //Gui
|
||||
|
||||
@@ -283,7 +283,7 @@ public:
|
||||
continue;
|
||||
int count = pcSwitches[i]->getNumChildren();
|
||||
if((index<0 && i==LinkView::SnapshotChild) || !count)
|
||||
pcSwitches[i]->whichChild = -1;
|
||||
pcSwitches[i]->whichChild = SO_SWITCH_NONE;
|
||||
else if(count>pcLinked->getDefaultMode())
|
||||
pcSwitches[i]->whichChild = pcLinked->getDefaultMode();
|
||||
else
|
||||
@@ -313,12 +313,8 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
// VC2013 has trouble with template argument dependent lookup in
|
||||
// MSVC has trouble with template argument dependent lookup in
|
||||
// namespace. Have to put the below functions in global namespace.
|
||||
//
|
||||
// However, gcc seems to behave the opposite, hence the conditional
|
||||
// compilation here.
|
||||
//
|
||||
#if defined(_MSC_VER)
|
||||
friend void Gui::intrusive_ptr_add_ref(LinkInfo *px);
|
||||
friend void Gui::intrusive_ptr_release(LinkInfo *px);
|
||||
@@ -334,7 +330,7 @@ public:
|
||||
for(int idx : indices) {
|
||||
if(!pcSwitches[idx])
|
||||
continue;
|
||||
if(pcSwitches[idx]->whichChild.getValue()==-1)
|
||||
if(pcSwitches[idx]->whichChild.getValue()==SO_SWITCH_NONE)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -348,7 +344,7 @@ public:
|
||||
if(!pcSwitches[idx])
|
||||
continue;
|
||||
if(!visible)
|
||||
pcSwitches[idx]->whichChild = -1;
|
||||
pcSwitches[idx]->whichChild = SO_SWITCH_NONE;
|
||||
else if(pcSwitches[idx]->getNumChildren()>pcLinked->getDefaultMode())
|
||||
pcSwitches[idx]->whichChild = pcLinked->getDefaultMode();
|
||||
}
|
||||
@@ -389,7 +385,7 @@ public:
|
||||
pcLinkedSwitch.reset();
|
||||
|
||||
coinRemoveAllChildren(pcSnapshot);
|
||||
pcModeSwitch->whichChild = -1;
|
||||
pcModeSwitch->whichChild = SO_SWITCH_NONE;
|
||||
coinRemoveAllChildren(pcModeSwitch);
|
||||
|
||||
SoSwitch *pcUpdateSwitch = pcModeSwitch;
|
||||
@@ -1142,7 +1138,7 @@ void LinkView::setChildren(const std::vector<App::DocumentObject*> &children,
|
||||
auto &info = *nodeArray[i];
|
||||
info.isGroup = false;
|
||||
info.groupIndex = -1;
|
||||
info.pcSwitch->whichChild = (vis.size()<=i||vis[i])?0:-1;
|
||||
info.pcSwitch->whichChild = (vis.size()<=i||vis[i])?0:SO_SWITCH_NONE;
|
||||
info.link(obj);
|
||||
if(obj->hasExtension(App::GroupExtension::getExtensionClassTypeId(),false)) {
|
||||
info.isGroup = true;
|
||||
@@ -1193,7 +1189,7 @@ void LinkView::setTransform(int index, const Base::Matrix4D &mat) {
|
||||
|
||||
void LinkView::setElementVisible(int idx, bool visible) {
|
||||
if(idx>=0 && idx<(int)nodeArray.size())
|
||||
nodeArray[idx]->pcSwitch->whichChild = visible?0:-1;
|
||||
nodeArray[idx]->pcSwitch->whichChild = visible?0:SO_SWITCH_NONE;
|
||||
}
|
||||
|
||||
bool LinkView::isElementVisible(int idx) const {
|
||||
|
||||
@@ -41,7 +41,7 @@ class LinkInfo;
|
||||
using LinkInfoPtr = boost::intrusive_ptr<LinkInfo>;
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
// forward declaration to please VC 2013
|
||||
// forward declaration to please MSVC
|
||||
void intrusive_ptr_add_ref(Gui::LinkInfo *px);
|
||||
void intrusive_ptr_release(Gui::LinkInfo *px);
|
||||
#endif
|
||||
|
||||
@@ -428,7 +428,6 @@ class ViewProviderBuildingPart:
|
||||
def __init__(self,vobj):
|
||||
|
||||
vobj.addExtension("Gui::ViewProviderGroupExtensionPython")
|
||||
#vobj.addExtension("Gui::ViewProviderGeoFeatureGroupExtensionPython")
|
||||
vobj.Proxy = self
|
||||
self.setProperties(vobj)
|
||||
vobj.ShapeColor = ArchCommands.getDefaultColor("Helpers")
|
||||
|
||||
@@ -292,7 +292,7 @@ class BIM_Views:
|
||||
top.addChild(i)
|
||||
vm.viewtree.addTopLevelItem(top)
|
||||
|
||||
# set TreeVinew Item selected if obj is selected
|
||||
# set TreeView Item selected if obj is selected
|
||||
bold = QtGui.QFont()
|
||||
bold.setBold(True)
|
||||
objSelected = FreeCADGui.Selection.getSelection()
|
||||
|
||||
@@ -1446,7 +1446,7 @@ class boxTracker(Tracker):
|
||||
|
||||
|
||||
class radiusTracker(Tracker):
|
||||
"""A tracker that displays a transparent sphere to inicate a radius."""
|
||||
"""A tracker that displays a transparent sphere to indicate a radius."""
|
||||
|
||||
def __init__(self, position=FreeCAD.Vector(0, 0, 0), radius=1):
|
||||
self.trans = coin.SoTransform()
|
||||
|
||||
Reference in New Issue
Block a user