]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #3073: Show inspection panel for features
authorvsv <vsv@opencascade.com>
Thu, 21 Nov 2019 14:36:58 +0000 (17:36 +0300)
committervsv <vsv@opencascade.com>
Thu, 21 Nov 2019 14:36:58 +0000 (17:36 +0300)
16 files changed:
src/ModuleBase/ModuleBase_ChoiceCtrl.cpp
src/ModuleBase/ModuleBase_IModule.h
src/ModuleBase/ModuleBase_ModelWidget.cpp
src/ModuleBase/ModuleBase_ModelWidget.h
src/ModuleBase/ModuleBase_ToolBox.cpp
src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_Module.h
src/PartSet/PartSet_WidgetSketchCreator.h
src/PartSet/PartSet_WidgetSketchLabel.cpp
src/PartSet/PartSet_WidgetSketchLabel.h
src/XGUI/XGUI_InspectionPanel.cpp
src/XGUI/XGUI_InspectionPanel.h
src/XGUI/XGUI_SelectionMgr.cpp
src/XGUI/XGUI_SelectionMgr.h
src/XGUI/XGUI_Workshop.cpp

index 1c887faa49d28a30870458d79fff76f5d171c3bf..3404b55f282490d7571eca20368005f00d16a52f 100644 (file)
@@ -29,6 +29,9 @@
 #include <QRadioButton>
 #include <QToolButton>
 
+const QString AStyle = "QToolButton:checked {border: 1px solid black; background-color:#C0DCF3}";
+
+
 ModuleBase_ChoiceCtrl::ModuleBase_ChoiceCtrl(QWidget* theParent,
                                              const QStringList& theChoiceList,
                                              const QStringList& theIconsList,
@@ -68,6 +71,7 @@ ModuleBase_ChoiceCtrl::ModuleBase_ChoiceCtrl(QWidget* theParent,
           QPixmap aIcon = ModuleBase_IconFactory::loadPixmap(theIconsList.at(aId));
           aBtn->setIcon(aIcon);
           aBtn->setIconSize(aIcon.size());
+          aBtn->setStyleSheet(AStyle);
 
           aBtnLayout->addWidget(aBtn);
           myButtons->addButton(aBtn, aId++);
index b748d6a148c2721b89fd659551cc38cf50f11c82..7633da41faf5fbc83ab8b42ebdedb7f521d1ed1e 100644 (file)
@@ -169,10 +169,11 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject
 
   /// Have an opportunity to create widgets for the current operation
   /// instead of standard creation in workshop
-  /// \param theOperation a started operation
+  /// \param theFeature a feature of the started operation
+  /// \param theXmlRepr an XML representation of the operation
   /// \param theWidgets a list of created widgets
   /// \return boolean result, false by default
-  virtual bool createWidgets(ModuleBase_Operation* theOperation,
+  virtual bool createWidgets(const FeaturePtr& theFeature, const QString& theXmlRepr,
                              QList<ModuleBase_ModelWidget*>& theWidgets) const { return false; }
 
   //! Returns True if there are available Undos and there is not an active operation
index 89546edfd4bacde2ac2f40b91a4258dbcef1a299..f26b8a600f8d0a4b1008b03195dcf448a9271cc1 100644 (file)
@@ -423,6 +423,12 @@ bool ModuleBase_ModelWidget::blockValueState(const bool theBlocked)
 //**************************************************************
 bool ModuleBase_ModelWidget::restoreValue()
 {
+  if (!isEnabled()) {
+    // This code works in inspection panel
+    ModelAPI_ValidatorsFactory* aValidators = ModelAPI_Session::get()->validators();
+    if (!aValidators->isCase(myFeature, attributeID()))
+      return false; // if it is not an active case for the widget
+  }
   emit beforeValuesRestored();
   bool isDone = restoreValueCustom();
   emit afterValuesRestored();
index fdd467481bf79cf5439a99b6b28834b411f507f2..3d667f6f19c19f72f2a9c0e9224d94b906908434 100644 (file)
@@ -303,6 +303,13 @@ Q_OBJECT
   /// By default this slot does nothing
   virtual void onFeatureAccepted() {}
 
+  /// Returns True in case if the widget contains useful information for inspection tool
+  virtual bool isInformative() const { return true; }
+
+  /// If widgets has several panels then this method has to show a page which contains information
+  /// for current feature. By default does nothing
+  virtual void showInformativePage() {}
+
 signals:
   /// The signal about widget values are to be changed
   void beforeValuesChanged();
index 8618e3b3488e2487506a0938af04b54bc3338fd8..ab6296671ade2a08b59f768d71b71c3bf510a9e1 100644 (file)
@@ -28,6 +28,9 @@
 
 #include <ModuleBase_PagedContainer.h>
 
+const QString AStyle = "QToolButton:checked {border: 1px solid black; background-color:#C0DCF3}";
+
+
 ModuleBase_ToolBox::ModuleBase_ToolBox(QWidget* theParent, const bool theUseFrameStyleBox)
 : QFrame(theParent)
 {
@@ -71,6 +74,7 @@ void ModuleBase_ToolBox::addItem(QWidget* thePage, const QString& theName, const
   QToolButton* aButton = new QToolButton(myButtonsFrame);
   aButton->setFocusPolicy(Qt::StrongFocus);
   aButton->setCheckable(true);
+  aButton->setStyleSheet(AStyle);
   if (theIcon.isNull())
     aButton->setText(theName);
   else {
index 4b0e41daa5be7e11d1c94dbcd10b85f36eee2b1b..54cc1d3ce5397a74eed863845a6cf02472a029ff 100644 (file)
@@ -195,18 +195,6 @@ bool ModuleBase_WidgetDoubleValue::restoreValueCustom()
   std::string aTextRepr = aRef->text();
   if (!aTextRepr.empty()) {
     QString aText = QString::fromStdString(aTextRepr);
-    //if (aText.endsWith('=')) {
-    //  if (!myParameter.get()) {
-    //    QString aName = aText.left(aText.indexOf('=')).trimmed();
-    //    myParameter = ModuleBase_Tools::findParameter(aName);
-    //  }
-    //  /// If myParameter is empty then it was not created because of an error
-    //  if (!myParameter.get())
-    //    return false;
-
-    //  AttributeStringPtr aExprAttr = myParameter->string("expression");
-    //  aText += aExprAttr->value().c_str();
-    //}
     ModuleBase_Tools::setSpinText(mySpinBox, aText);
   }
   else {
index 59d1b14da33a71c853920cd4af152917a56d2fac..cc7c8b7f8e478618d6eaf539ba675bae91f5cffd 100644 (file)
@@ -753,16 +753,14 @@ void PartSet_Module::propertyPanelDefined(ModuleBase_Operation* theOperation)
 }
 
 //******************************************************
-bool PartSet_Module::createWidgets(ModuleBase_Operation* theOperation,
+bool PartSet_Module::createWidgets(const FeaturePtr& theFeature, const QString& theXmlRepr,
                                    QList<ModuleBase_ModelWidget*>& theWidgets) const
 {
   bool aProcessed = false;
 
-  ModuleBase_OperationFeature* aFOperation =
-    dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
   XGUI_Workshop* aWorkshop = getWorkshop();
   XGUI_PropertyPanel* aPropertyPanel = aWorkshop->propertyPanel();
-  if (mySketchMgr->activeSketch().get() && aFOperation && aPropertyPanel) {
+  if (mySketchMgr->activeSketch().get() && aPropertyPanel) {
     ModuleBase_ISelection* aSelection = workshop()->selection();
     // click on a point in sketch leads here with the point is highlighted, not yet selected
     QList<ModuleBase_ViewerPrsPtr> aPreselection = aSelection->getHighlighted();
@@ -771,11 +769,10 @@ bool PartSet_Module::createWidgets(ModuleBase_Operation* theOperation,
       ObjectPtr anObject = aSelectedPrs->object();
 
       FeaturePtr aFeature = ModelAPI_Feature::feature(anObject);
-      FeaturePtr anOpFeature = aFOperation->feature();
       GeomShapePtr aShape = aSelectedPrs->shape();
       // click on the digit of dimension constrain comes here
       // with an empty shape, so we need the check
-      if (aFeature == anOpFeature && aShape.get() && !aShape->isNull()) {
+      if (aFeature == theFeature && aShape.get() && !aShape->isNull()) {
         // if feature has only one result and shape of result is equal to selected shape
         // this attribute is not processed. It is a case of Sketch Point.
         if (aFeature->results().size() == 1) {
@@ -787,8 +784,7 @@ bool PartSet_Module::createWidgets(ModuleBase_Operation* theOperation,
         AttributePtr anAttribute = PartSet_Tools::findAttributeBy2dPoint(anObject, aTDShape,
                                                                mySketchMgr->activeSketch());
         if (anAttribute.get()) {
-          QString aXmlRepr = aFOperation->getDescription()->xmlRepresentation();
-          ModuleBase_WidgetFactory aFactory(aXmlRepr.toStdString(), workshop());
+          ModuleBase_WidgetFactory aFactory(theXmlRepr.toStdString(), workshop());
 
           const std::string anAttributeId = anAttribute->id();
           aFactory.createWidget(aPropertyPanel->contentWidget(), anAttributeId);
index bcd16ee1771476c5a5cfd3854f611d087bcfb479..e0b6961fa1f9fbe1ed5b6c5b152038c65b234f10 100644 (file)
@@ -105,10 +105,11 @@ public:
   /// If there is found selected attribute, widgets are created and contains
   /// only a widget for the attribute
   /// It is important for Property Panel filling by sketch point attribute
-  /// \param theOperation a started operation
+  /// \param theFeature a feature of the started operation
+  /// \param theXmlRepr an XML representation of the operation
   /// \param theWidgets a list of created widgets
   /// \return boolean result, false by default
-  virtual bool createWidgets(ModuleBase_Operation* theOperation,
+  virtual bool createWidgets(const FeaturePtr& theFeature, const QString& theXmlRepr,
                              QList<ModuleBase_ModelWidget*>& theWidgets) const;
 
   /// Launching of a edit operation on the feature
index f4a880abf6a73a06673de76f797af8302c487f47..0e32b02850471f4c180c7ce07a36e824f3e526ce 100644 (file)
@@ -83,6 +83,9 @@ public:
   /// \return a boolean value
   virtual bool isValidSelection(const std::shared_ptr<ModuleBase_ViewerPrs>& theValue);
 
+  /// Returns True in case if the widget contains useful information for inspection tool
+  virtual bool isInformative() const { return false; }
+
 protected:
   /// If there is no operation in current session, start operation for modify parameters
   /// \return true if the operation was not opened
index f4514b92725c02d11920b9dd2e5053a04dc4621f..b05bbfd7520512c55ffeaf78a045601f93538d55 100644 (file)
@@ -75,7 +75,6 @@
 #include <QCheckBox>
 #include <QGroupBox>
 #include <QPushButton>
-#include <QStackedWidget>
 #include <QLineEdit>
 #include <QDoubleValidator>
 #include <QDialog>
index fbc3395025b9a084472fc26643397e4c907d7dd9..9144f9ef4216cd6a57498df95cf57e6d95898209 100644 (file)
@@ -31,6 +31,7 @@
 
 #include <TopoDS_Shape.hxx>
 
+#include <QStackedWidget>
 #include <QMap>
 
 class PartSet_PreviewPlanes;
@@ -110,6 +111,12 @@ public:
   /// \param thePrs a presentation
   static bool canFillSketch(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
 
+  /// If widgets has several panels then this method has to show a page which contains information
+  /// for current feature. By default does nothing
+  virtual void showInformativePage() {
+    if (myStackWidget) myStackWidget->setCurrentIndex(1);
+  }
+
 signals:
   /// Signal on plane selection
   void planeSelected(const std::shared_ptr<GeomAPI_Pln>& thePln);
index 6d615ac06dbe53dce38181ce38f964017dc631b9..038f5f172136a2af8b199280c6d27b7c34a7e56d 100644 (file)
 //
 
 #include "XGUI_InspectionPanel.h"
+#include "XGUI_Workshop.h"
 #include "XGUI_SelectionMgr.h"
 #include "XGUI_Selection.h"
 #include "XGUI_Tools.h"
+#include "XGUI_ModuleConnector.h"
 
 #include <ModuleBase_ViewerPrs.h>
 #include <ModuleBase_Tools.h>
+#include <ModuleBase_OperationDescription.h>
+#include <ModuleBase_WidgetFactory.h>
+#include <ModuleBase_IModule.h>
+#include <ModuleBase_PageWidget.h>
+
 #include <ModelAPI_ResultField.h>
 
 #include <ModelAPI_Result.h>
@@ -54,6 +61,7 @@
 #include <QTextBrowser>
 #include <QResizeEvent>
 #include <QSplitter>
+#include <QStackedWidget>
 
 #include <BRepBndLib.hxx>
 #include <TopoDS_Iterator.hxx>
@@ -61,6 +69,7 @@
 #include <TopTools_ListOfShape.hxx>
 #include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic
 
+
 // ================     Auxiliary functions     ================
 #define TITLE(val) ("<b>" + (val) + "</b>")
 
@@ -108,15 +117,18 @@ static void appendNamedValueToParameters(const QString& theName,
 
 // ================     XGUI_InspectionPanel    ================
 
-XGUI_InspectionPanel::XGUI_InspectionPanel(QWidget* theParent, XGUI_SelectionMgr* theMgr)
+XGUI_InspectionPanel::XGUI_InspectionPanel(QWidget* theParent, XGUI_Workshop* theWorkshop)
   : QDockWidget(theParent),
-  mySelectionMgr(theMgr)
+  myWorkshop(theWorkshop)
 {
   setWindowTitle(tr("Inspection Panel"));
   setObjectName(INSPECTION_PANEL);
   setStyleSheet("::title { position: relative; padding-left: 5px; text-align: left center }");
 
-  QSplitter* aSplitter = new QSplitter(Qt::Vertical, this);
+  myStackWgt = new QStackedWidget(this);
+
+  // Create shape selection page
+  QSplitter* aSplitter = new QSplitter(Qt::Vertical, myStackWgt);
 
   // Create an internal widget
   QWidget* aNameWgt = new QWidget(aSplitter);
@@ -184,9 +196,23 @@ XGUI_InspectionPanel::XGUI_InspectionPanel(QWidget* theParent, XGUI_SelectionMgr
   aSizes << 10 << 140 << 10;
   aSplitter->setSizes(aSizes);
 
-  setWidget(aSplitter);
+  myShapePanelId = myStackWgt->addWidget(aSplitter);
+
+  // Create feature selection page
+  QScrollArea* aScroll = new QScrollArea(myStackWgt);
+  aScroll->setWidgetResizable(true);
+  aScroll->setFrameStyle(QFrame::NoFrame);
+
+  myFeaturePane = new ModuleBase_PageWidget(aScroll);
+  myFeatureLayout = new QGridLayout(myFeaturePane);
+  myFeatureLayout->setContentsMargins(3, 3, 3, 3);
+  aScroll->setWidget(myFeaturePane);
+  //myFeaturePane->setEnabled(false);
 
-  connect(mySelectionMgr, SIGNAL(selectionChanged()), SLOT(onSelectionChanged()));
+  myFeaturePanelId = myStackWgt->addWidget(aScroll);
+
+  setWidget(myStackWgt);
+  connect(myWorkshop->selector(), SIGNAL(selectionChanged()), SLOT(onSelectionChanged()));
 }
 
 //********************************************************************
@@ -209,20 +235,21 @@ void XGUI_InspectionPanel::clearContent()
   }
   myTypeLbl->setText("");
   setParamsText("");
+
+  myFeaturePane->clearPage();
 }
 
 //********************************************************************
 void XGUI_InspectionPanel::onSelectionChanged()
 {
+  if (!isVisible())
+    return;
+
   clearContent();
-  XGUI_Selection* aSelection = mySelectionMgr->selection();
-  QList<ModuleBase_ViewerPrsPtr> aSelectedList =
-    aSelection->getSelected(ModuleBase_ISelection::Viewer);
 
-  QList<ModuleBase_ViewerPrsPtr> anOBSelected =
-    aSelection->getSelected(ModuleBase_ISelection::Browser);
-  if (!anOBSelected.isEmpty())
-    ModuleBase_ISelection::appendSelected(anOBSelected, aSelectedList);
+  XGUI_Selection* aSelection = myWorkshop->selector()->selection();
+  QList<ModuleBase_ViewerPrsPtr> aSelectedList =
+    aSelection->getSelected(myWorkshop->selector()->placeOfSelection());
 
   if (aSelectedList.count() > 0) {
     ModuleBase_ViewerPrsPtr aPrs = aSelectedList.first();
@@ -230,25 +257,33 @@ void XGUI_InspectionPanel::onSelectionChanged()
       std::dynamic_pointer_cast<ModelAPI_ResultField::ModelAPI_FieldStep>(aPrs->object());
     if (aStep)
       return;
-    TopoDS_Shape aShape = ModuleBase_Tools::getSelectedShape(aPrs);
-    if (aShape.IsNull()) {
-      ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(aPrs->object());
-      if (aRes.get()) {
-        GeomShapePtr aShpPtr = aRes->shape();
-        if (aShpPtr.get()) {
-          aShape = aShpPtr->impl<TopoDS_Shape>();
+    FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aPrs->object());
+    if (aFeature.get()) {
+      myStackWgt->setCurrentIndex(myFeaturePanelId);
+      buildFeaturePane(aFeature);
+    }
+    else {
+      myStackWgt->setCurrentIndex(myShapePanelId);
+      TopoDS_Shape aShape = ModuleBase_Tools::getSelectedShape(aPrs);
+      if (aShape.IsNull()) {
+        ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(aPrs->object());
+        if (aRes.get()) {
+          GeomShapePtr aShpPtr = aRes->shape();
+          if (aShpPtr.get()) {
+            aShape = aShpPtr->impl<TopoDS_Shape>();
+          }
         }
       }
+      if (aShape.IsNull())
+        return;
+      GeomShapePtr aShapePtr(new GeomAPI_Shape());
+      aShapePtr->setImpl(new TopoDS_Shape(aShape));
+
+      ModuleBase_ViewerPrsPtr aPrsCopy(new ModuleBase_ViewerPrs(aPrs->object(), aShapePtr));
+      setName(XGUI_Tools::generateName(aPrsCopy));
+      setShapeContent(aShape);
+      setShapeParams(aShape);
     }
-    if (aShape.IsNull())
-      return;
-    GeomShapePtr aShapePtr(new GeomAPI_Shape());
-    aShapePtr->setImpl(new TopoDS_Shape(aShape));
-
-    ModuleBase_ViewerPrsPtr aPrsCopy(new ModuleBase_ViewerPrs(aPrs->object(), aShapePtr));
-    setName(XGUI_Tools::generateName(aPrsCopy));
-    setShapeContent(aShape);
-    setShapeParams(aShape);
   }
 }
 
@@ -606,6 +641,7 @@ void XGUI_InspectionPanel::fillContainer(const GeomShapePtr& theShape)
   appendPointToParameters(tr("Maximal corner"), aMaxPoint, aParams);
 }
 
+//********************************************************************
 void XGUI_InspectionPanel::setPlaneType(const QString& theTitle,
                                         const std::shared_ptr<GeomAPI_Pln>& thePlane)
 {
@@ -616,6 +652,7 @@ void XGUI_InspectionPanel::setPlaneType(const QString& theTitle,
   setParamsText(aParams);
 }
 
+//********************************************************************
 void XGUI_InspectionPanel::setSphereType(const QString& theTitle,
                                          const std::shared_ptr<GeomAPI_Sphere>& theSphere)
 {
@@ -627,6 +664,7 @@ void XGUI_InspectionPanel::setSphereType(const QString& theTitle,
   setParamsText(aParams);
 }
 
+//********************************************************************
 void XGUI_InspectionPanel::setCylinderType(const QString& theTitle,
                                            const std::shared_ptr<GeomAPI_Cylinder>& theCyl)
 {
@@ -640,6 +678,7 @@ void XGUI_InspectionPanel::setCylinderType(const QString& theTitle,
   setParamsText(aParams);
 }
 
+//********************************************************************
 void XGUI_InspectionPanel::setConeType(const QString& theTitle,
                                        const std::shared_ptr<GeomAPI_Cone>& theCone)
 {
@@ -654,6 +693,7 @@ void XGUI_InspectionPanel::setConeType(const QString& theTitle,
   setParamsText(aParams);
 }
 
+//********************************************************************
 void XGUI_InspectionPanel::setTorusType(const QString& theTitle,
                                         const std::shared_ptr<GeomAPI_Torus>& theTorus)
 {
@@ -667,6 +707,7 @@ void XGUI_InspectionPanel::setTorusType(const QString& theTitle,
   setParamsText(aParams);
 }
 
+//********************************************************************
 void XGUI_InspectionPanel::setBoxType(const QString& theTitle,
                                       const std::shared_ptr<GeomAPI_Box>& theBox)
 {
@@ -680,6 +721,7 @@ void XGUI_InspectionPanel::setBoxType(const QString& theTitle,
   setParamsText(aParams);
 }
 
+//********************************************************************
 void XGUI_InspectionPanel::setRotatedBoxType(const QString& theTitle,
                                              const std::shared_ptr<GeomAPI_Box>& theBox)
 {
@@ -697,7 +739,43 @@ void XGUI_InspectionPanel::setRotatedBoxType(const QString& theTitle,
 }
 
 
+//********************************************************************
 void XGUI_InspectionPanel::setParamsText(const QString& theText)
 {
   myTypeParams->setText(theText);
 }
+
+//********************************************************************
+void XGUI_InspectionPanel::buildFeaturePane(const FeaturePtr& theFeature)
+{
+  std::string aXmlCfg, aDescription;
+  myWorkshop->module()->getXMLRepresentation(theFeature->getKind(), aXmlCfg, aDescription);
+  if (!aXmlCfg.empty()) {
+    QList<ModuleBase_ModelWidget*> aWidgets;
+    if (!myWorkshop->module()->createWidgets(theFeature, aXmlCfg.c_str(), aWidgets)) {
+      ModuleBase_WidgetFactory aFactory(aXmlCfg, myWorkshop->moduleConnector());
+      aFactory.createWidget(myFeaturePane);
+      aWidgets = aFactory.getModelWidgets();
+    }
+    foreach(ModuleBase_ModelWidget* aWgt, aWidgets) {
+      if (aWgt->isInformative()) {
+        aWgt->setEnabled(false);
+        aWgt->setFeature(theFeature, false, false);
+        aWgt->setEditingMode(true);
+        aWgt->restoreValue();
+        aWgt->showInformativePage();
+      }
+      else {
+        aWgt->setFeature(theFeature, false, false);
+        aWgt->setEditingMode(true);
+        aWgt->hide();
+      }
+    }
+  }
+}
+
+void XGUI_InspectionPanel::showEvent(QShowEvent* theEvent)
+{
+  QDockWidget::showEvent(theEvent);
+  onSelectionChanged();
+}
index 3f980ea42071aecdc69ee4e293b909f51ef6fdae..9f60ff56ea7291d00c797ce36d7c137bf4920399 100644 (file)
 
 #include "XGUI.h"
 
+#include <ModelAPI_Feature.h>
+
 #include <QDockWidget>
 
 #include <memory>
 
-class XGUI_SelectionMgr;
+class XGUI_Workshop;
 class QLineEdit;
 class QTableWidget;
 class QLabel;
 class QTextBrowser;
 class QVBoxLayout;
 class QResizeEvent;
+class QStackedWidget;
+class QGridLayout;
 
 class TopoDS_Shape;
 
@@ -50,6 +54,7 @@ class GeomAPI_Cylinder;
 class GeomAPI_Cone;
 class GeomAPI_Torus;
 class GeomAPI_Box;
+class ModuleBase_PageWidget;
 
 /// Internal name of property panel widget
 const static char* INSPECTION_PANEL = "inspection_panel_dock";
@@ -78,11 +83,13 @@ public:
   /// Constructor
   /// \param theParent is a parent of the property panel
   /// \param theMgr operation manager
-  XGUI_InspectionPanel(QWidget* theParent, XGUI_SelectionMgr* theMgr);
+  XGUI_InspectionPanel(QWidget* theParent, XGUI_Workshop* theWorkshop);
 
   // Destructor
   virtual ~XGUI_InspectionPanel();
 
+protected:
+  virtual void showEvent(QShowEvent* theEvent);
 
 private slots:
   /// A slot to react on selection changed
@@ -172,20 +179,27 @@ private:
   /// \param theBox the box
   void setRotatedBoxType(const QString& theTitle, const std::shared_ptr<GeomAPI_Box>& theBox);
 
-
   /// Set text into parameters area
   /// \param theText the text
   void setParamsText(const QString& theText);
 
+  /// Fills Feature panel with controls specific to the given feature
+  /// \param theFeature the selected feature
+  void buildFeaturePane(const FeaturePtr& theFeature);
+
 private:
-  XGUI_SelectionMgr* mySelectionMgr; //> selection manager
-
-  QLineEdit* myNameEdt; //> Name field
-  QTableWidget* mySubShapesTab; //> table of sub-shapes
-  QLabel* myTypeLbl; //> label of a type
-  QTextBrowser* myTypeParams; //> parameters area
-  QVBoxLayout* myMainLayout; //> main layout
-  //QWidget* myMainWidget;  //> main widget
+  XGUI_Workshop* myWorkshop; //> selection manager
+
+  QLineEdit* myNameEdt; ///> Name field
+  QTableWidget* mySubShapesTab; ///> table of sub-shapes
+  QLabel* myTypeLbl; ///> label of a type
+  QTextBrowser* myTypeParams; ///> parameters area
+  QVBoxLayout* myMainLayout; ///> main layout
+  ModuleBase_PageWidget* myFeaturePane; ///> Content of feature property panel
+  QGridLayout* myFeatureLayout; ///> Layout of feature panel
+  QStackedWidget* myStackWgt; ///> base widget of the panel
+  int myShapePanelId;
+  int myFeaturePanelId;
 };
 
 #endif
\ No newline at end of file
index 17d4f6d59b5f59f3289c0e3fd004a29de77fa5ae..b7c1a65bca80bb5cf842574e5010e8fdd1ba2125 100644 (file)
@@ -106,6 +106,7 @@ void XGUI_SelectionMgr::setSelectedOwners(const SelectMgr_IndexedMapOfOwner& the
 //**************************************************************
 void XGUI_SelectionMgr::onObjectBrowserSelection()
 {
+  myLastSelectionPlace = ModuleBase_ISelection::Browser;
   QList<ModuleBase_ViewerPrsPtr> aSelectedPrs =
     myWorkshop->selector()->selection()->getSelected(ModuleBase_ISelection::Browser);
   XGUI_Displayer* aDisplayer = myWorkshop->displayer();
@@ -138,6 +139,7 @@ void XGUI_SelectionMgr::onObjectBrowserSelection()
 //**************************************************************
 void XGUI_SelectionMgr::onViewerSelection()
 {
+  myLastSelectionPlace = ModuleBase_ISelection::Viewer;
   QList<ModuleBase_ViewerPrsPtr> aValues;
   Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
   if (!aContext.IsNull())
index 1a4e519b3a2ad1a5e2a6323c724ba169b993a34b..6b7adae6b5361f65459c60fa0193211346d51628 100644 (file)
@@ -57,6 +57,10 @@ Q_OBJECT
     return mySelection;
   }
 
+  ModuleBase_ISelection::SelectionPlace placeOfSelection() const {
+    return myLastSelectionPlace;
+  }
+
   //! Connects the manager to all viewers accessible by Workshop
   void connectViewers();
 
@@ -111,6 +115,8 @@ private:
 
   /// Current selection object
   XGUI_Selection* mySelection;
+
+  ModuleBase_ISelection::SelectionPlace myLastSelectionPlace;
 };
 
 #endif
index 3dce3196598833ccdccce880dee436ea88262127..9b7166a14df26695104eb4fedfe912addc6da3fd 100644 (file)
@@ -710,8 +710,8 @@ void XGUI_Workshop::fillPropertyPanel(ModuleBase_Operation* theOperation)
   myPropertyPanel->cleanContent();
 
   QList<ModuleBase_ModelWidget*> aWidgets;
-  if (!module()->createWidgets(theOperation, aWidgets)) {
-    QString aXmlRepr = aFOperation->getDescription()->xmlRepresentation();
+  QString aXmlRepr = aFOperation->getDescription()->xmlRepresentation();
+  if (!module()->createWidgets(aFOperation->feature(), aXmlRepr, aWidgets)) {
     ModuleBase_WidgetFactory aFactory(aXmlRepr.toStdString(), myModuleConnector);
     aFactory.createWidget(myPropertyPanel->contentWidget());
     aWidgets = aFactory.getModelWidgets();
@@ -1531,7 +1531,7 @@ void XGUI_Workshop::createDockWidgets()
                                 Qt::BottomDockWidgetArea);
   connect(myFacesPanel, SIGNAL(closed()), myFacesPanel, SLOT(onClosed()));
 
-  myInspectionPanel = new XGUI_InspectionPanel(aDesktop, mySelector);
+  myInspectionPanel = new XGUI_InspectionPanel(aDesktop, this);
   myInspectionPanel->setAllowedAreas(Qt::LeftDockWidgetArea |
     Qt::RightDockWidgetArea);
   aDesktop->addDockWidget(Qt::RightDockWidgetArea, myInspectionPanel);