/// Returns header widget
virtual QWidget* headerWidget() const = 0;
- /// Returns currently active widget
- virtual ModuleBase_ModelWidget* activeWidget() const = 0;
+ /// Returns currently active widget. This is a widget from internal container of widgets
+ /// (myWidgets) activated/deactivated by focus in property panel. If parameter is true,
+ /// the method finds firstly the custom widget, after the direct active widget.
+ /// \param isUseCustomWidget boolean state if the custom widget might be a result
+ virtual ModuleBase_ModelWidget* activeWidget(const bool isUseCustomWidget = false) const = 0;
/// Returns all property panel's widget created by WidgetFactory
virtual const QList<ModuleBase_ModelWidget*>& modelWidgets() const = 0;
{
ModuleBase_ModelWidget* anActiveWidget = 0;
- anActiveWidget = mySketchReentrantMgr->internalActiveWidget();
- if (!anActiveWidget) {
- ModuleBase_Operation* aOperation = myWorkshop->currentOperation();
- if (aOperation) {
- ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel();
- anActiveWidget = aPanel ? aPanel->activeWidget() : 0;
- }
- }
- return anActiveWidget;
+ ModuleBase_Operation* aOperation = myWorkshop->currentOperation();
+ if (!aOperation)
+ return anActiveWidget;
+
+ ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel();
+ if (!aPanel)
+ return anActiveWidget;
+
+ return aPanel->activeWidget(true);
}
//******************************************************
#include <ModuleBase_OperationDescription.h>
#include "ModuleBase_ToolBox.h"
#include "ModuleBase_ISelection.h"
-#include "ModuleBase_ISelectionActivate.h"
#include <SketchPlugin_Feature.h>
#include <SketchPlugin_Line.h>
myRestartingMode(RM_None),
myIsFlagsBlocked(false),
myIsInternalEditOperation(false),
- myInternalActiveWidget(0),
myNoMoreWidgetsAttribute("")
{
}
{
}
-ModuleBase_ModelWidget* PartSet_SketcherReentrantMgr::internalActiveWidget() const
-{
- ModuleBase_ModelWidget* aWidget = 0;
- if (!isActiveMgr())
- return aWidget;
-
- ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
- if (anOperation) {
- ModuleBase_IPropertyPanel* aPanel = anOperation->propertyPanel();
- if (aPanel) { // check for case when the operation is started but property panel is not filled
- ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget();
- if (myIsInternalEditOperation && (!anActiveWidget || !anActiveWidget->isViewerSelector()))
- aWidget = myInternalActiveWidget;
- }
- }
- return aWidget;
-}
-
bool PartSet_SketcherReentrantMgr::isInternalEditActive() const
{
return myIsInternalEditOperation;
ModuleBase_ModelWidget* aFirstWidget = ModuleBase_IPropertyPanel::findFirstAcceptingValueWidget
(aWidgets);
if (aFirstWidget)
- myInternalActiveWidget = aFirstWidget;
+ setInternalActiveWidget(aFirstWidget);
}
}
std::cout << "PartSet_SketcherReentrantMgr::deleteInternalFeature: "
<< myInternalFeature->data()->name() << std::endl;
#endif
- if (myInternalActiveWidget)
- myInternalActiveWidget = 0;
+ setInternalActiveWidget(0);
delete myInternalWidget;
myInternalWidget = 0;
{
return dynamic_cast<PartSet_Module*>(myWorkshop->module());
}
+
+void PartSet_SketcherReentrantMgr::setInternalActiveWidget(ModuleBase_ModelWidget* theWidget)
+{
+ ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
+ (myWorkshop->currentOperation());
+ if (aFOperation)
+ {
+ XGUI_PropertyPanel* aPropertyPanel = dynamic_cast<XGUI_PropertyPanel*>
+ (aFOperation->propertyPanel());
+ if (aPropertyPanel)
+ aPropertyPanel->setInternalActiveWidget(theWidget);
+ }
+}
virtual ~PartSet_SketcherReentrantMgr();
public:
- /// Returns a first widget of the current opeation if the internal edit operation is active
- /// or return null. If the current widget of the operation is a viewer selector, it returns null.
- ModuleBase_ModelWidget* internalActiveWidget() const;
-
/// Return true if the current edit operation is an internal
bool isInternalEditActive() const;
/// Returns the workshop module
PartSet_Module* module() const;
+ void setInternalActiveWidget(ModuleBase_ModelWidget* theWidget);
+
private:
ModuleBase_IWorkshop* myWorkshop; /// the workshop
FeaturePtr myPreviousFeature; /// feature of the previous operation, which is restarted
FeaturePtr myInternalFeature;
QWidget* myInternalWidget;
- ModuleBase_ModelWidget* myInternalActiveWidget;
std::string myNoMoreWidgetsAttribute;
std::shared_ptr<Events_Message> myReentrantMessage; /// message obtained by operation restart
//}
//aBaseShape = aShape;
-#ifdef DEBUG_TRIM_METHODS
+#ifdef DEBUG_SPLIT
if (!aSelectedShape.get())
std::cout << "Set empty selected object" << std::endl;
else
std::string SketchPlugin_Split::processEvent(const std::shared_ptr<Events_Message>& theMessage)
{
-#ifdef DEBUG_TRIM_METHODS
- std::cout << "SketchPlugin_Trim::processEvent:" << data()->name() << std::endl;
+#ifdef DEBUG_SPLIT
+ std::cout << "SketchPlugin_Split::processEvent:" << data()->name() << std::endl;
#endif
std::string aFilledAttributeName;
Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
GeomShapePtr aSelectedShape = getSubShape(SELECTED_OBJECT(), SELECTED_POINT());
- #ifdef DEBUG_TRIM_METHODS
+ if (aSelectedShape.get()) {
+ aFilledAttributeName = SELECTED_OBJECT();
+ }
+ else {
+ // #2480 - sub shape is not initialized when split sketch
+ // If restarted operation use some selection on the shape that is split and
+ // result selectiona can not participate in new split(checked shape above is null),
+ // reset filled values of selection set in this method above
+ aRefSelectedAttr->setValue(ResultPtr());
+ aRefPreviewAttr->setValue(ResultPtr());
+ }
+ #ifdef DEBUG_SPLIT
if (!aSelectedShape.get())
std::cout << "Set empty selected object" << std::endl;
else
std::cout << "Set shape with ShapeType: " << aSelectedShape->shapeTypeStr() << std::endl;
#endif
- aFilledAttributeName = SELECTED_OBJECT();
}
}
}
return anAIS;
}
return AISObjectPtr();*/
-#ifdef DEBUG_TRIM_METHODS
- std::cout << "SketchPlugin_Trim::getAISObject: " << data()->name() << std::endl;
+#ifdef DEBUG_SPLIT
+ std::cout << "SketchPlugin_Split::getAISObject: " << data()->name() << std::endl;
#endif
AISObjectPtr anAIS = thePrevious;
#include <ModuleBase_WidgetFactory.h>
#include <ModuleBase_OperationDescription.h>
#include <ModuleBase_Events.h>
+#include <ModuleBase_IModule.h>
#include <ModuleBase_IWorkshop.h>
#include <Events_Loop.h>
: ModuleBase_IPropertyPanel(theParent),
myActiveWidget(NULL),
myPreselectionWidget(NULL),
+ myInternalActiveWidget(NULL),
myPanelPage(NULL),
myOperationMgr(theMgr)
{
findButton(PROP_PANEL_OK_PLUS)->setVisible(aFeatureInfo->isApplyContinue());
}
+ModuleBase_ModelWidget* XGUI_PropertyPanel::activeWidget(const bool isUseCustomWidget) const
+{
+ if (isUseCustomWidget && myInternalActiveWidget)
+ return myInternalActiveWidget;
+
+ return myActiveWidget;
+}
+
void XGUI_PropertyPanel::activateNextWidget(ModuleBase_ModelWidget* theWidget)
{
// it is possible that the property panel widgets have not been visualized
}
}
+void XGUI_PropertyPanel::setInternalActiveWidget(ModuleBase_ModelWidget* theWidget)
+{
+ if (theWidget)
+ {
+ myInternalActiveWidget = theWidget;
+ emit propertyPanelActivated();
+ }
+ else
+ {
+ if (myInternalActiveWidget)
+ {
+ delete myInternalActiveWidget;
+ myInternalActiveWidget = 0;
+ }
+ emit propertyPanelDeactivated();
+ }
+ myOperationMgr->workshop()->selectionActivate()->updateSelectionModes();
+ myOperationMgr->workshop()->selectionActivate()->updateSelectionFilters();
+}
ModuleBase_ModelWidget* XGUI_PropertyPanel::preselectionWidget() const
{
/// Removes all widgets in the widget area of the property panel
virtual void cleanContent();
- /// Returns currently active widget
- virtual ModuleBase_ModelWidget* activeWidget() const { return myActiveWidget; }
+ /// Returns currently active widget. This is a widget from internal container of widgets
+ /// (myWidgets) activated/deactivated by focus in property panel. If parameter is true,
+ /// the method finds firstly the custom widget, after the direct active widget.
+ /// \param isUseCustomWidget boolean state if the custom widget might be a result
+ virtual ModuleBase_ModelWidget* activeWidget(const bool isUseCustomWidget = false) const;
/// Activate the next widget in the property panel
/// \param theWidget a widget. The next widget should be activated
/// The method is called on accepting of operation
virtual void onAcceptData();
+ /// Set internal active widget, that can be returned as active widget and participate in active
+ /// selection filters/modes in application. It emits signal about property panel activation or
+ /// deactivation and updates selection filters/modes accordingly.
+ /// \param theWidget a widget control to store as internal active widget
+ void setInternalActiveWidget(ModuleBase_ModelWidget* theWidget);
+
public slots:
/// \brief Update all widgets in property panel with values from the given feature
/// \param theFeature a Feature to update values in widgets
ModuleBase_ModelWidget* myActiveWidget;
/// Currently widget processed by preselection
ModuleBase_ModelWidget* myPreselectionWidget;
+ /// Some custom widget set from outside
+ ModuleBase_ModelWidget* myInternalActiveWidget;
XGUI_OperationMgr* myOperationMgr;
};
//#define DEBUG_ACTIVATE_AIS
//#define DEBUG_DEACTIVATE_AIS
+#ifdef TINSPECTOR
+#include <inspector/VInspectorAPI_CallBack.hxx>
+#endif
+
#define CLEAR_OUTDATED_SELECTION_BEFORE_REDISPLAY
//**************************************************************
}
if (!aContext.IsNull()) {
if (myWorkshop->module()) {
- int aMode = (theMode > 8)? theMode : AIS_Shape::SelectionType(theMode);
+ // the code is obsolete, used in additional check before activate, it was removed
+ //int aMode = (theMode > 8)? theMode : AIS_Shape::SelectionType(theMode);
aContext->Activate(theIO, theMode, false);
- } else
+#ifdef TINSPECTOR
+ if (getDisplayer()->getCallBack()) getDisplayer()->getCallBack()->Activate(theIO, theMode);
+#endif
+ }
+ else {
aContext->Activate(theIO, theMode, false);
-
+#ifdef TINSPECTOR
+ if (getDisplayer()->getCallBack()) getDisplayer()->getCallBack()->Activate(theIO, theMode);
+#endif
+ }
// the fix from VPA for more suitable selection of sketcher lines
if (theIO->Width() > 1) {
double aPrecision = theIO->Width() + 2;