return !aShape.IsNull() && aShape.ShapeType() == TopAbs_EDGE;
}
+bool GeomAPI_Shape::isWire() const
+{
+ const TopoDS_Shape& aShape = const_cast<GeomAPI_Shape*>(this)->impl<TopoDS_Shape>();
+ return !aShape.IsNull() && aShape.ShapeType() == TopAbs_WIRE;
+}
+
bool GeomAPI_Shape::isFace() const
{
const TopoDS_Shape& aShape = const_cast<GeomAPI_Shape*>(this)->impl<TopoDS_Shape>();
return isAtLeastOne;
}
+ GeomAPI_Shape::ShapeType GeomAPI_Shape::typeOfCompoundShapes() const
+ {
+ const TopoDS_Shape& aShape = const_cast<GeomAPI_Shape*>(this)->impl<TopoDS_Shape>();
+ if (aShape.IsNull() || aShape.ShapeType() != TopAbs_COMPOUND)
+ return SHAPE;
+ int aType = -1;
+ for(TopoDS_Iterator aSubs(aShape); aSubs.More(); aSubs.Next()) {
+ if (!aSubs.Value().IsNull()) {
+ if (aType == -1)
+ aType = aSubs.Value().ShapeType();
+ else if (aSubs.Value().ShapeType() != aType)
+ return SHAPE;
+ }
+ }
+ return (GeomAPI_Shape::ShapeType) aType;
+ }
+
// adds the nopt-compound elements recursively to the list
static void addSimpleToList(const TopoDS_Shape& theShape, NCollection_List<TopoDS_Shape>& theList)
{
}
}
+void GeomAPI_Shape::reverse()
+{
+ MY_SHAPE->Reverse();
+}
+
bool GeomAPI_Shape::isSubShape(const std::shared_ptr<GeomAPI_Shape> theShape,
const bool theCheckOrientation) const
{
GEOMAPI_EXPORT
virtual bool isEdge() const;
+ /// Returns whether the shape is a wire
+ GEOMAPI_EXPORT
+ virtual bool isWire() const;
+
/// Returns whether the shape is a face
GEOMAPI_EXPORT
virtual bool isFace() const;
/// Sets the shape orientation.
GEOMAPI_EXPORT virtual void setOrientation(const Orientation theOrientation);
+ /// Reverse shape
+ GEOMAPI_EXPORT virtual void reverse();
+
/// \return true if passed shape is a sub-shape of this shape.
/// \param theShape shape to search.
/// \param theCheckOrientation if false, returns true even if orientation of shape differs
GEOMAPI_EXPORT
bool isIntersect(const std::shared_ptr<GeomAPI_Shape> theShape) const;
- // Translates the shape along the direction for the given offset
+ /// Translates the shape along the direction for the given offset
GEOMAPI_EXPORT
void translate(const std::shared_ptr<GeomAPI_Dir> theDir, const double theOffset);
+
+ /// Returns type of shapes in the compound.
+ // If shapes are of different type then it will return SHAPE type
+ GEOMAPI_EXPORT ShapeType typeOfCompoundShapes() const;
};
//! Pointer on list of shapes
ModuleBase.h
ModuleBase_ActionInfo.h
ModuleBase_ActionType.h
+ ModuleBase_BRepOwner.h
ModuleBase_Definitions.h
ModuleBase_DoubleSpinBox.h
ModuleBase_Events.h
ModuleBase_IPrefMgr.h
ModuleBase_IPropertyPanel.h
ModuleBase_ISelection.h
+ ModuleBase_ISelectionActivate.h
ModuleBase_IViewWindow.h
ModuleBase_IViewer.h
ModuleBase_IWidgetCreator.h
ModuleBase_IWorkshop.h
ModuleBase_LabelValue.h
+ ModuleBase_ListView.h
ModuleBase_ModelWidget.h
ModuleBase_Operation.h
ModuleBase_OperationAction.h
ModuleBase_IconFactory.h
ModuleBase_Dialog.h
ModuleBase_ModelDialogWidget.h
+ ModuleBase_ActionParameter.h
+ ModuleBase_ActionIntParameter.h
+ ModuleBase_ChoiceCtrl.h
+ ModuleBase_WidgetNameEdit.h
)
SET(PROJECT_MOC_HEADERS
ModuleBase_IViewer.h
ModuleBase_IWorkshop.h
ModuleBase_LabelValue.h
+ ModuleBase_ListView.h
ModuleBase_ModelDialogWidget.h
ModuleBase_ModelWidget.h
ModuleBase_Operation.h
ModuleBase_WidgetSwitch.h
ModuleBase_WidgetToolbox.h
ModuleBase_WidgetValidated.h
+ ModuleBase_ChoiceCtrl.h
+ ModuleBase_WidgetNameEdit.h
)
SET(PROJECT_SOURCES
ModuleBase_ActionInfo.cpp
+ ModuleBase_BRepOwner.cpp
ModuleBase_DoubleSpinBox.cpp
ModuleBase_Filter.cpp
ModuleBase_FilterValidated.cpp
ModuleBase_IWidgetCreator.cpp
ModuleBase_IWorkshop.cpp
ModuleBase_LabelValue.cpp
+ ModuleBase_ListView.cpp
ModuleBase_ModelWidget.cpp
ModuleBase_Operation.cpp
ModuleBase_OperationAction.cpp
ModuleBase_IconFactory.cpp
ModuleBase_SelectionValidator.cpp
ModuleBase_Dialog.cpp
+ ModuleBase_ChoiceCtrl.cpp
+ ModuleBase_WidgetNameEdit.cpp
)
SET(PROJECT_LIBRARIES
#include <ModuleBase.h>
#include <ModuleBase_ActionType.h>
+#include <ModuleBase_Definitions.h>
#include <ModuleBase_OperationFeature.h>
+#include <ModuleBase_ActionInfo.h>
+#include <ModuleBase_ActionParameter.h>
#include <ModelAPI_Feature.h>
+#include <SelectMgr_ListOfFilter.hxx>
+
#include <QWidget>
#include <memory>
/// \return the boolean result
bool isInitialized(ObjectPtr theObject) const;
+ /// Fills given container with selection modes if the widget has it
+ /// \param [out] theModuleSelectionModes module additional modes, -1 means all default modes
+ /// \param [out] theModes a container of modes
+ virtual void selectionModes(int& theModuleSelectionModes, QIntList& theModes);
+
+ /// Appends into container of workshop selection filters
+ /// \param [out] theModuleSelectionFilters module additional modes, -1 means all default modes
+ /// \param [out] theSelectionFilters selection filters
+ virtual void selectionFilters(QIntList& theModuleSelectionFilters,
+ SelectMgr_ListOfFilter& theSelectionFilters);
+
/// Returns true, if default value of the widget should be computed
/// on operation's execute, like radius for circle's constraint (can not be zero)
bool isComputedDefault() const { return myIsComputedDefault; }
/// The method called when widget is deactivated
virtual void deactivate();
+ /// Opportunity to do something after the active widget of the property panel changed
+ virtual void updateAfterDeactivation() {}
+ /// Opportunity to do something after the active widget of the property panel changed
+ virtual void updateAfterActivation() {}
+
+ /// The method called if widget should be activated always
+ virtual bool needToBeActiated() { return false; }
+
/// Returns list of widget controls
/// \return a control list
virtual QList<QWidget*> getControls() const = 0;
virtual bool canProcessAction(ModuleBase_ActionType theActionType, bool& isActionEnabled);
/// Returns true if the event is processed. The default implementation is empty, returns false.
- virtual bool processAction(ModuleBase_ActionType theActionType);
+ virtual bool processAction(ModuleBase_ActionType theActionType,
+ const ActionParamPtr& theParam = ActionParamPtr());
+
+ /// Returns list of accessible actions for Undo/Redo commands. By default it returns empty list.
+ /// \param theActionType type of action. It can be ActionUndo or ActionRedo.
+ virtual QList<ActionInfo> actionsList(ModuleBase_ActionType theActionType) const
+ { return QList<ActionInfo>(); }
/// Sends Update and Redisplay for the given object
/// \param theObj is updating object
/// \return a model widget or NULL
static ModuleBase_ModelWidget* findModelWidget(ModuleBase_IPropertyPanel* theProp,
QWidget* theWidget);
+
+ /// Returns True if the widget uses feature attribute.
+ /// If not then it means that the widget do not need attribute at all.
+ virtual bool usesAttribute() const { return true; }
+
signals:
/// The signal about widget values are to be changed
void beforeValuesChanged();
//// Returns true if the event is processed. The default implementation is empty, returns false.
virtual bool processDelete();
-protected slots:
+ /// Returns true if envent is processed. It applyes workshop selection for the widget attribute.
+ virtual bool processSelection();
+
+ protected slots:
/// Processing of values changed in model widget by store the current value to the feature
void onWidgetValuesChanged();
//
#include <ModuleBase_WidgetMultiSelector.h>
-#include <ModuleBase_WidgetShapeSelector.h>
+
+#include <ModuleBase_ActionIntParameter.h>
+#include <ModuleBase_Definitions.h>
+#include <ModuleBase_Events.h>
+#include <ModuleBase_IconFactory.h>
+#include <ModuleBase_IModule.h>
#include <ModuleBase_ISelection.h>
-#include <ModuleBase_IWorkshop.h>
+#include <ModuleBase_ISelectionActivate.h>
+ #include <ModuleBase_IPropertyPanel.h>
#include <ModuleBase_IViewer.h>
+#include <ModuleBase_IWorkshop.h>
+#include <ModuleBase_ListView.h>
#include <ModuleBase_Tools.h>
-#include <ModuleBase_Definitions.h>
-#include <ModuleBase_IModule.h>
#include <ModuleBase_ViewerPrs.h>
-#include <ModuleBase_IconFactory.h>
-#include <ModuleBase_Events.h>
+#include <ModuleBase_WidgetShapeSelector.h>
+ #include <ModuleBase_ChoiceCtrl.h>
#include <ModelAPI_Data.h>
#include <ModelAPI_Object.h>
#include <QString>
#include <QComboBox>
#include <QEvent>
-#include <QAction>
#include <QApplication>
#include <QClipboard>
#include <QTimer>
#include <memory>
#include <string>
-const int ATTRIBUTE_SELECTION_INDEX_ROLE = Qt::UserRole + 1;
-
//#define DEBUG_UNDO_REDO
-/**
-* Customization of a List Widget to make it to be placed on full width of container
-*/
-class CustomListWidget : public QListWidget
-{
-public:
- /// Constructor
- /// \param theParent a parent widget
- CustomListWidget( QWidget* theParent )
- : QListWidget( theParent )
- {
- }
-
- /// Redefinition of virtual method
- virtual QSize sizeHint() const
- {
- int aHeight = 2*QFontMetrics( font() ).height();
- QSize aSize = QListWidget::sizeHint();
- return QSize( aSize.width(), aHeight );
- }
-
- /// Redefinition of virtual method
- virtual QSize minimumSizeHint() const
- {
- int aHeight = 4/*2*/*QFontMetrics( font() ).height();
- QSize aSize = QListWidget::minimumSizeHint();
- return QSize( aSize.width(), aHeight );
- }
-
-#ifndef WIN32
-// The code is necessary only for Linux because
-//it can not update viewport on widget resize
-protected:
- void resizeEvent(QResizeEvent* theEvent)
- {
- QListWidget::resizeEvent(theEvent);
- QTimer::singleShot(5, viewport(), SLOT(repaint()));
- }
-#endif
-};
-
#ifdef DEBUG_UNDO_REDO
void printHistoryInfo(const QString& theMethodName, int theCurrentHistoryIndex,
QList<QList<std::shared_ptr<ModuleBase_ViewerPrs> > > theSelectedHistoryValues)
}
#endif
+
+ QStringList getIconsList(const QStringList& theNames)
+ {
+ QStringList aIcons;
+ foreach (QString aName, theNames) {
+ QString aUName = aName.toUpper();
+ if ((aUName == "VERTICES") || (aUName == "VERTEX"))
+ aIcons << ":pictures/vertex32.png";
+ else if ((aUName == "EDGES") || (aUName == "EDGE"))
+ aIcons << ":pictures/edge32.png";
+ else if ((aUName == "FACES") || (aUName == "FACE"))
+ aIcons << ":pictures/face32.png";
+ else if ((aUName == "SOLIDS") || (aUName == "SOLID"))
+ aIcons << ":pictures/solid32.png";
+ }
+ return aIcons;
+ }
+
+
+
ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector(QWidget* theParent,
ModuleBase_IWorkshop* theWorkshop,
const Config_WidgetAPI* theData)
: ModuleBase_WidgetSelector(theParent, theWorkshop, theData),
myIsSetSelectionBlocked(false), myCurrentHistoryIndex(-1)
{
+ std::string aPropertyTypes = theData->getProperty("type_choice");
+ QString aTypesStr = aPropertyTypes.c_str();
+ myShapeTypes = aTypesStr.split(' ', QString::SkipEmptyParts);
+ myIsUseChoice = theData->getBooleanAttribute("use_choice", false);
+
QGridLayout* aMainLay = new QGridLayout(this);
ModuleBase_Tools::adjustMargins(aMainLay);
- QLabel* aTypeLabel = new QLabel(tr("Type"), this);
- aMainLay->addWidget(aTypeLabel, 0, 0);
+ QStringList aIconsList = getIconsList(myShapeTypes);
+ myTypeCtrl = new ModuleBase_ChoiceCtrl(this, myShapeTypes, aIconsList);
+ myTypeCtrl->setLabel(tr("Type"));
+ myTypeCtrl->setValue(0);
+ aMainLay->addWidget(myTypeCtrl, 0, 0, 1, 2);
- myTypeCombo = new QComboBox(this);
// There is no sense to parameterize list of types while we can not parameterize selection mode
-
- std::string aPropertyTypes = theData->getProperty("type_choice");
- QString aTypesStr = aPropertyTypes.c_str();
- QStringList aShapeTypes = aTypesStr.split(' ', QString::SkipEmptyParts);
-
- myIsUseChoice = theData->getBooleanAttribute("use_choice", false);
-
- if (!aShapeTypes.empty())
- myTypeCombo->addItems(aShapeTypes);
- aMainLay->addWidget(myTypeCombo, 0, 1);
// if the xml definition contains one type, the controls to select a type should not be shown
- if (aShapeTypes.size() <= 1 || !myIsUseChoice) {
- aTypeLabel->setVisible(false);
- myTypeCombo->setVisible(false);
+ if (myShapeTypes.size() <= 1 || !myIsUseChoice) {
+ myTypeCtrl->setVisible(false);
}
QString aLabelText = translate(theData->getProperty("label"));
aMainLay->addWidget(aListLabel, 1, 0);
// if the xml definition contains one type, an information label
// should be shown near to the latest
- if (aShapeTypes.size() <= 1) {
+ if (myShapeTypes.size() <= 1) {
QString aLabelIcon = QString::fromStdString(theData->widgetIcon());
if (!aLabelIcon.isEmpty()) {
QLabel* aSelectedLabel = new QLabel("", this);
}
QString aToolTip = QString::fromStdString(theData->widgetTooltip());
- myListControl = new CustomListWidget(this);
QString anObjName = QString::fromStdString(attributeID());
- myListControl->setObjectName(anObjName);
- myListControl->setToolTip(aToolTip);
- myListControl->setSelectionMode(QAbstractItemView::ExtendedSelection);
+ myListView = new ModuleBase_ListView(this, anObjName, aToolTip);
+ connect(myListView->getControl(), SIGNAL(itemSelectionChanged()), SLOT(onListSelection()));
+ connect(myListView, SIGNAL(deleteActionClicked()), SLOT(onDeleteItem()));
- aMainLay->addWidget(myListControl, 2, 0, 1, -1);
+ aMainLay->addWidget(myListView->getControl(), 2, 0, 1, -1);
aMainLay->setRowStretch(2, 1);
//aMainLay->addWidget(new QLabel(this)); //FIXME(sbh)???
//aMainLay->setRowMinimumHeight(3, 20);
//this->setLayout(aMainLay);
- connect(myTypeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelectionTypeChanged()));
+ connect(myTypeCtrl, SIGNAL(valueChanged(int)), this, SLOT(onSelectionTypeChanged()));
- myCopyAction = ModuleBase_Tools::createAction(QIcon(":pictures/copy.png"), tr("Copy"),
- myWorkshop->desktop(), this, SLOT(onCopyItem()));
- myCopyAction->setShortcut(QKeySequence::Copy);
- myCopyAction->setEnabled(false);
- myListControl->addAction(myCopyAction);
-
- myDeleteAction = ModuleBase_Tools::createAction(QIcon(":pictures/delete.png"), tr("Delete"),
- myWorkshop->desktop(), this, SLOT(onDeleteItem()));
- myDeleteAction->setEnabled(false);
- myListControl->addAction(myDeleteAction);
-
- myListControl->setContextMenuPolicy(Qt::ActionsContextMenu);
- connect(myListControl, SIGNAL(itemSelectionChanged()), SLOT(onListSelection()));
-
myIsNeutralPointClear = theData->getBooleanAttribute("clear_in_neutral_point", true);
}
myWorkshop->module()->activateCustomPrs(myFeature,
ModuleBase_IModule::CustomizeHighlightedObjects, true);
clearSelectedHistory();
- myWorkshop->updateCommandStatus();
}
//********************************************************************
myWorkshop->module()->deactivateCustomPrs(ModuleBase_IModule::CustomizeHighlightedObjects, true);
clearSelectedHistory();
+}
+
+//********************************************************************
+void ModuleBase_WidgetMultiSelector::updateAfterDeactivation()
+{
+ // restore previous Undo/Redo workshop state
+ myWorkshop->updateCommandStatus();
+}
+
+//********************************************************************
+void ModuleBase_WidgetMultiSelector::updateAfterActivation()
+{
+ // fill Undo/Redo actions with current information
myWorkshop->updateCommandStatus();
}
std::string aType = anAttribute->attributeType();
if (aType == ModelAPI_AttributeSelectionList::typeId()) {
AttributeSelectionListPtr aSelectionListAttr = myFeature->data()->selectionList(attributeID());
- aSelectionListAttr->setSelectionType(myTypeCombo->currentText().toStdString());
+ aSelectionListAttr->setSelectionType(myTypeCtrl->textValue().toStdString());
}
return true;
}
}
break;
default:
+ aCanProcess = ModuleBase_WidgetSelector::canProcessAction(theActionType, isActionEnabled);
break;
}
return aCanProcess;
}
//********************************************************************
-bool ModuleBase_WidgetMultiSelector::processAction(ModuleBase_ActionType theActionType)
+bool ModuleBase_WidgetMultiSelector::processAction(ModuleBase_ActionType theActionType,
+ const ActionParamPtr& theParam)
{
switch (theActionType) {
case ActionUndo:
case ActionRedo: {
+ ActionIntParamPtr aParam =
+ std::dynamic_pointer_cast<ModuleBase_ActionIntParameter>(theParam);
+ int aNb = aParam->value();
if (theActionType == ActionUndo)
- myCurrentHistoryIndex--;
+ myCurrentHistoryIndex -= aNb;
else
- myCurrentHistoryIndex++;
+ myCurrentHistoryIndex += aNb;
QList<ModuleBase_ViewerPrsPtr> aSelected = mySelectedHistoryValues[myCurrentHistoryIndex];
// equal vertices should not be used here
ModuleBase_ISelection::filterSelectionOnEqualPoints(aSelected);
return true;
}
default:
- return ModuleBase_ModelWidget::processAction(theActionType);
+ return ModuleBase_ModelWidget::processAction(theActionType, theParam);
}
}
-//********************************************************************
-bool ModuleBase_WidgetMultiSelector::activateSelectionAndFilters(bool toActivate)
-{
- myWorkshop->updateCommandStatus(); // update enable state of Undo/Redo application actions
- return ModuleBase_WidgetSelector::activateSelectionAndFilters(toActivate);
-}
-
//********************************************************************
bool ModuleBase_WidgetMultiSelector::isValidSelectionCustom(const ModuleBase_ViewerPrsPtr& thePrs)
{
std::set<int> anAttributeIds;
getSelectedAttributeIndices(anAttributeIds);
- QModelIndexList aIndexes = myListControl->selectionModel()->selectedIndexes();
+ QModelIndexList anIndices = myListView->getControl()->selectionModel()->selectedIndexes();
// refill attribute by the items which indices are not in the list of ids
bool aDone = false;
}
// Restore selection
- int aRows = myListControl->model()->rowCount();
- if (aRows > 0) {
- foreach(QModelIndex aIndex, aIndexes) {
- if (aIndex.row() < aRows)
- myListControl->selectionModel()->select(aIndex, QItemSelectionModel::Select);
- else {
- QModelIndex aIdx = myListControl->model()->index(aRows - 1, 0);
- myListControl->selectionModel()->select(aIdx, QItemSelectionModel::Select);
- }
- }
- }
+ myListView->restoreSelection(anIndices);
+
appendSelectionInHistory();
return aDone;
}
QList<QWidget*> ModuleBase_WidgetMultiSelector::getControls() const
{
QList<QWidget*> result;
- //result << myTypeCombo;
- result << myListControl;
+ result << myListView->getControl();
return result;
}
//********************************************************************
void ModuleBase_WidgetMultiSelector::onSelectionTypeChanged()
{
- activateSelectionAndFilters(true);
+ // Clear current selection in order to avoid updating of object browser with obsolete indexes
+ // which can appear because of results deletetion after changing a type of selection
+ QList<ModuleBase_ViewerPrsPtr> aEmptyList;
+ myWorkshop->setSelected(aEmptyList);
+
+ updateSelectionModesAndFilters(true);
+ myWorkshop->selectionActivate()->updateSelectionModes();
if (!myFeature)
return;
std::string aType = anAttribute->attributeType();
if (aType == ModelAPI_AttributeSelectionList::typeId()) {
AttributeSelectionListPtr aSelectionListAttr = myFeature->data()->selectionList(attributeID());
- aSelectionListAttr->setSelectionType(myTypeCombo->currentText().toStdString());
+ aSelectionListAttr->setSelectionType(myTypeCtrl->textValue().toStdString());
}
// clear attribute values
true); /// hope that something is redisplayed by object updated
// clear history should follow after set selected to do not increase history by setSelected
clearSelectedHistory();
+
+ if (myWorkshop->propertyPanel()->activeWidget() != this)
+ myWorkshop->propertyPanel()->activateWidget(this);
}
//********************************************************************
-void ModuleBase_WidgetMultiSelector::onSelectionChanged()
+bool ModuleBase_WidgetMultiSelector::processSelection()
{
if (!myIsNeutralPointClear) {
QList<ModuleBase_ViewerPrsPtr> aSelected = getFilteredSelected();
static Events_ID anEvent = Events_Loop::eventByName(EVENT_UPDATE_BY_WIDGET_SELECTION);
ModelAPI_EventCreator::get()->sendUpdated(myFeature, anEvent);
Events_Loop::loop()->flush(anEvent);
- return;
+ return true;
}
}
}
appendFirstSelectionInHistory();
- ModuleBase_WidgetSelector::onSelectionChanged();
+ bool aDone = ModuleBase_WidgetSelector::processSelection();
appendSelectionInHistory();
+ return aDone;
}
void ModuleBase_WidgetMultiSelector::appendFirstSelectionInHistory()
{
// Set focus to List control in order to make possible
// to use Tab key for transfer the focus to next widgets
- ModuleBase_Tools::setFocus(myListControl,
+ ModuleBase_Tools::setFocus(myListView->getControl(),
"ModuleBase_WidgetMultiSelector::onSelectionTypeChanged()");
}
{
QIntList aShapeTypes;
- if (myTypeCombo->count() > 1 && myIsUseChoice) {
- aShapeTypes.append(ModuleBase_Tools::shapeType(myTypeCombo->currentText()));
+ if (myShapeTypes.length() > 1 && myIsUseChoice) {
+ aShapeTypes.append(ModuleBase_Tools::shapeType(myTypeCtrl->textValue()));
}
else {
- for (int i = 0, aCount = myTypeCombo->count(); i < aCount; i++)
- aShapeTypes.append(ModuleBase_Tools::shapeType(myTypeCombo->itemText(i)));
+ foreach (QString aType, myShapeTypes) {
+ aShapeTypes.append(ModuleBase_Tools::shapeType(aType));
+ }
}
return aShapeTypes;
}
{
QString aShapeTypeName;
- for (int idx = 0; idx < myTypeCombo->count(); ++idx) {
- aShapeTypeName = myTypeCombo->itemText(idx);
+ int idx = 0;
+ foreach (QString aShapeTypeName, myShapeTypes) {
int aRefType = ModuleBase_Tools::shapeType(aShapeTypeName);
- if(aRefType == theShapeType && idx != myTypeCombo->currentIndex()) {
+ if(aRefType == theShapeType && idx != myTypeCtrl->value()) {
- bool aWasActivated = activateSelectionAndFilters(false);
+ updateSelectionModesAndFilters(false);
- bool isBlocked = myTypeCombo->blockSignals(true);
- myTypeCombo->setCurrentIndex(idx);
- myTypeCombo->blockSignals(isBlocked);
+ bool isBlocked = myTypeCtrl->blockSignals(true);
+ myTypeCtrl->setValue(idx);
+ myTypeCtrl->blockSignals(isBlocked);
- if (aWasActivated)
- activateSelectionAndFilters(true);
+ updateSelectionModesAndFilters(true);
break;
}
+ idx++;
}
}
//********************************************************************
void ModuleBase_WidgetMultiSelector::updateSelectionList()
{
- myListControl->clear();
+ myListView->getControl()->clear();
DataPtr aData = myFeature->data();
AttributePtr anAttribute = aData->attribute(attributeID());
AttributeSelectionListPtr aSelectionListAttr = aData->selectionList(attributeID());
for (int i = 0; i < aSelectionListAttr->size(); i++) {
AttributeSelectionPtr aAttr = aSelectionListAttr->value(i);
- QListWidgetItem* anItem = new QListWidgetItem(aAttr->namingName().c_str(), myListControl);
- anItem->setData(ATTRIBUTE_SELECTION_INDEX_ROLE, i);
- myListControl->addItem(anItem);
+ myListView->addItem(aAttr->namingName().c_str(), i);
}
}
else if (aType == ModelAPI_AttributeRefList::typeId()) {
for (int i = 0; i < aRefListAttr->size(); i++) {
ObjectPtr anObject = aRefListAttr->object(i);
if (anObject.get()) {
- QListWidgetItem* anItem = new QListWidgetItem(anObject->data()->name().c_str(),
- myListControl);
- anItem->setData(ATTRIBUTE_SELECTION_INDEX_ROLE, i);
- myListControl->addItem(anItem);
+ myListView->addItem(anObject->data()->name().c_str(), i);
}
}
}
aName = anObject->data()->name().c_str();
}
}
- QListWidgetItem* anItem = new QListWidgetItem(aName, myListControl);
- anItem->setData(ATTRIBUTE_SELECTION_INDEX_ROLE, i);
- myListControl->addItem(anItem);
+ myListView->addItem(aName, i);
}
}
// We have to call repaint because sometimes the List control is not updated
- myListControl->repaint();
+ myListView->getControl()->repaint();
}
//********************************************************************
QList<ModuleBase_ViewerPrsPtr> anEmptyList;
// This method will call Selection changed event which will call onSelectionChanged
- // To clear mySelection, myListControl and storeValue()
+ // To clear mySelection, myListView and storeValue()
// So, we don't need to call it
myWorkshop->setSelected(anEmptyList);
myIsNeutralPointClear = isClearInNeutralPoint;
}
-//********************************************************************
-void ModuleBase_WidgetMultiSelector::onCopyItem()
-{
- QList<QListWidgetItem*> aItems = myListControl->selectedItems();
- QString aRes;
- foreach(QListWidgetItem* aItem, aItems) {
- if (!aRes.isEmpty())
- aRes += "\n";
- aRes += aItem->text();
- }
- if (!aRes.isEmpty()) {
- QClipboard *clipboard = QApplication::clipboard();
- clipboard->setText(aRes);
- }
-}
-
//********************************************************************
void ModuleBase_WidgetMultiSelector::onDeleteItem()
{
//********************************************************************
void ModuleBase_WidgetMultiSelector::onListSelection()
{
- QList<QListWidgetItem*> aItems = myListControl->selectedItems();
- myCopyAction->setEnabled(!aItems.isEmpty());
- myDeleteAction->setEnabled(!aItems.isEmpty());
-
myWorkshop->module()->customizeObject(myFeature, ModuleBase_IModule::CustomizeHighlightedObjects,
true);
}
//********************************************************************
void ModuleBase_WidgetMultiSelector::getSelectedAttributeIndices(std::set<int>& theAttributeIds)
{
- QList<QListWidgetItem*> aItems = myListControl->selectedItems();
- foreach(QListWidgetItem* anItem, aItems) {
- int anIndex = anItem->data(ATTRIBUTE_SELECTION_INDEX_ROLE).toInt();
- if (theAttributeIds.find(anIndex) == theAttributeIds.end())
- theAttributeIds.insert(anIndex);
- }
+ myListView->getSelectedIndices(theAttributeIds);
}
void ModuleBase_WidgetMultiSelector::convertIndicesToViewerSelection(std::set<int> theAttributeIds,
}
return aFound;
}
+
+QList<ActionInfo>
+ ModuleBase_WidgetMultiSelector::actionsList(ModuleBase_ActionType theActionType) const
+{
+ QList<ActionInfo> aList;
+ if (myCurrentHistoryIndex > -1) {
+ int i = 0;
+ QString aTitle("Selection %1 items");
+ QString aTit("Selection %1 item");
+ QIcon aIcon(":pictures/selection.png");
+ int aNb;
+ switch (theActionType) {
+ case ActionUndo:
+ i = 1;
+ while (i <= myCurrentHistoryIndex) {
+ aNb = mySelectedHistoryValues.at(i).count();
+ if (aNb == 1) {
+ ActionInfo aInfo(aIcon, aTit.arg(aNb));
+ aList.insert(0, aInfo);
+ } else {
+ ActionInfo aInfo(aIcon, aTitle.arg(aNb));
+ aList.insert(0, aInfo);
+ }
+ i++;
+ }
+ break;
+ case ActionRedo:
+ i = mySelectedHistoryValues.length() - 1;
+ while (i > myCurrentHistoryIndex) {
+ aNb = mySelectedHistoryValues.at(i).count();
+ if (aNb == 1) {
+ ActionInfo aInfo(aIcon, aTit.arg(mySelectedHistoryValues.at(i).count()));
+ aList.insert(0, aInfo);
+ } else {
+ ActionInfo aInfo(aIcon, aTitle.arg(mySelectedHistoryValues.at(i).count()));
+ aList.insert(0, aInfo);
+ }
+ i--;
+ }
+ break;
+ }
+ }
+ return aList;
+}
#include <QMap>
class QWidget;
- class QComboBox;
-class QListWidget;
+ //class QComboBox;
+class ModuleBase_ListView;
class ModuleBase_IWorkshop;
-class QAction;
+ class ModuleBase_ChoiceCtrl;
-
/**
* \ingroup GUI
* Implementation of widget for shapes selection. This widget provides selection of several shapes.
/// The methiod called when widget is deactivated
virtual void deactivate();
+ /// Update Undo/Redo actions state
+ virtual void updateAfterDeactivation();
+
+ /// Update Undo/Redo actions state
+ virtual void updateAfterActivation();
+
/// Set the given wrapped value to the current widget
/// This value should be processed in the widget according to the needs
/// \param theValues the wrapped selection values
virtual bool canProcessAction(ModuleBase_ActionType theActionType, bool& isActionEnabled);
/// Returns true if the event is processed. The default implementation is empty, returns false.
- virtual bool processAction(ModuleBase_ActionType theActionType);
-
- /// Activate or deactivate selection and selection filters
- /// \return true if the selection filter of the widget is activated in viewer context
- virtual bool activateSelectionAndFilters(bool toActivate);
+ virtual bool processAction(ModuleBase_ActionType theActionType,
+ const ActionParamPtr& theParam = ActionParamPtr());
/// Checks the widget validity. By default, it returns true.
/// \param thePrs a selected presentation in the view
/// \return a boolean value
virtual bool isValidSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
+ /// Returns list of accessible actions for Undo/Redo commands. By default it returns empty list.
+ /// \param theActionType type of action. It can be ActionUndo or ActionRedo.
+ virtual QList<ActionInfo> actionsList(ModuleBase_ActionType theActionType) const;
+
public slots:
/// Slot is called on selection type changed
void onSelectionTypeChanged();
- /// Slot which is called on selection event. Redefined to process XML state about
- /// clear selection in neutral point
- virtual void onSelectionChanged();
+protected:
+ /// Returns true if envent is processed.
+ /// Redefined to process XML state about clear selection in neutral point
+ virtual bool processSelection();
protected slots:
- /// Slot for copy command in a list pop-up menu
- void onCopyItem();
-
/// Slot for delete command in a list pop-up menu
void onDeleteItem();
ModuleBase_IWorkshop* theWorkshop);
protected:
- /// List control
- QListWidget* myListControl;
+ ModuleBase_ListView* myListView; ///< List control
- QComboBox* myTypeCombo; ///< Combobox of types
- bool myIsUseChoice; /// A flag to store use_choice parameter state
++
++ bool myIsUseChoice; ///< A flag to store use_choice parameter state
+
- QStringList myShapeTypes;
++ QStringList myShapeTypes; ///< List of Shape types defined in XML
+
+ /// Control for types
+ ModuleBase_ChoiceCtrl* myTypeCtrl;
- /// Provides correspondance between Result object and its shape
- typedef QPair<ResultPtr, GeomShapePtr> GeomSelection;
-
- /// A copy action for pop-up menu in a list control
- QAction* myCopyAction;
-
- /// A delete action for pop-up menu in a list control
- QAction* myDeleteAction;
-
- /// A flag to store use_choice parameter state
- bool myIsUseChoice;
-
/// A flag to clear selection by click in empty place in the viewer
bool myIsNeutralPointClear;
/// A container of selected objects
QList<QList<std::shared_ptr<ModuleBase_ViewerPrs> > > mySelectedHistoryValues;
+
/// Position in a container of selected values
int myCurrentHistoryIndex;
};
// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
//
-/*
- * XGUI_ActionsMgr.h
- */
-
-#ifndef XGUI_ACTIONSMGR_H_
-#define XGUI_ACTIONSMGR_H_
+#ifndef XGUI_ActionsMgr_H
+#define XGUI_ActionsMgr_H
#include "XGUI.h"
class ModuleBase_Operation;
class QAction;
-/**
-* \ingroup GUI
-* A class for management of actions (features) activation/deactivation
-*/
+/// class XGUI_ActionsMgr
+/// \ingroup GUI
+/// A class for management of actions (features) activation/deactivation
class XGUI_EXPORT XGUI_ActionsMgr : public QObject, public Events_Listener
{
Q_OBJECT
enum OperationStateActionId {
Abort = 0,
Accept = 1,
- Help = 2,
- AbortAll = 3,
- AcceptAll = 4,
- Preview = 5
+ AcceptPlus = 2,
+ Help = 3,
+ AbortAll = 4,
+ AcceptAll = 5,
+ Preview = 6
};
- //! Add a command in the manager.
- //! Please note that nested commands in the Salome mode (No AppElements_Command, pure QActions)
- //! won't be extracted and should be added manually using the addNestedCommands method.
+ /// Add a command in the manager.
+ /// Please note that nested commands in the Salome mode (No AppElements_Command, pure QActions)
+ /// won't be extracted and should be added manually using the addNestedCommands method.
void addCommand(QAction* theCmd);
- //! Sets relation between the command (with given Id) and it's nested actions.
+ /// Sets relation between the command (with given Id) and it's nested actions.
void addNestedCommands(const QString& theId, const QStringList& theCommands);
- //! Returns list of nested commands by parent command Id
- //! \param theId a parent command Id
+ /// Returns list of nested commands by parent command Id
+ /// \param theId a parent command Id
QStringList nestedCommands(const QString& theId) const;
/// Returns True if the given Id is an Id of nested command
/// \param theKeySequence - string that contain a key sequence to register
QKeySequence registerShortcut(const QString& theKeySequence);
- //! Redefinition of Events_Listener method
+ /// Redefinition of Events_Listener method
virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
- //! Return property panel's action like ok, cancel, help.
- //! If there is no such action, it will be created.
+ /// Return property panel's action like ok, cancel, help.
+ /// If there is no such action, it will be created.
QAction* operationStateAction(OperationStateActionId theId);
/// Return an action by the given id, if it was registered in the manager
ActionInfo actionInfoById(const QString& theId);
private:
- //! Update workbench actions according to OperationMgr state:
- //! No active operations: all actions but nested are available
- //! There is active operation: current operation + it's nested
- //! are enabled, all the rest is disabled. All active commands is checked.
+ /// Update workbench actions according to OperationMgr state:
+ /// No active operations: all actions but nested are available
+ /// There is active operation: current operation + it's nested
+ /// are enabled, all the rest is disabled. All active commands is checked.
void updateCommandsStatus();
- //! Sets all commands checked if it's operation is active.
+ /// Sets all commands checked if it's operation is active.
void updateCheckState();
- //! Updates actions according to current selection in the viewer
+ /// Updates actions according to current selection in the viewer
void updateOnViewSelection();
- //! Sets all actions to enabled state.
+ /// Sets all actions to enabled state.
void setAllEnabled();
- //! Sets all nested actions to isEnabled state for the command with given ID.
- //! If ID is empty - all nested actions will be affected.
+ /// Sets all nested actions to isEnabled state for the command with given ID.
+ /// If ID is empty - all nested actions will be affected.
void setNestedCommandsEnabled(bool isEnabled, const QString& theParent = QString());
- //! Sets to enabled state all siblings of the given operation and it's parents recursively
+ /// Sets to enabled state all siblings of the given operation and it's parents recursively
void setNestedStackEnabled(ModuleBase_Operation* theOperation);
- //! Sets the action with theId to theChecked state.
+ /// Sets the action with theId to theChecked state.
void setActionChecked(const QString& theId, const bool theChecked);
- //! Sets the action with theId to theEnabled state.
+ /// Sets the action with theId to theEnabled state.
void setActionEnabled(const QString& theId, const bool theEnabled);
- //! Updates actions according to their "document" tag
+ /// Updates actions according to their "document" tag
void updateByDocumentKind();
- //! Asks plugins about their features state, using the Events system
+ /// Asks plugins about their features state, using the Events system
void updateByPlugins(FeaturePtr theActiveFeature);
+ /// Returns names of nested action for the feature of given operation
+ /// \param theOperation an operation
QStringList allNestedCommands(ModuleBase_Operation* theOperation);
private:
friend class XGUI_Workshop;
};
-#endif /* XGUI_ACTIONSMGR_H_ */
+#endif /* XGUI_ActionsMgr_H */
// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
//
-#include <XGUI_PropertyPanel.h>
#include <XGUI_ActionsMgr.h>
+#include <XGUI_ActiveControlMgr.h>
+#include <XGUI_SelectionActivate.h>
+#include <XGUI_ActiveControlSelector.h>
+#include <XGUI_PropertyPanel.h>
+#include <XGUI_PropertyPanelSelector.h>
#include <XGUI_OperationMgr.h>
+#include <XGUI_Tools.h>
+#include <XGUI_Workshop.h>
+
//#include <AppElements_Constants.h>
#include <ModuleBase_WidgetMultiSelector.h>
#include <ModuleBase_Tools.h>
#include <ModuleBase_WidgetFactory.h>
#include <ModuleBase_OperationDescription.h>
#include <ModuleBase_Events.h>
+ #include <ModuleBase_IWorkshop.h>
#include <Events_Loop.h>
#include <QVBoxLayout>
#include <QGridLayout>
#include <QWidget>
- #include <QToolButton>
#include <QAction>
#ifdef _DEBUG
QStringList aBtnNames;
aBtnNames << QString(PROP_PANEL_HELP)
<< QString(PROP_PANEL_OK)
+ << QString(PROP_PANEL_OK_PLUS)
<< QString(PROP_PANEL_CANCEL);
foreach(QString eachBtnName, aBtnNames) {
QToolButton* aBtn = new QToolButton(aFrm);
if (myActiveWidget)
myActiveWidget->deactivate();
+ XGUI_ActiveControlSelector* aPPSelector = XGUI_Tools::workshop(myOperationMgr->workshop())->
+ activeControlMgr()->getSelector(XGUI_PropertyPanelSelector::Type());
+ aPPSelector->reset(); // it removes need to be updated widget link
+
/// as the widgets are deleted later, it is important that the signals
/// of these widgets are not processed. An example of the error is issue 986.
/// In the given case, the property panel is firstly filled by new widgets
myWidgets.clear();
myPanelPage->clearPage();
myActiveWidget = NULL;
+ emit propertyPanelDeactivated();
+ myOperationMgr->workshop()->selectionActivate()->updateSelectionModes();
+ myOperationMgr->workshop()->selectionActivate()->updateSelectionFilters();
#ifdef DEBUG_ACTIVE_WIDGET
std::cout << "myActiveWidget = NULL" << std::endl;
#endif
/// Apply button should be update if the feature was modified by the panel
myOperationMgr->onValidateOperation();
}
+ std::shared_ptr<Config_FeatureMessage> aFeatureInfo =
+ myOperationMgr->workshop()->featureInfo(theFeature->getKind().c_str());
+ findButton(PROP_PANEL_OK_PLUS)->setVisible(aFeatureInfo->isApplyContinue());
}
void XGUI_PropertyPanel::activateNextWidget(ModuleBase_ModelWidget* theWidget)
findDirectChildren(this, aChildren, true);
int aChildrenCount = aChildren.count();
int aFocusWidgetIndex = aChildren.indexOf(aFocusWidget);
+ QToolButton* anOkBtn = findButton(PROP_PANEL_OK);
if (aFocusWidgetIndex >= 0) {
if (theIsNext) {
if (aFocusWidgetIndex == aChildrenCount-1) {
// after the last widget focus should be set to "Apply"
- QToolButton* anOkBtn = findButton(PROP_PANEL_OK);
if (anOkBtn->isEnabled())
aNewFocusWidget = anOkBtn;
else {
}
else {
// before the "Apply" button, the last should accept focus for consistency with "Next"
- QToolButton* anOkBtn = findButton(PROP_PANEL_OK);
if (aFocusWidget == anOkBtn) {
aNewFocusWidget = aChildren[aChildrenCount - 1];
}
bool isFirstControl = !theIsNext;
QWidget* aLastFocusControl = myActiveWidget->getControlAcceptingFocus(isFirstControl);
if (aFocusWidget == aLastFocusControl) {
- setActiveWidget(NULL);
+ setActiveWidget(NULL, false);
}
}
aPreviosAttributeID = myActiveWidget->attributeID();
// Avoid activation of already actve widget. It could happen on focusIn event many times
- if (setActiveWidget(theWidget) && theEmitSignal) {
- emit widgetActivated(myActiveWidget);
- if (!myActiveWidget && !isEditingMode()) {
- emit noMoreWidgets(aPreviosAttributeID);
- }
- }
+ setActiveWidget(theWidget, theEmitSignal);
}
-bool XGUI_PropertyPanel::setActiveWidget(ModuleBase_ModelWidget* theWidget)
+bool XGUI_PropertyPanel::setActiveWidget(ModuleBase_ModelWidget* theWidget, const bool isEmitSignal)
{
// Avoid activation of already actve widget. It could happen on focusIn event many times
if (theWidget == myActiveWidget) {
return false;
}
std::string aPreviosAttributeID;
+ ModuleBase_ModelWidget* aDeactivatedWidget = NULL, *anActivatedWidget = NULL;
if(myActiveWidget) {
aPreviosAttributeID = myActiveWidget->attributeID();
myActiveWidget->processValueState();
myActiveWidget->deactivate();
myActiveWidget->setHighlighted(false);
+ aDeactivatedWidget = myActiveWidget;
}
if(theWidget) {
emit beforeWidgetActivated(theWidget);
theWidget->setHighlighted(true);
theWidget->activate();
+ anActivatedWidget = theWidget;
}
myActiveWidget = theWidget;
+
#ifdef DEBUG_ACTIVE_WIDGET
std::cout << "myActiveWidget = " << (theWidget ? theWidget->context().c_str() : "") << std::endl;
#endif
- static Events_ID anEvent = Events_Loop::eventByName(EVENT_UPDATE_BY_WIDGET_SELECTION);
- Events_Loop::loop()->flush(anEvent);
-
+ bool aHasMoreWidgets = true;
+ if (isEmitSignal) {
+ //emit widgetActivated(myActiveWidget);
+ if (!myActiveWidget && !isEditingMode()) {
+ aHasMoreWidgets = false;
+ emit noMoreWidgets(aPreviosAttributeID);
+ }
+ }
+ if (myActiveWidget)
+ emit propertyPanelActivated();
+ else
+ emit propertyPanelDeactivated();
+ myOperationMgr->workshop()->selectionActivate()->updateSelectionModes();
+ myOperationMgr->workshop()->selectionActivate()->updateSelectionFilters();
+
+ if (aHasMoreWidgets && aDeactivatedWidget)
+ aDeactivatedWidget->updateAfterDeactivation();
+ if (aHasMoreWidgets && anActivatedWidget)
+ anActivatedWidget->updateAfterActivation();
+
+ if (aHasMoreWidgets && myActiveWidget)
+ {
+ // restore widget selection should be done after selection modes of widget activating
+ static Events_ID anEvent = Events_Loop::eventByName(EVENT_UPDATE_BY_WIDGET_SELECTION);
+ Events_Loop::loop()->flush(anEvent);
+ }
return true;
}
void XGUI_PropertyPanel::setupActions(XGUI_ActionsMgr* theMgr)
{
QStringList aButtonNames;
- aButtonNames << PROP_PANEL_OK << PROP_PANEL_CANCEL << PROP_PANEL_HELP << PROP_PANEL_PREVIEW;
+ aButtonNames << PROP_PANEL_OK<< PROP_PANEL_OK_PLUS << PROP_PANEL_CANCEL
+ << PROP_PANEL_HELP << PROP_PANEL_PREVIEW;
QList<XGUI_ActionsMgr::OperationStateActionId> aActionIds;
- aActionIds << XGUI_ActionsMgr::Accept << XGUI_ActionsMgr::Abort << XGUI_ActionsMgr::Help
- << XGUI_ActionsMgr::Preview;
+ aActionIds << XGUI_ActionsMgr::Accept << XGUI_ActionsMgr::AcceptPlus << XGUI_ActionsMgr::Abort
+ << XGUI_ActionsMgr::Help << XGUI_ActionsMgr::Preview;
for (int i = 0; i < aButtonNames.size(); ++i) {
QToolButton* aBtn = findButton(aButtonNames.at(i).toStdString().c_str());
QAction* anAct = theMgr->operationStateAction(aActionIds.at(i));
/// Internal name of Ok button
const static char* PROP_PANEL_OK = "property_panel_ok";
+ /// Internal name of Ok button
+ const static char* PROP_PANEL_OK_PLUS = "property_panel_ok_plus";
+
/// Internal name of Cancel button
const static char* PROP_PANEL_CANCEL = "property_panel_cancel";
/**
* Makes the given widget active, highlights it and removes
* highlighting from the previous active widget
- * emits widgetActivated(theWidget) signal
* \param theWidget which has to be activated
* \param theEmitSignal a flag to prohibit signal emit
*/
/// \param theObject a sender of the event
void enterClicked(QObject* theObject);
+ /// Emits on deactivating property panel (e.g. by clearContent)
+ void propertyPanelDeactivated();
+ /// Emits on widget activating
+ void propertyPanelActivated();
+
protected:
/// Makes the widget active, deactivate the previous, activate and hightlight the given one
/// \param theWidget a widget
- bool setActiveWidget(ModuleBase_ModelWidget* theWidget);
+ /// \param isEmitSignal flag whether panel signals should be emitted
+ bool setActiveWidget(ModuleBase_ModelWidget* theWidget, const bool isEmitSignal);
/// The parent method that processes the "Tab"/"SHIF + Tab" keyboard events
/// Emits a signal about focus change
/// If theIsNext is true, this function searches forward, if next is false, it searches backward.
#include "XGUI_Workshop.h"
#include "XGUI_ActionsMgr.h"
+#include "XGUI_ActiveControlMgr.h"
+#include "XGUI_ActiveControlSelector.h"
#include "XGUI_MenuMgr.h"
#include "XGUI_ColorDialog.h"
#include "XGUI_DeflectionDialog.h"
#include "XGUI_Displayer.h"
#include "XGUI_ErrorDialog.h"
#include "XGUI_ErrorMgr.h"
+#include "XGUI_FacesPanel.h"
+#include "XGUI_FacesPanelSelector.h"
#include "XGUI_ModuleConnector.h"
#include "XGUI_ObjectsBrowser.h"
#include "XGUI_OperationMgr.h"
#include "XGUI_PropertyPanel.h"
+#include "XGUI_PropertyPanelSelector.h"
#include "XGUI_PropertyDialog.h"
#include "XGUI_SalomeConnector.h"
#include "XGUI_Selection.h"
+#include "XGUI_SelectionActivate.h"
#include "XGUI_SelectionMgr.h"
#include "XGUI_Tools.h"
#include "XGUI_ViewerProxy.h"
#include <ModelAPI_Feature.h>
#include <ModelAPI_Object.h>
#include <ModelAPI_ResultBody.h>
+#include <ModelAPI_ResultCompSolid.h>
#include <ModelAPI_ResultConstruction.h>
#include <ModelAPI_ResultGroup.h>
#include <ModelAPI_ResultParameter.h>
#include <ModelAPI_ResultField.h>
#include <ModelAPI_Session.h>
#include <ModelAPI_Validator.h>
-#include <ModelAPI_ResultCompSolid.h>
#include <ModelAPI_Tools.h>
//#include <PartSetPlugin_Part.h>
#include <ModuleBase_WidgetValidated.h>
#include <ModuleBase_ModelWidget.h>
#include <ModuleBase_ResultPrs.h>
+#include <ModuleBase_ActionIntParameter.h>
#include <Config_Common.h>
#include <Config_FeatureMessage.h>
#include <dlfcn.h>
#endif
+//#define DEBUG_WITH_MESSAGE_REPORT
+
QString XGUI_Workshop::MOVE_TO_END_COMMAND = QObject::tr("Move to the end");
//#define DEBUG_DELETE
//#define DEBUG_FEATURE_NAME
//#define DEBUG_CLEAN_HISTORY
+//******************************************************
XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector* theConnector)
: QObject(),
myCurrentDir(QString()),
myModule(NULL),
mySalomeConnector(theConnector),
myPropertyPanel(0),
+ myFacesPanel(0),
myObjectBrowser(0),
myDisplayer(0)
//myViewerSelMode(TopAbs_FACE)
ModuleBase_IWorkshop* aWorkshop = moduleConnector();
// Has to be defined first in order to get errors and messages from other components
myEventsListener = new XGUI_WorkshopListener(aWorkshop);
+ mySelectionActivate = new XGUI_SelectionActivate(aWorkshop);
SUIT_ResourceMgr* aResMgr = ModuleBase_Preferences::resourceMgr();
#ifndef HAVE_SALOME
connect(mySelector, SIGNAL(selectionChanged()), this, SLOT(updateCommandStatus()));
myActionsMgr = new XGUI_ActionsMgr(this);
+ myActiveControlMgr = new XGUI_ActiveControlMgr(myModuleConnector);
myMenuMgr = new XGUI_MenuMgr(this);
myErrorDlg = new XGUI_ErrorDialog(QApplication::desktop());
myContextMenuMgr = new XGUI_ContextMenuMgr(this);
#ifdef _DEBUG
Config_PropManager::registerProp("Plugins", "create_part_by_start", "Create Part by Start",
Config_Prop::Boolean, "false");
+
+ Config_PropManager::registerProp("Plugins", "show_hide_faces", "Show Hide Faces (on the right)",
+ Config_Prop::Boolean, "false");
#endif
registerValidators();
#endif
}
+//******************************************************
void XGUI_Workshop::activateModule()
{
- myModule->activateSelectionFilters();
+ selectionActivate()->updateSelectionFilters();
connect(myDisplayer, SIGNAL(objectDisplayed(ObjectPtr, AISObjectPtr)),
myModule, SLOT(onObjectDisplayed(ObjectPtr, AISObjectPtr)));
myOperationMgr->activate();
}
+//******************************************************
void XGUI_Workshop::deactivateModule()
{
- myModule->deactivateSelectionFilters();
-
// remove internal displayer filter
- displayer()->deactivateSelectionFilters();
+ displayer()->deactivateSelectionFilters(false);
disconnect(myDisplayer, SIGNAL(objectDisplayed(ObjectPtr, AISObjectPtr)),
myModule, SLOT(onObjectDisplayed(ObjectPtr, AISObjectPtr)));
XGUI_Displayer* aDisplayer = displayer();
QObjectPtrList aDisplayed = aDisplayer->displayedObjects();
aDisplayer->deactivateObjects(aDisplayed, true);
- Handle(AIS_InteractiveContext) aContext = viewer()->AISContext();
- Handle(AIS_Trihedron) aTrihedron = Handle(AIS_Trihedron)::DownCast(aDisplayer->getTrihedron());
- /// deactivate trihedron in selection modes
- TColStd_ListOfInteger aTColModes;
- aContext->ActivatedModes(aTrihedron, aTColModes);
- TColStd_ListIteratorOfListOfInteger itr( aTColModes );
- for (; itr.More(); itr.Next() ) {
- Standard_Integer aMode = itr.Value();
- aContext->Deactivate(aTrihedron, aMode);
- }
+ selectionActivate()->deactivateTrihedronInSelectionModes();
+
#ifdef BEFORE_TRIHEDRON_PATCH
+ //Handle(AIS_Trihedron) aTrihedron = Handle(AIS_Trihedron)::DownCast(aDisplayer->getTrihedron());
/// Trihedron problem: objects stayed in the viewer, should be removed manually
/// otherwise in SALOME happens crash by HideAll in the viewer
aContext->Remove(aTrihedron->Position(), true);
addHistoryMenu(aAction, SIGNAL(updateRedoHistory(const QList<ActionInfo>&)), SLOT(onRedo(int)));
salomeConnector()->addDesktopMenuSeparator("MEN_DESK_EDIT");
- //aAction = salomeConnector()->addDesktopCommand("REBUILD_CMD", tr("Rebuild"),
- // tr("Rebuild data objects"),
- // QIcon(":pictures/rebuild.png"), QKeySequence(),
- // false, "MEN_DESK_EDIT");
- //salomeConnector()->addActionInToolbar( aAction, aToolBarTitle );
-
- //connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onRebuild()));
- //salomeConnector()->addDesktopMenuSeparator("MEN_DESK_EDIT");
aAction = salomeConnector()->addDesktopCommand("SAVEAS_CMD", tr("Export native..."),
tr("Export the current document into a native file"),
SIGNAL(updateRedoHistory(const QList<ActionInfo>&)),
SLOT(onRedo(int)));
- //aCommand = aGroup->addFeature("REBUILD_CMD", tr("Rebuild"), tr("Rebuild data objects"),
- // QIcon(":pictures/rebuild.png"), QKeySequence());
- //aCommand->connectTo(this, SLOT(onRebuild()));
-
- //aCommand->disable();
-
aCommand = aGroup->addFeature("OPEN_CMD", tr("Open..."), tr("Open a new document"),
QIcon(":pictures/open.png"), QKeySequence::Open);
aCommand->connectTo(this, SLOT(onOpen()));
}
#ifndef HAVE_SALOME
+//******************************************************
AppElements_Workbench* XGUI_Workshop::addWorkbench(const QString& theName)
{
AppElements_MainMenu* aMenuBar = myMainWindow->menuObject();
}
}
+ //******************************************************
+ void XGUI_Workshop::onAcceptPlusActionClicked()
+ {
+ QAction* anAction = dynamic_cast<QAction*>(sender());
+ XGUI_OperationMgr* anOperationMgr = operationMgr();
+ if (anOperationMgr) {
+ ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
+ (anOperationMgr->currentOperation());
+ if (aFOperation) {
+ myOperationMgr->commitOperation();
+ module()->launchOperation(aFOperation->id(), false);
+ }
+ }
+ }
+
//******************************************************
void XGUI_Workshop::onPreviewActionClicked()
{
void XGUI_Workshop::deactivateActiveObject(const ObjectPtr& theObject, const bool theUpdateViewer)
{
if (!myModule->canActivateSelection(theObject)) {
- if (myDisplayer->isActive(theObject)) {
+ if (selectionActivate()->isActive(theObject)) {
QObjectPtrList anObjects;
anObjects.append(theObject);
myDisplayer->deactivateObjects(anObjects, theUpdateViewer);
return aHasNested;
}
+//******************************************************
void XGUI_Workshop::fillPropertyPanel(ModuleBase_Operation* theOperation)
{
ModuleBase_OperationFeature* aFOperation =
if (!aFOperation)
return;
- showPropertyPanel();
+ showPanel(myPropertyPanel);
myPropertyPanel->cleanContent();
QList<ModuleBase_ModelWidget*> aWidgets;
FeaturePtr aFeature = aFOperation->feature();
std::string aFeatureKind = aFeature->getKind();
foreach (ModuleBase_ModelWidget* aWidget, aWidgets) {
- if (!aWidget->attributeID().empty() && !aFeature->attribute(aWidget->attributeID()).get()) {
- std::string anErrorMsg = "The feature '%1' has no attribute '%2' used by widget '%3'.";
- Events_InfoMessage("XGUI_Workshop", anErrorMsg)
- .arg(aFeatureKind).arg(aWidget->attributeID())
- .arg(aWidget->metaObject()->className()).send();
- myPropertyPanel->cleanContent();
- return;
+ if (aWidget->usesAttribute()) {
+ if (!aWidget->attributeID().empty() && !aFeature->attribute(aWidget->attributeID()).get()) {
+ std::string anErrorMsg = "The feature '%1' has no attribute '%2' used by widget '%3'.";
+ Events_InfoMessage("XGUI_Workshop", anErrorMsg)
+ .arg(aFeatureKind).arg(aWidget->attributeID())
+ .arg(aWidget->metaObject()->className()).send();
+ myPropertyPanel->cleanContent();
+ return;
+ }
}
}
// for performance purpose, flush should be done after all controls are filled
myErrorMgr->setPropertyPanel(myPropertyPanel);
}
+//******************************************************
void XGUI_Workshop::connectToPropertyPanel(const bool isToConnect)
{
XGUI_PropertyPanel* aPropertyPanel = propertyPanel();
myModule->operationResumed(theOperation);
}
-
//******************************************************
void XGUI_Workshop::onOperationStopped(ModuleBase_Operation* theOperation)
{
ModuleBase_ISelection* aSel = mySelector->selection();
QObjectPtrList aObj = aSel->selectedPresentations();
//!< No need for property panel
- hidePropertyPanel();
+ hidePanel(myPropertyPanel);
myPropertyPanel->cleanContent();
connectToPropertyPanel(false);
QObjectPtrList anObjects;
FeaturePtr aFeature = aFOperation->feature();
if (aFeature.get()) { // feature may be not created (plugin load fail)
- if (myDisplayer->isVisible(aFeature) && !myDisplayer->isActive(aFeature))
+ if (myDisplayer->isVisible(aFeature) && !selectionActivate()->isActive(aFeature))
anObjects.append(aFeature);
std::list<ResultPtr> aResults;
ModelAPI_Tools::allResults(aFeature, aResults);
std::list<ResultPtr>::const_iterator aIt;
for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) {
ResultPtr anObject = *aIt;
- if (myDisplayer->isVisible(anObject) && !myDisplayer->isActive(anObject)) {
+ if (myDisplayer->isVisible(anObject) && !selectionActivate()->isActive(anObject)) {
anObjects.append(anObject);
}
}
activateObjectsSelection(anObjects);
}
-
+//******************************************************
void XGUI_Workshop::onOperationCommitted(ModuleBase_Operation* theOperation)
{
myModule->operationCommitted(theOperation);
}
+//******************************************************
void XGUI_Workshop::onOperationAborted(ModuleBase_Operation* theOperation)
{
myModule->operationAborted(theOperation);
}
+//******************************************************
void XGUI_Workshop::setGrantedFeatures(ModuleBase_Operation* theOperation)
{
ModuleBase_OperationFeature* aFOperation =
//******************************************************
void XGUI_Workshop::onUndo(int theTimes)
{
- ModuleBase_ModelWidget* anActiveWidget = myOperationMgr->activeWidget();
- if (anActiveWidget && anActiveWidget->processAction(ActionUndo))
- return;
-
- objectBrowser()->treeView()->setCurrentIndex(QModelIndex());
- SessionPtr aMgr = ModelAPI_Session::get();
- std::list<std::string> aUndoList = aMgr->undoList();
- if (aMgr->isOperation()) {
- /// this is important for nested operations
- /// when sketch operation is active, this condition is false and
- /// the sketch operation is not aborted
- operationMgr()->onAbortOperation();
- }
- std::list<std::string>::const_iterator aIt = aUndoList.cbegin();
- for (int i = 0; (i < theTimes) && (aIt != aUndoList.cend()); ++i, ++aIt) {
- aMgr->undo();
- if (QString((*aIt).c_str()) == MOVE_TO_END_COMMAND)
- myObjectBrowser->rebuildDataTree();
- }
-
- operationMgr()->updateApplyOfOperations();
- updateCommandStatus();
+ processUndoRedo(ActionUndo, theTimes);
}
//******************************************************
void XGUI_Workshop::onRedo(int theTimes)
{
- ModuleBase_ModelWidget* anActiveWidget = myOperationMgr->activeWidget();
- if (anActiveWidget && anActiveWidget->processAction(ActionRedo))
- return;
+ processUndoRedo(ActionRedo, theTimes);
+}
+//******************************************************
+void XGUI_Workshop::processUndoRedo(const ModuleBase_ActionType theActionType, int theTimes)
+{
+ ModuleBase_ModelWidget* anActiveWidget = myOperationMgr->activeWidget();
+ if (anActiveWidget) {
+ ActionIntParamPtr aParam(new ModuleBase_ActionIntParameter(theTimes));
+ if (anActiveWidget->processAction(theActionType, aParam))
+ return;
+ }
// the viewer update should be blocked in order to avoid the features blinking. For the created
// feature a results are created, the flush of the created signal caused the viewer redisplay for
// each created result. After a redisplay signal is flushed. So, the viewer update is blocked
// until redo of all possible objects happens
bool isUpdateEnabled = myDisplayer->enableUpdateViewer(false);
- objectBrowser()->treeView()->setCurrentIndex(QModelIndex());
SessionPtr aMgr = ModelAPI_Session::get();
- std::list<std::string> aRedoList = aMgr->redoList();
if (aMgr->isOperation()) {
+ XGUI_OperationMgr* aOpMgr = operationMgr();
/// this is important for nested operations
/// when sketch operation is active, this condition is false and
/// the sketch operation is not aborted
- operationMgr()->onAbortOperation();
+ if (aOpMgr->canStopOperation(aOpMgr->currentOperation()))
+ aOpMgr->abortOperation(aOpMgr->currentOperation());
+ else
+ {
+ myDisplayer->enableUpdateViewer(isUpdateEnabled);
+ return;
+ }
}
- std::list<std::string>::const_iterator aIt = aRedoList.cbegin();
- for (int i = 0; (i < theTimes) && (aIt != aRedoList.cend()); ++i, ++aIt) {
- aMgr->redo();
+ objectBrowser()->treeView()->setCurrentIndex(QModelIndex());
+ std::list<std::string> anActionList = theActionType == ActionUndo ? aMgr->undoList()
+ : aMgr->redoList();
+ std::list<std::string>::const_iterator aIt = anActionList.cbegin();
+ for (int i = 0; (i < theTimes) && (aIt != anActionList.cend()); ++i, ++aIt) {
+ if (theActionType == ActionUndo)
+ aMgr->undo();
+ else
+ aMgr->redo();
+
if (QString((*aIt).c_str()) == MOVE_TO_END_COMMAND)
myObjectBrowser->rebuildDataTree();
}
operationMgr()->updateApplyOfOperations();
+ facesPanel()->reset(true);
updateCommandStatus();
// unblock the viewer update functionality and make update on purpose
myDisplayer->updateViewer();
}
-//******************************************************
-//void XGUI_Workshop::onRebuild()
-//{
-// SessionPtr aMgr = ModelAPI_Session::get();
-// bool aWasOperation = aMgr->isOperation(); // keep this value
-// if (!aWasOperation) {
-// aMgr->startOperation("Rebuild");
-// }
-// static const Events_ID aRebuildEvent = Events_Loop::loop()->eventByName("Rebuild");
-// Events_Loop::loop()->send(std::shared_ptr<Events_Message>(
-// new Events_Message(aRebuildEvent, this)));
-// if (!aWasOperation) {
-// aMgr->finishOperation();
-// }
-// updateCommandStatus();
-//}
-
//******************************************************
void XGUI_Workshop::onWidgetStateChanged(int thePreviousState)
{
}
}
+//******************************************************
void XGUI_Workshop::onWidgetObjectUpdated()
{
operationMgr()->onValidateOperation();
}
+//******************************************************
ModuleBase_IModule* XGUI_Workshop::loadModule(const QString& theModule)
{
QString libName = QString::fromStdString(library(theModule.toStdString()));
emit commandStatusUpdated();
}
+//******************************************************
void XGUI_Workshop::updateHistory()
{
- std::list<std::string> aUndoList = ModelAPI_Session::get()->undoList();
- QList<ActionInfo> aUndoRes = processHistoryList(aUndoList);
- emit updateUndoHistory(aUndoRes);
+ bool isActionEnabled = false;
+ ModuleBase_ModelWidget* anActiveWidget = myOperationMgr->activeWidget();
+ QList<ActionInfo> aUndoRes;
+ QList<ActionInfo> aRedoRes;
+ if (anActiveWidget && anActiveWidget->canProcessAction(ActionUndo, isActionEnabled)) {
+ aUndoRes = anActiveWidget->actionsList(ActionUndo);
+ aRedoRes = anActiveWidget->actionsList(ActionRedo);
+ } else {
+ std::list<std::string> aUndoList = ModelAPI_Session::get()->undoList();
+ aUndoRes = processHistoryList(aUndoList);
- std::list<std::string> aRedoList = ModelAPI_Session::get()->redoList();
- QList<ActionInfo> aRedoRes = processHistoryList(aRedoList);
+ std::list<std::string> aRedoList = ModelAPI_Session::get()->redoList();
+ aRedoRes = processHistoryList(aRedoList);
+ }
+ emit updateUndoHistory(aUndoRes);
emit updateRedoHistory(aRedoRes);
}
QDockWidget* aObjDock = createObjectBrowser(aDesktop);
aDesktop->addDockWidget(Qt::LeftDockWidgetArea, aObjDock);
myPropertyPanel = new XGUI_PropertyPanel(aDesktop, myOperationMgr);
+ myActiveControlMgr->addSelector(new XGUI_PropertyPanelSelector(myPropertyPanel));
+
myPropertyPanel->setupActions(myActionsMgr);
myPropertyPanel->setAllowedAreas(Qt::LeftDockWidgetArea |
Qt::RightDockWidgetArea |
Qt::BottomDockWidgetArea);
aDesktop->addDockWidget(Qt::LeftDockWidgetArea, myPropertyPanel);
- hidePropertyPanel(); ///<! Invisible by default
+ hidePanel(myPropertyPanel); ///<! Invisible by default
+
+ myFacesPanel = new XGUI_FacesPanel(aDesktop, myModuleConnector);
+ myActiveControlMgr->addSelector(new XGUI_FacesPanelSelector(myFacesPanel));
+ myFacesPanel->setAllowedAreas(Qt::LeftDockWidgetArea |
+ Qt::RightDockWidgetArea |
+ Qt::BottomDockWidgetArea);
+ connect(myFacesPanel, SIGNAL(closed()), myFacesPanel, SLOT(onClosed()));
+
+ aDesktop->addDockWidget(
+#ifdef HAVE_SALOME
+ Qt::RightDockWidgetArea,
+#else
+ Qt::LeftDockWidgetArea,
+#endif
+ myFacesPanel);
+ hidePanel(myFacesPanel); ///<! Invisible by default
+
+#ifdef _DEBUG
+ bool aShowOnTheRight = Config_PropManager::boolean("Plugins", "show_hide_faces");
+ if (aShowOnTheRight) {
+ aDesktop->addDockWidget(Qt::RightDockWidgetArea, myFacesPanel);
+ showPanel(myFacesPanel);
+ }
+#endif
hideObjectBrowser();
+
+#ifndef HAVE_SALOME
+#ifdef _DEBUG
+ if (!aShowOnTheRight)
+ {
+#endif // _DEBUG
+ aDesktop->tabifyDockWidget(myFacesPanel, aObjDock);
+#ifdef _DEBUG
+ }
+#endif // _DEBUG
+
+#endif // HAVE_SALOME
+
aDesktop->tabifyDockWidget(aObjDock, myPropertyPanel);
myPropertyPanel->installEventFilter(myOperationMgr);
QAction* aOkAct = myActionsMgr->operationStateAction(XGUI_ActionsMgr::Accept);
connect(aOkAct, SIGNAL(triggered()), this, SLOT(onAcceptActionClicked()));
+ QAction* aOkContAct = myActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptPlus);
+ connect(aOkContAct, SIGNAL(triggered()), this, SLOT(onAcceptPlusActionClicked()));
+
QAction* aCancelAct = myActionsMgr->operationStateAction(XGUI_ActionsMgr::Abort);
connect(aCancelAct, SIGNAL(triggered()), myOperationMgr, SLOT(onAbortOperation()));
}
//******************************************************
-void XGUI_Workshop::showPropertyPanel()
+void XGUI_Workshop::showPanel(QDockWidget* theDockWidget)
{
- QAction* aViewAct = myPropertyPanel->toggleViewAction();
- ///<! Restore ability to close panel from the window's menu
- aViewAct->setEnabled(true);
- myPropertyPanel->show();
- myPropertyPanel->raise();
+ if (theDockWidget == myPropertyPanel) {
+ QAction* aViewAct = myPropertyPanel->toggleViewAction();
+ ///<! Restore ability to close panel from the window's menu
+ aViewAct->setEnabled(true);
+ }
+ theDockWidget->show();
+ theDockWidget->raise();
// The next code is necessary to made the property panel the active window
// in order to operation manager could process key events of the panel.
// otherwise they are ignored. It happens only if the same(activateWindow) is
// not happened by property panel activation(e.g. resume operation of Sketch)
- ModuleBase_Tools::setFocus(myPropertyPanel, "XGUI_Workshop::showPropertyPanel()");
+ ModuleBase_Tools::setFocus(theDockWidget, "XGUI_Workshop::showPanel()");
}
//******************************************************
-void XGUI_Workshop::hidePropertyPanel()
+void XGUI_Workshop::hidePanel(QDockWidget* theDockWidget)
{
- QAction* aViewAct = myPropertyPanel->toggleViewAction();
- ///<! Do not allow to show empty property panel
- aViewAct->setEnabled(false);
- myPropertyPanel->hide();
+ if (theDockWidget && theDockWidget == myPropertyPanel) {
+ QAction* aViewAct = theDockWidget->toggleViewAction();
+ ///<! Do not allow to show empty property panel
+ aViewAct->setEnabled(false);
+ }
+ theDockWidget->hide();
// the property panel is active window of the desktop, when it is
// hidden, it is undefined which window becomes active. By this reason
// are processed by this console. For example Undo actions.
// It is possible that this code is to be moved to SHAPER package
QMainWindow* aDesktop = desktop();
- ModuleBase_Tools::setFocus(aDesktop, "XGUI_Workshop::showPropertyPanel()");
+ ModuleBase_Tools::setFocus(aDesktop, "XGUI_Workshop::hidePanel()");
}
//******************************************************
viewer()->eraseAll();
#endif
updateCommandStatus();
+ // Necessary for update icons in ObjectBrowser on Linux
+ myObjectBrowser->updateAllIndexes();
} else if (theId == "SELECT_VERTEX_CMD") {
setViewerSelectionMode(TopAbs_VERTEX);
} else if (theId == "SELECT_EDGE_CMD") {
setViewerSelectionMode(TopAbs_EDGE);
} else if (theId == "SELECT_FACE_CMD") {
setViewerSelectionMode(TopAbs_FACE);
+ } else if (theId == "INSERT_FOLDER_CMD") {
+ insertFeatureFolder();
+ } else if (theId == "ADD_TO_FOLDER_BEFORE_CMD") {
+ insertToFolder(true);
+ } else if (theId == "ADD_TO_FOLDER_AFTER_CMD") {
+ insertToFolder(false);
+ } else if (theId == "ADD_OUT_FOLDER_BEFORE_CMD") {
+ moveOutFolder(true);
+ } else if (theId == "ADD_OUT_FOLDER_AFTER_CMD") {
+ moveOutFolder(false);
} else if (theId == "SELECT_RESULT_CMD") {
//setViewerSelectionMode(-1);
//IMP: an attempt to use result selection with other selection modes
if (!aContext.IsNull())
aParameters.Append(aContext);
+#ifdef DEBUG_WITH_MESSAGE_REPORT
+ Handle(Message_Report) aContextReport = aContext->GetReport();
+ aContext->SetReportActive (Standard_True);
+ aContextReport->SetLimit (1000);
+ if (!aContextReport.IsNull())
+ aParameters.Append(aContextReport);
+#endif
MyVCallBack = new VInspector_CallBack();
myDisplayer->setCallBack(MyVCallBack);
#ifndef HAVE_SALOME
MyTCommunicator->RegisterPlugin("TKDFBrowser");
MyTCommunicator->RegisterPlugin("TKShapeView");
MyTCommunicator->RegisterPlugin("TKVInspector");
+#ifdef DEBUG_WITH_MESSAGE_REPORT
+ MyTCommunicator->RegisterPlugin("TKMessageView");
+#endif
MyTCommunicator->RegisterPlugin("SMBrowser"); // custom plugin to view ModelAPI
//MyTCommunicator->RegisterPlugin("TKSMBrowser"); // custom plugin to view ModelAPI
MyTCommunicator->Init(aParameters);
MyTCommunicator->Activate("TKSMBrowser"); // to have button in TInspector
+#ifndef DEBUG_WITH_MESSAGE_REPORT
MyTCommunicator->Activate("TKVInspector"); // to have filled callback by model
+#endif
MyTCommunicator->Activate("TKDFBrowser");
+
+#ifdef DEBUG_WITH_MESSAGE_REPORT
+ MyTCommunicator->Activate("TKMessageView"); // temporary
+ MyTCommunicator->Activate("TKVInspector"); // to have filled callback by model
+#endif
}
MyTCommunicator->SetVisible(true);
}
else
myViewerSelMode.append(theMode);
}
- activateObjectsSelection(myDisplayer->displayedObjects());
+ selectionActivate()->updateSelectionModes();
}
//**************************************************************
module()->activeSelectionModes(aModes);
if (aModes.isEmpty() && (myViewerSelMode.length() > 0))
aModes.append(myViewerSelMode);
- myDisplayer->activateObjects(aModes, theList);
+ selectionActivate()->activateObjects(aModes, theList);
+}
+
+//**************************************************************
+bool XGUI_Workshop::prepareForDisplay(const std::set<ObjectPtr>& theObjects) const
+{
+ if (facesPanel()->isEmpty())
+ return true;
+
+ // generate container of objects taking into account sub elments of compsolid
+ std::set<ObjectPtr> anAllProcessedObjects;
+ for (std::set<ObjectPtr>::const_iterator anObjectsIt = theObjects.begin();
+ anObjectsIt != theObjects.end(); anObjectsIt++) {
+ ObjectPtr anObject = *anObjectsIt;
+ ResultCompSolidPtr aCompRes = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(anObject);
+ if (aCompRes.get()) {
+ if (aCompRes->numberOfSubs(true) == 0)
+ anAllProcessedObjects.insert(anObject);
+ else {
+ for (int i = 0; i < aCompRes->numberOfSubs(true); i++) {
+ ResultPtr aSubRes = aCompRes->subResult(i, true);
+ anAllProcessedObjects.insert(aCompRes->subResult(i, true));
+ }
+ }
+ }
+ else
+ anAllProcessedObjects.insert(anObject);
+ }
+
+ // find hidden objects in faces panel
+ std::set<ObjectPtr> aHiddenObjects;
+ QStringList aHiddenObjectNames;
+ for (std::set<ObjectPtr>::const_iterator anObjectsIt = anAllProcessedObjects.begin();
+ anObjectsIt != anAllProcessedObjects.end(); anObjectsIt++) {
+ if (!facesPanel()->isObjectHiddenByPanel(*anObjectsIt))
+ continue;
+ aHiddenObjects.insert(*anObjectsIt);
+ aHiddenObjectNames.append((*anObjectsIt)->data()->name().c_str());
+ }
+ if (aHiddenObjects.empty()) // in parameter objects there are no hidden objects in hide face
+ return true;
+
+ int anAnswer = QMessageBox::question(
+ desktop(), tr("Show object"),
+ tr("'%1'\n are hidden by %2:\nRemove objects from the panel to be displayed?")
+ .arg(aHiddenObjectNames.join(' ,')).arg(facesPanel()->windowTitle()),
+ QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
+
+ bool aToBeDisplayed = anAnswer == QMessageBox::Yes;
+ if (aToBeDisplayed)
+ facesPanel()->restoreObjects(aHiddenObjects);
+
+ return aToBeDisplayed;
}
//**************************************************************
bool hasParameter = false;
bool hasCompositeOwner = false;
bool hasResultInHistory = false;
+ bool hasFolder = false;
ModuleBase_Tools::checkObjects(anObjects, hasResult, hasFeature, hasParameter, hasCompositeOwner,
- hasResultInHistory);
- if (!(hasFeature || hasParameter))
+ hasResultInHistory, hasFolder);
+ if (!(hasFeature || hasParameter || hasFolder))
return;
// delete objects
ModuleBase_Tools::convertToFeatures(anObjects, aFeatures);
ModelAPI_Tools::findAllReferences(aFeatures, aReferences);
+ std::set<FolderPtr> aFolders;
+ ModuleBase_Tools::convertToFolders(anObjects, aFolders);
+
bool aDone = false;
QString aDescription = contextMenuMgr()->action("DELETE_CMD")->text() + " %1";
aDescription = aDescription.arg(XGUI_Tools::unionOfObjectNames(anObjects, ", "));
aFeatures.insert(aFeatureRefsToDelete.begin(), aFeatureRefsToDelete.end());
aDone = ModelAPI_Tools::removeFeatures(aFeatures, false);
}
+ if (aFolders.size() > 0) {
+ std::set<FolderPtr>::const_iterator anIt = aFolders.begin(),
+ aLast = aFolders.end();
+ for (; anIt != aLast; anIt++) {
+ FolderPtr aFolder = *anIt;
+ if (aFolder.get()) {
+ DocumentPtr aDoc = aFolder->document();
+ aDoc->removeFolder(aFolder);
+ }
+ }
+ }
+
if (aDone)
operationMgr()->commitOperation();
else
return ModelAPI_Tools::removeFeaturesAndReferences(aFeatures);
}
+//******************************************************
bool hasResults(QObjectPtrList theObjects, const std::set<std::string>& theTypes)
{
bool isFoundResultType = false;
return std::list<FeaturePtr>(aObjectIt, aCurrentIt);
}
+//******************************************************
bool XGUI_Workshop::canMoveFeature()
{
QString anActionId = "MOVE_CMD";
return false;
}
+//******************************************************
void setColor(ResultPtr theResult, const std::vector<int>& theColor)
{
if (!theResult.get())
for (int i = 0; i < aDoc->size(aGroupName); i++) { \
aDoc->object(aGroupName, i)->setDisplayed(aDisplay); \
}
+
+//******************************************************
void XGUI_Workshop::showObjects(const QObjectPtrList& theList, bool isVisible)
{
+ if (isVisible) {
+ std::set<ObjectPtr> anObjects;
+ foreach (ObjectPtr aObj, theList) {
+ anObjects.insert(aObj);
+ }
+ if (!prepareForDisplay(anObjects))
+ return;
+ }
+
foreach (ObjectPtr aObj, theList) {
aObj->setDisplayed(isVisible);
}
Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
-#ifndef WIN32
- // Necessary for update icons in ObjectBrowser on Linux
- QModelIndexList aIndexes = mySelector->selection()->selectedIndexes();
- foreach (QModelIndex aIdx, aIndexes) {
- if (aIdx.column() == 0) {
- myObjectBrowser->treeView()->update(aIdx);
- }
- }
-#endif
+ myObjectBrowser->updateAllIndexes();
}
//**************************************************************
viewer()->eraseAll();
#endif
+ std::set<ObjectPtr> anObjects;
+ foreach (ObjectPtr aObj, theList) {
+ anObjects.insert(aObj);
+ }
+
+ if (!prepareForDisplay(anObjects))
+ return;
+
// Show only objects from the list
foreach (ObjectPtr aObj, theList) {
aObj->setDisplayed(true);
}
Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
-#ifndef WIN32
+
// Necessary for update icons in ObjectBrowser on Linux
- QModelIndexList aIndexes = mySelector->selection()->selectedIndexes();
- foreach (QModelIndex aIdx, aIndexes) {
- if (aIdx.column() == 0) {
- myObjectBrowser->treeView()->update(aIdx);
- }
- }
-#endif
+ myObjectBrowser->updateAllIndexes();
}
-
//**************************************************************
void XGUI_Workshop::registerValidators() const
{
//objectBrowser()->dataModel()->blockEventsProcessing(isBlocked);
}
+//******************************************************
void XGUI_Workshop::addHistoryMenu(QObject* theObject, const char* theSignal, const char* theSlot)
{
XGUI_HistoryMenu* aMenu = NULL;
connect(aMenu, SIGNAL(actionSelected(int)), this, theSlot);
}
+//******************************************************
QList<ActionInfo> XGUI_Workshop::processHistoryList(const std::list<std::string>& theList) const
{
QList<ActionInfo> aResult;
return aResult;
}
+//******************************************************
void XGUI_Workshop::setStatusBarMessage(const QString& theMessage)
{
#ifdef HAVE_SALOME
#endif
}
+#ifdef HAVE_SALOME
+//******************************************************
void XGUI_Workshop::synchronizeViewer()
{
SessionPtr aMgr = ModelAPI_Session::get();
}
}
+//******************************************************
void XGUI_Workshop::synchronizeGroupInViewer(const DocumentPtr& theDoc,
const std::string& theGroup,
bool theUpdateViewer)
if (theUpdateViewer)
myDisplayer->updateViewer();
}
+#endif
+//******************************************************
void XGUI_Workshop::highlightResults(const QObjectPtrList& theObjects)
{
FeaturePtr aFeature;
tr("Results not found"), QMessageBox::Ok);
}
+//******************************************************
void XGUI_Workshop::highlightFeature(const QObjectPtrList& theObjects)
{
ResultPtr aResult;
objectBrowser()->blockSignals(aBlocked);
}
}
+
+void XGUI_Workshop::insertFeatureFolder()
+{
+ QObjectPtrList aObjects = mySelector->selection()->selectedObjects();
+ if (aObjects.isEmpty())
+ return;
+ ObjectPtr aObj = aObjects.first();
+ FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
+ if (aFeature.get() == NULL)
+ return;
+ SessionPtr aMgr = ModelAPI_Session::get();
+ DocumentPtr aDoc = aMgr->activeDocument();
+
+ QString aDescription = contextMenuMgr()->action("INSERT_FOLDER_CMD")->text();
+
+ aMgr->startOperation(aDescription.toStdString());
+ aDoc->addFolder(aFeature);
+ aMgr->finishOperation();
+
+ updateCommandStatus();
+}
+
+
+void XGUI_Workshop::insertToFolder(bool isBefore)
+{
+ std::list<FeaturePtr> aFeatures = mySelector->getSelectedFeatures();
+ if (aFeatures.empty())
+ return;
+
+ SessionPtr aMgr = ModelAPI_Session::get();
+ DocumentPtr aDoc = aMgr->activeDocument();
+
+ FolderPtr aFolder = isBefore? aDoc->findFolderAbove(aFeatures):
+ aDoc->findFolderBelow(aFeatures);
+ if (!aFolder.get())
+ return;
+
+ QString aDescription = contextMenuMgr()->action(
+ isBefore ? "ADD_TO_FOLDER_BEFORE_CMD" : "ADD_TO_FOLDER_AFTER_CMD")->text();
+
+ aMgr->startOperation(aDescription.toStdString());
+ aDoc->moveToFolder(aFeatures, aFolder);
+ aMgr->finishOperation();
+
+ updateCommandStatus();
+}
+
+void XGUI_Workshop::moveOutFolder(bool isBefore)
+{
+ std::list<FeaturePtr> aFeatures = mySelector->getSelectedFeatures();
+ if (aFeatures.empty())
+ return;
+
+ SessionPtr aMgr = ModelAPI_Session::get();
+ DocumentPtr aDoc = aMgr->activeDocument();
+
+
+ QString aDescription = contextMenuMgr()->action(
+ isBefore ? "ADD_OUT_FOLDER_BEFORE_CMD" : "ADD_OUT_FOLDER_AFTER_CMD")->text();
+
+ aMgr->startOperation(aDescription.toStdString());
+ aDoc->removeFromFolder(aFeatures, isBefore);
+ aMgr->finishOperation();
+
+ updateCommandStatus();
+}
#define XGUI_WORKSHOP_H
#include "XGUI.h"
-//#include "XGUI_Constants.h"
-#include <ModuleBase_Definitions.h>
+
#include <ModelAPI_Document.h>
#include <ModelAPI_Feature.h>
#include <ModuleBase_ActionInfo.h>
+#include <ModuleBase_ActionType.h>
+#include <ModuleBase_Definitions.h>
+#include <SelectMgr_ListOfFilter.hxx>
+
+#include <QIcon>
#include <QObject>
-#include <QMap>
#include <QKeySequence>
-#include <QIcon>
+#include <QMap>
#ifndef HAVE_SALOME
-class AppElements_MainWindow;
class AppElements_Command;
+class AppElements_MainWindow;
class AppElements_Workbench;
#endif
+class Config_DataModelReader;
+
class XGUI_ActionsMgr;
+class XGUI_ActiveControlMgr;
class XGUI_ContextMenuMgr;
class XGUI_Displayer;
class XGUI_ErrorDialog;
class XGUI_ErrorMgr;
+class XGUI_FacesPanel;
class XGUI_MenuMgr;
class XGUI_ModuleConnector;
class XGUI_ObjectsBrowser;
class XGUI_PropertyPanel;
class XGUI_SalomeConnector;
class XGUI_SalomeViewer;
+class XGUI_SelectionActivate;
class XGUI_SelectionMgr;
class XGUI_ViewerProxy;
class XGUI_WorkshopListener;
class ModuleBase_IViewer;
class ModuleBase_Operation;
-class QWidget;
+class QAction;
class QDockWidget;
class QMainWindow;
+class QWidget;
-class QAction;
-class Config_DataModelReader;
-
-/**\class XGUI_Workshop
- * \ingroup GUI
- * \brief Class which defines a configuration of the application (Workshop) and launches it.
- */
+/// \class XGUI_Workshop
+/// \ingroup GUI
+/// \brief Class which defines a configuration of the application (Workshop) and launches it.
class XGUI_EXPORT XGUI_Workshop : public QObject
{
Q_OBJECT
XGUI_Workshop(XGUI_SalomeConnector* theConnector = 0);
virtual ~XGUI_Workshop();
- //! Starting of the application
+ /// Starting of the application
void startApplication();
/// Activates the module controls. Should be called after module creation
void deactivateModule();
#ifndef HAVE_SALOME
- //! Returns main window (Desktop) of the application
- AppElements_MainWindow* mainWindow() const
- {
- return myMainWindow;
- }
+ /// Returns main window (Desktop) of the application
+ AppElements_MainWindow* mainWindow() const { return myMainWindow; }
- //! Creates and adds a new workbench (menu group) with the given name and returns it
+ /// Creates and adds a new workbench (menu group) with the given name and returns it
AppElements_Workbench* addWorkbench(const QString& theName);
#endif
- //! Returns selection manager object
- XGUI_SelectionMgr* selector() const
- {
- return mySelector;
- }
-
- //! Returns displayer
- XGUI_Displayer* displayer() const
- {
- return myDisplayer;
- }
-
- //! ! Returns operation manager.
- XGUI_OperationMgr* operationMgr() const
- {
- return myOperationMgr;
- }
-
- //! ! Returns error manager.
- XGUI_ErrorMgr* errorMgr() const
- {
- return myErrorMgr;
- }
-
- //! ! Returns an actions manager
- XGUI_ActionsMgr* actionsMgr() const
- {
- return myActionsMgr;
- }
-
- //! ! Returns an actions manager
- XGUI_MenuMgr* menuMgr() const
- {
- return myMenuMgr;
- }
-
- //! Returns property panel widget
- XGUI_PropertyPanel* propertyPanel() const
- {
- return myPropertyPanel;
- }
-
- //! Returns context menu manager object
- XGUI_ContextMenuMgr* contextMenuMgr() const
- {
- return myContextMenuMgr;
- }
-
- //! Returns an object which provides interface to Salome Module (LightApp_Module)
- XGUI_SalomeConnector* salomeConnector() const
- {
- return mySalomeConnector;
- }
-
- //! Provides an object which provides interface to Salome Viewer
+ /// Returns selection manager object
+ XGUI_SelectionMgr* selector() const { return mySelector; }
+
+ /// Returns selection activating object
+ XGUI_SelectionActivate* selectionActivate() const { return mySelectionActivate; }
+
+ /// Returns displayer
+ XGUI_Displayer* displayer() const { return myDisplayer; }
+
+ /// Returns operation manager.
+ XGUI_OperationMgr* operationMgr() const { return myOperationMgr; }
+
+ /// Returns error manager.
+ XGUI_ErrorMgr* errorMgr() const { return myErrorMgr; }
+
+ /// Returns an actions manager
+ XGUI_ActionsMgr* actionsMgr() const { return myActionsMgr; }
+
+ /// Returns an active control manager
+ XGUI_ActiveControlMgr* activeControlMgr() const { return myActiveControlMgr; }
+
+ /// Returns an actions manager
+ XGUI_MenuMgr* menuMgr() const { return myMenuMgr; }
+
+ /// Returns property panel widget
+ XGUI_PropertyPanel* propertyPanel() const { return myPropertyPanel; }
+
+ /// Returns panel for hide object faces
+ XGUI_FacesPanel* facesPanel() const { return myFacesPanel; }
+
+ /// Returns context menu manager object
+ XGUI_ContextMenuMgr* contextMenuMgr() const { return myContextMenuMgr; }
+
+ /// Returns an object which provides interface to Salome Module (LightApp_Module)
+ XGUI_SalomeConnector* salomeConnector() const { return mySalomeConnector; }
+
+ /// Provides an object which provides interface to Salome Viewer
ModuleBase_IViewer* salomeViewer() const;
- //! Returns true if the application works as SALOME module
- bool isSalomeMode() const
- {
- return mySalomeConnector != 0;
- }
+ /// Returns true if the application works as SALOME module
+ bool isSalomeMode() const { return mySalomeConnector != 0; }
- //! Returns Object browser
- XGUI_ObjectsBrowser* objectBrowser() const
- {
- return myObjectBrowser;
- }
+ /// Returns Object browser
+ XGUI_ObjectsBrowser* objectBrowser() const { return myObjectBrowser; }
/// This method is called by Salome module when selection is changed
void salomeViewerSelectionChanged();
/// Returns viewer which unifies access as to Salome viewer as to standalone viewer
- XGUI_ViewerProxy* viewer() const
- {
- return myViewerProxy;
- }
+ XGUI_ViewerProxy* viewer() const { return myViewerProxy; }
/// Returns the module connector
/// \returns the instance of connector
- XGUI_ModuleConnector* moduleConnector() const
- {
- return myModuleConnector;
- }
+ XGUI_ModuleConnector* moduleConnector() const { return myModuleConnector; }
/// Returns a desktop
/// \return a desktop instance
QMainWindow* desktop() const;
- //! Delete features
+ /// If faces panel made the object hidden, show message box whether the object should be
+ /// restored (removed from the panel) and displayed, if answer is No, returns false
+ /// \param theObject a model object
+ /// \return boolean state if the object should not be displayed
+ virtual bool prepareForDisplay(const std::set<ObjectPtr>& theObjects) const;
+
+ /// Delete features
void deleteObjects();
- //! Searches for selected features unused in other (not selected) features. If one or several
- //! selected features are found, a warning message proposes to delete them. It contains
- //! the list of features to be deleted.
+ /// Searches for selected features unused in other (not selected) features. If one or several
+ /// selected features are found, a warning message proposes to delete them. It contains
+ /// the list of features to be deleted.
void cleanHistory();
- //! Returns true if the selected feature can be moved to the position after the current feature
- //! \return boolean value
+ /// Returns true if the selected feature can be moved to the position after the current feature
+ /// \return boolean value
bool canMoveFeature();
- //! Move selected features to be after the current feature
+ /// Move selected features to be after the current feature
void moveObjects();
- //! Returns true if the object can be shaded. If the object is a compsolid result, the method
- //! checks subobjects of the result
- //! \return boolean value
+ /// Returns true if the object can be shaded. If the object is a compsolid result, the method
+ /// checks subobjects of the result
+ /// \return boolean value
bool canBeShaded(const ObjectPtr& theObject) const;
- //! Returns true if there is at least one selected body/construction/group result
- //! \param theActionName text of the checked action
- //! \return boolean value
+ /// Returns true if there is at least one selected body/construction/group result
+ /// \param theActionName text of the checked action
+ /// \return boolean value
bool canChangeProperty(const QString& theActionName) const;
- //! Change color of the results if it is possible
- //! The operation is available for construction, body and group results
- //! theObjects a list of selected objects
+ /// Change color of the results if it is possible
+ /// The operation is available for construction, body and group results
+ /// theObjects a list of selected objects
void changeColor(const QObjectPtrList& theObjects);
- //! Change deflection of the results if it is possible
- //! The operation is available for construction, body and group results
- //! theObjects a list of selected objects
+ /// Change deflection of the results if it is possible
+ /// The operation is available for construction, body and group results
+ /// theObjects a list of selected objects
void changeDeflection(const QObjectPtrList& theObjects);
- //! Change transparency of the results if it is possible
- //! The operation is available for construction, body and group results
- //! theObjects a list of selected objects
+ /// Change transparency of the results if it is possible
+ /// The operation is available for construction, body and group results
+ /// theObjects a list of selected objects
void changeTransparency(const QObjectPtrList& theObjects);
- //! Show the given features in 3d Viewer
+ /// Show the given features in 3d Viewer
void showObjects(const QObjectPtrList& theList, bool isVisible);
- //! Show the given features in 3d Viewer
+ /// Show the given features in 3d Viewer
void showOnlyObjects(const QObjectPtrList& theList);
/// Set display mode for the given objects
void activateObjectsSelection(const QObjectPtrList& theList);
/// Returns current module
- ModuleBase_IModule* module() const
- {
- return myModule;
- }
+ ModuleBase_IModule* module() const { return myModule; }
/// Returns current directory which contains data files
QString currentDataDir() const { return myCurrentDir; }
/// Returns current directory which contains data files
void setCurrentDataDir(const QString& theDir) { myCurrentDir = theDir; }
- /**
- * Save the current document into a directory
- * \param theName - path to the directory
- * \param theFileNames - returned file names created in this directory
- */
+ /// Save the current document into a directory
+ /// \param theName - path to the directory
+ /// \param theFileNames - returned file names created in this directory
void saveDocument(const QString& theName, std::list<std::string>& theFileNames);
- /**
- * If there is an active (uncommitted) operation shows a prompt to abort it
- * and performs abortion if user agreed. Returns true if
- * - operation aborted successfully
- * - there is no active operation
- */
+ /// If there is an active (uncommitted) operation shows a prompt to abort it
+ /// and performs abortion if user agreed. Returns true if
+ /// - operation aborted successfully
+ /// - there is no active operation
bool abortAllOperations();
/// Updates workshop state according to the started operation, e.g. visualizes the property panel
/// \param theOpertion a started operation
void operationStarted(ModuleBase_Operation* theOperation);
-
- //! Delete features. Delete the referenced features. There can be a question with a list of
- //! referenced objects.
- //! \param theFeatures a list of objects to be deleted
+ /// Delete features. Delete the referenced features. There can be a question with a list of
+ /// referenced objects.
+ /// \param theFeatures a list of objects to be deleted
bool deleteFeatures(const QObjectPtrList& theFeatures);
/// Deactivates the object, if it is active and the module returns that the activation
/// \param theFeature a feature
bool isFeatureOfNested(const FeaturePtr& theFeature);
- //! Shows the message in the status bar
- //! \param theMessage a message
+ /// Shows the message in the status bar
+ /// \param theMessage a message
void setStatusBarMessage(const QString& theMessage);
+#ifdef HAVE_SALOME
/// Has to be called in order to display objects with visibility status = true
void synchronizeViewer();
const std::string& theGroup,
bool theUpdateViewer);
+#endif
/// Update the property panel content by the XML description of the operation and set the panel
/// into the operation
/// \param theOperation an operation
/// It is used for specific processing of Undo/Redo for this command.
static QString MOVE_TO_END_COMMAND;
- //! Closes all in the current session and load the directory
- //! \param theDirectory a path to directory
+ /// Closes all in the current session and load the directory
+ /// \param theDirectory a path to directory
void openDirectory(const QString& theDirectory);
signals:
/// Emitted when selection happens in Salome viewer
void salomeViewerSelection();
- //! the signal about the workshop actions states are updated.
+ /// the signal about the workshop actions states are updated.
void commandStatusUpdated();
- //! the application is started
+ /// the application is started
void applicationStarted();
- //! Signal to update Undo history list
+ /// Signal to update Undo history list
void updateUndoHistory(const QList<ActionInfo>&);
- //! Signal to update Redo history list
+ /// Signal to update Redo history list
void updateRedoHistory(const QList<ActionInfo>&);
public slots:
/// Redo previous command
void onRedo(int times = 1);
- // Rebuild data tree
- //void onRebuild();
-
/// Validates the operation to change the "Apply" button state.
/// \param thePreviousState the previous state of the widget
void onWidgetStateChanged(int thePreviousState);
/// Listens the corresponded signal of model widget and updates Apply button state by feature
void onWidgetObjectUpdated();
- /// Show property panel
- void showPropertyPanel();
+ /// Show dock widget panel
+ void showPanel(QDockWidget* theDockWidget);
- /// Hide property panel
- void hidePropertyPanel();
+ /// Hide dock widget panel
+ void hidePanel(QDockWidget* theDockWidget);
/// Show object Browser
void showObjectBrowser();
void setGrantedFeatures(ModuleBase_Operation* theOperation);
private:
- /// Display all results
- //void displayAllResults();
-
/// Display results from document
/// \param theDoc a document
void displayDocumentResults(DocumentPtr theDoc);
/// Display results from a group
void displayGroupResults(DocumentPtr theDoc, std::string theGroup);
- private slots:
- /// SLOT, that is called after the operation is started. Update workshop state according to
- /// the started operation, e.g. visualizes the property panel and connect to it.
- /// \param theOpertion a started operation
- // void onOperationStarted(ModuleBase_Operation* theOperation);
+ /// Insert folder object before currently selected feature
+ void insertFeatureFolder();
+
+ /// Insert an object to a folder above or below
+ void insertToFolder(bool isBefore);
+
+ /// Insert an object to a folder above or below
+ void moveOutFolder(bool isBefore);
+ private slots:
/// SLOT, that is called after the operation is resumed. Update workshop state according to
/// the started operation, e.g. visualizes the property panel and connect to it.
/// \param theOpertion a resumed operation
/// the operation can be committed and do it if it returns true.
void onAcceptActionClicked();
+ /// Called by OkPlus button clicked in the property panel. Asks the error manager whether
+ /// the operation can be committed and do it if it returns true.
+ void onAcceptPlusActionClicked();
+
/// Called by Preview button clicked in the property panel. Sends signal to model to
/// compute preview.
void onPreviewActionClicked();
private:
- /// Init menu
+ /// Init menu
void initMenu();
/// Register validators
// Creates Dock widgets: Object browser and Property panel
void createDockWidgets();
- //! Extends undo/redo toolbutton's with history menu
- //! \param theObject - in the OpenParts it is a QToolButton by itself,
- //! in salome mode - QAction that creates a button.
- //! \param theSignal - void "updateUndoHistory" or "updateRedoHistory" SIGNAL;
- //! \param theSlot - onUndo(int) or onRedo(int) SLOT
+ /// Extends undo/redo toolbutton's with history menu
+ /// \param theObject - in the OpenParts it is a QToolButton by itself,
+ /// in salome mode - QAction that creates a button.
+ /// \param theSignal - void "updateUndoHistory" or "updateRedoHistory" SIGNAL;
+ /// \param theSlot - onUndo(int) or onRedo(int) SLOT
void addHistoryMenu(QObject* theObject, const char* theSignal, const char* theSlot);
- //! Creates list of actions (commands) by given history list from session
+ /// Creates list of actions (commands) by given history list from session
QList<ActionInfo> processHistoryList(const std::list<std::string>&) const;
+ /// Pefrom Undo/Redo and necessary workshop updates(viewer, browser, actions state)
+ /// \param theActionType a type of the action (Undo or Redo)
+ /// \param theTimes number of applies the given action
+ void processUndoRedo(const ModuleBase_ActionType theActionType, int theTimes);
+
private:
#ifndef HAVE_SALOME
- AppElements_MainWindow* myMainWindow;
+ AppElements_MainWindow* myMainWindow; ///< desktop window
#endif
- ModuleBase_IModule* myModule;
- XGUI_ErrorMgr* myErrorMgr;
- XGUI_ObjectsBrowser* myObjectBrowser;
- XGUI_PropertyPanel* myPropertyPanel;
- XGUI_SelectionMgr* mySelector;
- XGUI_Displayer* myDisplayer;
+ ModuleBase_IModule* myModule; ///< current module
+ XGUI_ErrorMgr* myErrorMgr; ///< updator of error message
+ XGUI_ObjectsBrowser* myObjectBrowser; ///< data tree widget
+ XGUI_PropertyPanel* myPropertyPanel; ///< container of feature attributes widgets
+ XGUI_FacesPanel* myFacesPanel; ///< panel for hide object faces
+ XGUI_SelectionMgr* mySelector; ///< handler of selection processing
+ XGUI_SelectionActivate* mySelectionActivate; /// manager of selection activating
+ XGUI_Displayer* myDisplayer; ///< handler of objects display
XGUI_OperationMgr* myOperationMgr; ///< manager to manipulate through the operations
- XGUI_ActionsMgr* myActionsMgr;
+ XGUI_ActionsMgr* myActionsMgr; ///< manager of workshop actions
+ XGUI_ActiveControlMgr* myActiveControlMgr; ///< manager to have none or one active control
XGUI_MenuMgr* myMenuMgr; ///< manager to build menu/tool bar using order defined in XML
- XGUI_SalomeConnector* mySalomeConnector;
- XGUI_ErrorDialog* myErrorDlg;
- XGUI_ViewerProxy* myViewerProxy;
- XGUI_ContextMenuMgr* myContextMenuMgr;
- XGUI_ModuleConnector* myModuleConnector;
- XGUI_WorkshopListener* myEventsListener;
-
- QString myCurrentDir;
-
- QIntList myViewerSelMode;
-
- Config_DataModelReader* myDataModelXMLReader;
+ XGUI_SalomeConnector* mySalomeConnector; ///< connector to SALOME module interface
+ XGUI_ErrorDialog* myErrorDlg; ///< dialog to show information of occured error events
+ XGUI_ViewerProxy* myViewerProxy; ///< connector to SALOME viewer interface
+ XGUI_ContextMenuMgr* myContextMenuMgr; ///< manager of context menu build
+ XGUI_ModuleConnector* myModuleConnector; ///< implementation of ModuleBase_IWorkshop
+ XGUI_WorkshopListener* myEventsListener; ///< processing of events
+ QString myCurrentDir; ///< cached the last open directory
+ QIntList myViewerSelMode; ///< selection modes set in the viewer
+ Config_DataModelReader* myDataModelXMLReader; ///< XML reader of data model
};
#endif
<file>pictures/button_help.png</file>
<file>pictures/button_ok.png</file>
<file>pictures/button_ok_error.png</file>
+ <file>pictures/button_ok-plus.png</file>
<file>pictures/button_plus.png</file>
<file>pictures/assembly.png</file>
<file>pictures/eyeopen.png</file>
<file>pictures/transparency.png</file>
+ <file>pictures/solid32.png</file>
+ <file>pictures/face32.png</file>
+ <file>pictures/edge32.png</file>
+ <file>pictures/vertex32.png</file>
+ <file>pictures/features_folder.png</file>
+ <file>pictures/create_folder.png</file>
+ <file>pictures/insert_folder_after.png</file>
+ <file>pictures/insert_folder_before.png</file>
+ <file>pictures/move_out_after.png</file>
+ <file>pictures/move_out_before.png</file>
+ <file>pictures/selection.png</file>
</qresource>
</RCC>