| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #ifndef PARTDESIGNGUI_FeaturePickDialog_H |
| | #define PARTDESIGNGUI_FeaturePickDialog_H |
| |
|
| | #include <functional> |
| | #include <QListWidgetItem> |
| |
|
| | #include <App/DocumentObject.h> |
| | #include <Gui/DocumentObserver.h> |
| | #include <Gui/TaskView/TaskDialog.h> |
| | #include <Gui/TaskView/TaskView.h> |
| | #include <Gui/ViewProviderCoordinateSystem.h> |
| |
|
| |
|
| | namespace PartDesignGui |
| | { |
| |
|
| | class SoSwitch; |
| | class Ui_TaskFeaturePick; |
| | class TaskFeaturePick: public Gui::TaskView::TaskBox, |
| | public Gui::SelectionObserver, |
| | public Gui::DocumentObserver |
| | { |
| | Q_OBJECT |
| |
|
| | public: |
| | enum featureStatus |
| | { |
| | validFeature = 0, |
| | invalidShape, |
| | noWire, |
| | isUsed, |
| | otherBody, |
| | otherPart, |
| | notInBody, |
| | basePlane, |
| | afterTip |
| | }; |
| |
|
| | TaskFeaturePick( |
| | std::vector<App::DocumentObject*>& objects, |
| | const std::vector<featureStatus>& status, |
| | bool singleFeatureSelect, |
| | QWidget* parent = nullptr |
| | ); |
| |
|
| | ~TaskFeaturePick() override; |
| |
|
| | std::vector<App::DocumentObject*> getFeatures(); |
| | std::vector<App::DocumentObject*> buildFeatures(); |
| | void showExternal(bool val); |
| | bool isSingleSelectionEnabled() const; |
| |
|
| | static App::DocumentObject* makeCopy(App::DocumentObject* obj, std::string sub, bool independent); |
| |
|
| | protected Q_SLOTS: |
| | void onUpdate(bool); |
| | void onSelectionChanged(const Gui::SelectionChanges& msg) override; |
| | void onItemSelectionChanged(); |
| | void onDoubleClick(QListWidgetItem* item); |
| |
|
| | protected: |
| | |
| | void slotDeletedObject(const Gui::ViewProviderDocumentObject& Obj) override; |
| | |
| | void slotUndoDocument(const Gui::Document& Doc) override; |
| | |
| | void slotDeleteDocument(const Gui::Document& Doc) override; |
| |
|
| | private: |
| | std::unique_ptr<Ui_TaskFeaturePick> ui; |
| | QWidget* proxy; |
| | std::vector<Gui::ViewProviderCoordinateSystem*> origins; |
| | bool doSelection; |
| | std::string documentName; |
| |
|
| | std::vector<QString> features; |
| | std::vector<featureStatus> statuses; |
| |
|
| | void updateList(); |
| | const QString getFeatureStatusString(const featureStatus st); |
| | }; |
| |
|
| |
|
| | |
| | class TaskDlgFeaturePick: public Gui::TaskView::TaskDialog |
| | { |
| | Q_OBJECT |
| |
|
| | public: |
| | TaskDlgFeaturePick( |
| | std::vector<App::DocumentObject*>& objects, |
| | const std::vector<TaskFeaturePick::featureStatus>& status, |
| | std::function<bool(std::vector<App::DocumentObject*>)> acceptfunc, |
| | std::function<void(std::vector<App::DocumentObject*>)> workfunc, |
| | bool singleFeatureSelect, |
| | std::function<void(void)> abortfunc = 0 |
| | ); |
| | ~TaskDlgFeaturePick() override; |
| |
|
| | public: |
| | |
| | void open() override; |
| | |
| | void clicked(int) override; |
| | |
| | bool accept() override; |
| | |
| | bool reject() override; |
| | |
| | bool isAllowedAlterDocument() const override |
| | { |
| | return false; |
| | } |
| |
|
| | void showExternal(bool val); |
| |
|
| | |
| | QDialogButtonBox::StandardButtons getStandardButtons() const override |
| | { |
| | return QDialogButtonBox::Ok | QDialogButtonBox::Cancel; |
| | } |
| |
|
| |
|
| | protected: |
| | TaskFeaturePick* pick; |
| | bool accepted; |
| | std::function<bool(std::vector<App::DocumentObject*>)> acceptFunction; |
| | std::function<void(std::vector<App::DocumentObject*>)> workFunction; |
| | std::function<void(void)> abortFunction; |
| | }; |
| |
|
| | } |
| |
|
| | #endif |
| |
|