Gui: add convenience functions to SelectionFilterGate
This commit is contained in:
@@ -109,6 +109,13 @@ public:
|
||||
virtual bool allow(App::Document*,App::DocumentObject*, const char*);
|
||||
|
||||
protected:
|
||||
static SelectionFilter* nullPointer() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static const char* nullString() {
|
||||
return nullptr;
|
||||
}
|
||||
SelectionFilterGate();
|
||||
|
||||
protected:
|
||||
|
||||
@@ -38,9 +38,9 @@ class FemSelectionGate : public Gui::SelectionFilterGate
|
||||
};
|
||||
|
||||
FemSelectionGate(ElemType type)
|
||||
: Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr),Type(type)
|
||||
: Gui::SelectionFilterGate(nullPointer()),Type(type)
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
ElemType Type;
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
bool canSelect;
|
||||
|
||||
EdgeSelection()
|
||||
: Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr)
|
||||
: Gui::SelectionFilterGate(nullPointer())
|
||||
{
|
||||
canSelect = false;
|
||||
}
|
||||
@@ -352,7 +352,7 @@ void DlgExtrusion::autoSolid()
|
||||
void DlgExtrusion::findShapes()
|
||||
{
|
||||
App::Document* activeDoc = App::GetApplication().getActiveDocument();
|
||||
if (!activeDoc)
|
||||
if (!activeDoc)
|
||||
return;
|
||||
Gui::Document* activeGui = Gui::Application::Instance->getDocument(activeDoc);
|
||||
this->document = activeDoc->getName();
|
||||
|
||||
@@ -172,7 +172,7 @@ namespace PartGui {
|
||||
App::DocumentObject*& object;
|
||||
public:
|
||||
EdgeFaceSelection(App::DocumentObject*& obj)
|
||||
: Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr), allowEdge(true), object(obj)
|
||||
: Gui::SelectionFilterGate(nullPointer()), allowEdge(true), object(obj)
|
||||
{
|
||||
}
|
||||
void selectEdges()
|
||||
@@ -528,7 +528,7 @@ void DlgFilletEdges::toggleCheckState(const QModelIndex& index)
|
||||
void DlgFilletEdges::findShapes()
|
||||
{
|
||||
App::Document* activeDoc = App::GetApplication().getActiveDocument();
|
||||
if (!activeDoc)
|
||||
if (!activeDoc)
|
||||
return;
|
||||
|
||||
std::vector<App::DocumentObject*> objs = activeDoc->getObjectsOfType
|
||||
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
bool canSelect;
|
||||
|
||||
EdgeSelection()
|
||||
: Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr)
|
||||
: Gui::SelectionFilterGate(nullPointer())
|
||||
{
|
||||
canSelect = false;
|
||||
}
|
||||
@@ -111,7 +111,7 @@ public:
|
||||
bool canSelect;
|
||||
|
||||
FaceSelection()
|
||||
: Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr)
|
||||
: Gui::SelectionFilterGate(nullPointer())
|
||||
{
|
||||
canSelect = false;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
bool canSelect;
|
||||
|
||||
EdgeSelection()
|
||||
: Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr)
|
||||
: Gui::SelectionFilterGate(nullPointer())
|
||||
{
|
||||
canSelect = false;
|
||||
}
|
||||
@@ -329,7 +329,7 @@ void DlgRevolution::keyPressEvent(QKeyEvent* ke)
|
||||
void DlgRevolution::findShapes()
|
||||
{
|
||||
App::Document* activeDoc = App::GetApplication().getActiveDocument();
|
||||
if (!activeDoc)
|
||||
if (!activeDoc)
|
||||
return;
|
||||
Gui::Document* activeGui = Gui::Application::Instance->getDocument(activeDoc);
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace PartGui {
|
||||
enum Type {VERTEX, EDGE, FACE, ALL};
|
||||
Type mode;
|
||||
ShapeSelection()
|
||||
: Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr), mode(ALL)
|
||||
: Gui::SelectionFilterGate(nullPointer()), mode(ALL)
|
||||
{
|
||||
}
|
||||
void setMode(Type mode)
|
||||
@@ -172,7 +172,7 @@ void ShapeBuilderWidget::on_createButton_clicked()
|
||||
{
|
||||
int mode = d->bg.checkedId();
|
||||
Gui::Document* doc = Gui::Application::Instance->activeDocument();
|
||||
if (!doc)
|
||||
if (!doc)
|
||||
return;
|
||||
|
||||
try {
|
||||
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
{
|
||||
public:
|
||||
EdgeSelection()
|
||||
: Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr)
|
||||
: Gui::SelectionFilterGate(nullPointer())
|
||||
{
|
||||
}
|
||||
bool allow(App::Document* /*pDoc*/, App::DocumentObject*pObj, const char*sSubName)
|
||||
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
const App::DocumentObject* object;
|
||||
public:
|
||||
FaceSelection(const App::DocumentObject* obj)
|
||||
: Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr), object(obj)
|
||||
: Gui::SelectionFilterGate(nullPointer()), object(obj)
|
||||
{
|
||||
}
|
||||
bool allow(App::Document* /*pDoc*/, App::DocumentObject*pObj, const char*sSubName)
|
||||
|
||||
@@ -43,7 +43,7 @@ class ReferenceSelection : public Gui::SelectionFilterGate
|
||||
public:
|
||||
ReferenceSelection(const App::DocumentObject* support_,
|
||||
AllowSelectionFlags type)
|
||||
: Gui::SelectionFilterGate(static_cast<Gui::SelectionFilter*>(nullptr))
|
||||
: Gui::SelectionFilterGate(nullPointer())
|
||||
, support(support_)
|
||||
, type(type)
|
||||
{
|
||||
@@ -71,7 +71,7 @@ class NoDependentsSelection : public Gui::SelectionFilterGate
|
||||
|
||||
public:
|
||||
NoDependentsSelection(const App::DocumentObject* support_)
|
||||
: Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr), support(support_)
|
||||
: Gui::SelectionFilterGate(nullPointer()), support(support_)
|
||||
{
|
||||
}
|
||||
/**
|
||||
@@ -87,7 +87,7 @@ class CombineSelectionFilterGates: public Gui::SelectionFilterGate
|
||||
|
||||
public:
|
||||
CombineSelectionFilterGates(std::unique_ptr<Gui::SelectionFilterGate> &filter1_, std::unique_ptr<Gui::SelectionFilterGate> &filter2_)
|
||||
: Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr), filter1(std::move(filter1_)), filter2(std::move(filter2_))
|
||||
: Gui::SelectionFilterGate(nullPointer()), filter1(std::move(filter1_)), filter2(std::move(filter2_))
|
||||
{
|
||||
}
|
||||
bool allow(App::Document* pDoc, App::DocumentObject* pObj, const char* sSubName) override;
|
||||
|
||||
@@ -605,7 +605,7 @@ namespace SketcherGui {
|
||||
App::DocumentObject* object;
|
||||
public:
|
||||
GenericConstraintSelection(App::DocumentObject* obj)
|
||||
: Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr)
|
||||
: Gui::SelectionFilterGate(nullPointer())
|
||||
, object(obj), allowedSelTypes(0)
|
||||
{}
|
||||
|
||||
|
||||
@@ -5688,7 +5688,7 @@ namespace SketcherGui {
|
||||
App::DocumentObject* object;
|
||||
public:
|
||||
FilletSelection(App::DocumentObject* obj)
|
||||
: Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr), object(obj)
|
||||
: Gui::SelectionFilterGate(nullPointer()), object(obj)
|
||||
{}
|
||||
|
||||
bool allow(App::Document * /*pDoc*/, App::DocumentObject *pObj, const char *sSubName)
|
||||
@@ -6101,7 +6101,7 @@ namespace SketcherGui {
|
||||
App::DocumentObject* object;
|
||||
public:
|
||||
TrimmingSelection(App::DocumentObject* obj)
|
||||
: Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr), object(obj)
|
||||
: Gui::SelectionFilterGate(nullPointer()), object(obj)
|
||||
{}
|
||||
|
||||
bool allow(App::Document * /*pDoc*/, App::DocumentObject *pObj, const char *sSubName)
|
||||
@@ -6264,7 +6264,7 @@ namespace SketcherGui {
|
||||
App::DocumentObject* object;
|
||||
public:
|
||||
ExtendSelection(App::DocumentObject* obj)
|
||||
: Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr)
|
||||
: Gui::SelectionFilterGate(nullPointer())
|
||||
, object(obj)
|
||||
, disabled(false)
|
||||
{}
|
||||
@@ -6579,7 +6579,7 @@ namespace SketcherGui {
|
||||
App::DocumentObject* object;
|
||||
public:
|
||||
SplittingSelection(App::DocumentObject* obj)
|
||||
: Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr), object(obj)
|
||||
: Gui::SelectionFilterGate(nullPointer()), object(obj)
|
||||
{}
|
||||
|
||||
bool allow(App::Document * /*pDoc*/, App::DocumentObject *pObj, const char *sSubName)
|
||||
@@ -6697,7 +6697,7 @@ namespace SketcherGui {
|
||||
App::DocumentObject* object;
|
||||
public:
|
||||
ExternalSelection(App::DocumentObject* obj)
|
||||
: Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr), object(obj)
|
||||
: Gui::SelectionFilterGate(nullPointer()), object(obj)
|
||||
{}
|
||||
|
||||
bool allow(App::Document *pDoc, App::DocumentObject *pObj, const char *sSubName)
|
||||
@@ -6884,7 +6884,7 @@ namespace SketcherGui {
|
||||
App::DocumentObject* object;
|
||||
public:
|
||||
CarbonCopySelection(App::DocumentObject* obj)
|
||||
: Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr), object(obj)
|
||||
: Gui::SelectionFilterGate(nullPointer()), object(obj)
|
||||
{}
|
||||
|
||||
bool allow(App::Document *pDoc, App::DocumentObject *pObj, const char *sSubName)
|
||||
|
||||
@@ -184,7 +184,7 @@ class FillingPanel::ShapeSelection : public Gui::SelectionFilterGate
|
||||
{
|
||||
public:
|
||||
ShapeSelection(FillingPanel::SelectionMode& mode, Surface::Filling* editedObject)
|
||||
: Gui::SelectionFilterGate(static_cast<Gui::SelectionFilter*>(nullptr))
|
||||
: Gui::SelectionFilterGate(nullPointer())
|
||||
, mode(mode)
|
||||
, editedObject(editedObject)
|
||||
{
|
||||
|
||||
@@ -56,7 +56,7 @@ class FillingEdgePanel::ShapeSelection : public Gui::SelectionFilterGate
|
||||
{
|
||||
public:
|
||||
ShapeSelection(FillingEdgePanel::SelectionMode& mode, Surface::Filling* editedObject)
|
||||
: Gui::SelectionFilterGate(static_cast<Gui::SelectionFilter*>(nullptr))
|
||||
: Gui::SelectionFilterGate(nullPointer())
|
||||
, mode(mode)
|
||||
, editedObject(editedObject)
|
||||
{
|
||||
|
||||
@@ -55,7 +55,7 @@ class FillingVertexPanel::VertexSelection : public Gui::SelectionFilterGate
|
||||
{
|
||||
public:
|
||||
VertexSelection(FillingVertexPanel::SelectionMode& mode, Surface::Filling* editedObject)
|
||||
: Gui::SelectionFilterGate(static_cast<Gui::SelectionFilter*>(nullptr))
|
||||
: Gui::SelectionFilterGate(nullPointer())
|
||||
, mode(mode)
|
||||
, editedObject(editedObject)
|
||||
{
|
||||
|
||||
@@ -140,7 +140,7 @@ class GeomFillSurface::EdgeSelection : public Gui::SelectionFilterGate
|
||||
{
|
||||
public:
|
||||
EdgeSelection(bool appendEdges, Surface::GeomFillSurface* editedObject)
|
||||
: Gui::SelectionFilterGate(static_cast<Gui::SelectionFilter*>(nullptr))
|
||||
: Gui::SelectionFilterGate(nullPointer())
|
||||
, appendEdges(appendEdges)
|
||||
, editedObject(editedObject)
|
||||
{
|
||||
|
||||
@@ -188,7 +188,7 @@ class SectionsPanel::ShapeSelection : public Gui::SelectionFilterGate
|
||||
{
|
||||
public:
|
||||
ShapeSelection(SectionsPanel::SelectionMode& mode, Surface::Sections* editedObject)
|
||||
: Gui::SelectionFilterGate(static_cast<Gui::SelectionFilter*>(nullptr))
|
||||
: Gui::SelectionFilterGate(nullPointer())
|
||||
, mode(mode)
|
||||
, editedObject(editedObject)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user