-// Copyright (C) 2014-2021 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023 CEA, EDF
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include <ModelAPI_Events.h>
#include <ModelAPI_AttributeSelectionList.h>
+#include <ModuleBase_Operation.h>
+#include <ModuleBase_OperationFeature.h>
+#include <XGUI_OperationMgr.h>
+
#include <QAction>
#include <QCheckBox>
#include <QFocusEvent>
#include <QMainWindow>
#include <QTimer>
+#ifdef WIN32
+#pragma warning(disable : 4189) // for skipping MAYBE_UNUSED on Win
+#endif
+
static const int LayoutMargin = 3;
//********************************************************************
//********************************************************************
XGUI_FacesPanel::XGUI_FacesPanel(QWidget* theParent, XGUI_Workshop* theWorkshop)
- : QDockWidget(theParent), myWorkshop(theWorkshop), myIsActive(false)
+ : QDockWidget(theParent), myWorkshop(theWorkshop), myIsActive(false), myLastItemIndex(0)
{
setWindowTitle(tr("Hide Faces"));
setObjectName("Hide Faces");
// the selection is cleared by activating selection control
myWorkshop->selector()->clearSelection();
}
- else
+ else{
emit deactivated();
+ myUndoList.clear();
+ }
}
//********************************************************************
myItems.insert(myLastItemIndex, aPrs);
myListView->addItem(aItemName, myLastItemIndex);
+ // add in undo list
+ myUndoList.push_back(myLastItemIndex);
myLastItemIndex++;
isModified = true;
}
bool XGUI_FacesPanel::processDelete()
{
//appendFirstSelectionInHistory();
- QModelIndexList anIndices = myListView->getControl()->selectionModel()->selectedIndexes();
+ //QModelIndexList anIndices = myListView->getControl()->selectionModel()->selectedIndexes();
std::set<int> aSelectedIds;
myListView->getSelectedIndices(aSelectedIds);
reset(true);
}
+//********************************************************************
+
+void XGUI_FacesPanel::processUndo()
+{
+ if(!myUndoList.size())
+ return;
+
+ myListView->selectIndices({myUndoList.back()});
+ processDelete();
+ myUndoList.pop_back();
+}
+
//********************************************************************
void XGUI_FacesPanel::flushRedisplay() const
{