#ifndef HAVE_SALOME
connect(myMainWindow, SIGNAL(exitKeySequence()), SLOT(onExit()));
- onTrihedronVisibilityChanged(true);
+ myDisplayer->displayTrihedron(true);
#endif
connect(myEventsListener, SIGNAL(errorOccurred(std::shared_ptr<Events_InfoMessage>)),
myModule->propertyPanelDefined(theOperation);
#ifndef DEBUG_FEATURE_NAME
- myPropertyPanel->setWindowTitle(theOperation->getDescription()->description());
+ myPropertyPanel->setWindowTitle(ModuleBase_Tools::translate("workshop",
+ theOperation->getDescription()->description().toStdString()));
#else
std::string aFeatureName = aFeature->name();
myPropertyPanel->setWindowTitle(QString("%1: %2")
- .arg(theOperation->getDescription()->description())
- .arg(aFeatureName.c_str()));
+ .arg(translate(theOperation->getDescription()->description()))
+ .arg(translate(aFeatureName.c_str())));
#endif
myErrorMgr->setPropertyPanel(myPropertyPanel);
}
//show file dialog, check if readable and open
- QString aFile = QFileDialog::getOpenFileName(desktop(), tr("Open file"), QString(), MyFilter);
+ qreal aRatio = ModuleBase_Tools::currentPixelRatio();
+ // If the ratio is > 1 (HD screen) then QT has a bug in
+ // displaying of system open file dialog (too small)
+ QString aFile = QFileDialog::getOpenFileName(desktop(), tr("Open file"), QString(), MyFilter,
+ Q_NULLPTR, ((aRatio > 1)? QFileDialog::DontUseNativeDialog : QFileDialog::Options()));
if (!aFile.isNull())
openFile(aFile);
}
void XGUI_Workshop::onTrihedronVisibilityChanged(bool theState)
{
XGUI_Displayer* aDisplayer = displayer();
- if (aDisplayer)
+ if (aDisplayer) {
aDisplayer->displayTrihedron(theState);
+ aDisplayer->updateViewer();
+ }
}
//******************************************************
{
if(!myOperationMgr->abortAllOperations(XGUI_OperationMgr::XGUI_InformationMessage))
return false;
+ qreal aRatio = ModuleBase_Tools::currentPixelRatio();
myCurrentFile = QFileDialog::getSaveFileName(desktop(), tr("Select name to save file..."),
- QString(), MyFilter2);
+ QString(), MyFilter2,
+ Q_NULLPTR, ((aRatio > 1) ? QFileDialog::DontUseNativeDialog : QFileDialog::Options()));
if (!myCurrentFile.isNull()) {
if (!myCurrentFile.endsWith(MyExtension)) {
myCurrentFile += MyExtension;
void XGUI_Workshop::onWidgetObjectUpdated()
{
operationMgr()->onValidateOperation();
+ myDisplayer->updateViewer();
}
//******************************************************
if (!(hasResult || hasFeature || hasParameter || hasFolder))
return;
+ // Remove from the list non-deletable objects: infinite constructions which are not in history
+ bool notDelete = true;
+ QObjectPtrList::iterator aIt;
+ for (aIt = anObjects.begin(); aIt != anObjects.end(); aIt++) {
+ ObjectPtr aObj = (*aIt);
+ ResultConstructionPtr aConstr = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aObj);
+ FeaturePtr aFeature = ModelAPI_Feature::feature(aObj);
+ if (aFeature) {
+ notDelete = (!aFeature->isInHistory()) && aConstr->isInfinite();
+ if (notDelete) {
+ anObjects.removeAll(aObj);
+ aIt--;
+ }
+ }
+ }
// delete objects
std::map<FeaturePtr, std::set<FeaturePtr> > aReferences;
std::set<FeaturePtr> aFeatures;
operationMgr()->commitOperation();
else
operationMgr()->abortOperation(operationMgr()->currentOperation());
+
+ myDisplayer->updateViewer();
}
//**************************************************************
QString anUnusedNames = aNames.join(", ");
QString anActionId = "CLEAN_HISTORY_CMD";
- QString aDescription = contextMenuMgr()->action(anActionId)->text();
+ QString aDescription = ModuleBase_Tools::translate("workshop",
+ contextMenuMgr()->action(anActionId)->text().toStdString());
QMessageBox aMessageBox(desktop());
aMessageBox.setWindowTitle(aDescription);
}
//**************************************************************
+bool compareFeature(const FeaturePtr& theF1, const FeaturePtr& theF2) {
+ DocumentPtr aDoc = theF1->document();
+ return aDoc->index(theF1) < aDoc->index(theF2);
+}
void XGUI_Workshop::moveObjects()
{
if (!abortAllOperations())
SessionPtr aMgr = ModelAPI_Session::get();
- QString anActionId = "MOVE_CMD";
- QString aDescription = contextMenuMgr()->action(anActionId)->text();
- aMgr->startOperation(aDescription.toStdString());
-
QObjectPtrList anObjects = mySelector->selection()->selectedObjects();
// It is necessary to clear selection in order to avoid selection changed event during
// moving and negative consequences connected with processing of already moved items
if (!XGUI_Tools::canRemoveOrRename(desktop(), aFeatures))
return;
+ QString anActionId = "MOVE_CMD";
+ QString aDescription = contextMenuMgr()->action(anActionId)->text();
+ aMgr->startOperation(aDescription.toStdString());
+
+ // Sort features by index in document
+ std::list<FeaturePtr> aFList(aFeatures.begin(), aFeatures.end());
+ aFList.sort(compareFeature);
+
DocumentPtr anActiveDocument = aMgr->activeDocument();
FeaturePtr aCurrentFeature = anActiveDocument->currentFeature(true);
- std::set<FeaturePtr>::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end();
+ std::list<FeaturePtr>::const_iterator anIt = aFList.begin(), aLast = aFList.end();
for (; anIt != aLast; anIt++) {
FeaturePtr aFeature = *anIt;
if (!aFeature.get() || !myModule->canApplyAction(aFeature, anActionId))
aCurrentFeature = anActiveDocument->currentFeature(true);
}
aMgr->finishOperation();
+ updateCommandStatus();
}
//**************************************************************
// 2. show the dialog to change the value
XGUI_PropertyDialog* aDlg = new XGUI_PropertyDialog(desktop());
- aDlg->setWindowTitle("Transparency");
+ aDlg->setWindowTitle(tr("Transparency"));
XGUI_TransparencyWidget* aTransparencyWidget = new XGUI_TransparencyWidget(aDlg);
connect(aTransparencyWidget, SIGNAL(transparencyValueChanged()),
this, SLOT(onTransparencyValueChanged()));