convert enum to enum class to fix -Wgnu-redeclared-enum
This commit is contained in:
@@ -41,7 +41,8 @@ FC_LOG_LEVEL_INIT("MDIView",true,true)
|
||||
using namespace Gui;
|
||||
|
||||
App::DocumentObject *ActiveObjectList::getObject(const ObjectInfo &info, bool resolve,
|
||||
App::DocumentObject **parent, std::string *subname) const
|
||||
App::DocumentObject **parent,
|
||||
std::string *subname) const
|
||||
{
|
||||
if(parent) *parent = info.obj;
|
||||
if(subname) *subname = info.subname;
|
||||
@@ -56,21 +57,22 @@ App::DocumentObject *ActiveObjectList::getObject(const ObjectInfo &info, bool re
|
||||
return resolve?obj->getLinkedObject(true):obj;
|
||||
}
|
||||
|
||||
void ActiveObjectList::setHighlight(const ObjectInfo &info, HighlightMode mode, bool enable) {
|
||||
void ActiveObjectList::setHighlight(const ObjectInfo &info, HighlightMode mode, bool enable)
|
||||
{
|
||||
auto obj = getObject(info,false);
|
||||
if(!obj) return;
|
||||
auto vp = dynamic_cast<ViewProviderDocumentObject*>(Application::Instance->getViewProvider(obj));
|
||||
if(!vp) return;
|
||||
|
||||
if(TreeParams::Instance()->TreeActiveAutoExpand())
|
||||
vp->getDocument()->signalExpandObject(*vp,
|
||||
enable?Gui::ExpandPath:Gui::CollapseItem, info.obj, info.subname.c_str());
|
||||
if (TreeParams::Instance()->TreeActiveAutoExpand()) {
|
||||
vp->getDocument()->signalExpandObject(*vp, enable ? TreeItemMode::ExpandPath : TreeItemMode::CollapseItem,
|
||||
info.obj, info.subname.c_str());
|
||||
}
|
||||
|
||||
vp->getDocument()->signalHighlightObject(*vp, mode,enable,info.obj,info.subname.c_str());
|
||||
}
|
||||
|
||||
Gui::ActiveObjectList::ObjectInfo Gui::ActiveObjectList::getObjectInfo(
|
||||
App::DocumentObject *obj, const char *subname) const
|
||||
Gui::ActiveObjectList::ObjectInfo Gui::ActiveObjectList::getObjectInfo(App::DocumentObject *obj, const char *subname) const
|
||||
{
|
||||
ObjectInfo info;
|
||||
info.obj = 0;
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Gui
|
||||
return dynamic_cast<_T>(getObject(it->second,true,parent,subname));
|
||||
}
|
||||
void setObject(App::DocumentObject*, const char*, const char *subname=0,
|
||||
const Gui::HighlightMode& m = Gui::UserDefined);
|
||||
const Gui::HighlightMode& m = HighlightMode::UserDefined);
|
||||
bool hasObject(const char*)const;
|
||||
void objectDeleted(const ViewProviderDocumentObject& viewProviderIn);
|
||||
bool hasObject(App::DocumentObject *obj, const char *, const char *subname=0) const;
|
||||
|
||||
@@ -1239,7 +1239,7 @@ void Document::RestoreDocFile(Base::Reader &reader)
|
||||
pObj->Restore(*localreader);
|
||||
if (pObj && expanded) {
|
||||
Gui::ViewProviderDocumentObject* vp = static_cast<Gui::ViewProviderDocumentObject*>(pObj);
|
||||
this->signalExpandObject(*vp, Gui::ExpandItem,0,0);
|
||||
this->signalExpandObject(*vp, TreeItemMode::ExpandItem,0,0);
|
||||
}
|
||||
localreader->readEndElement("ViewProvider");
|
||||
}
|
||||
@@ -1475,7 +1475,7 @@ void Document::importObjects(const std::vector<App::DocumentObject*>& obj, Base:
|
||||
if(vpd) vpd->startRestoring();
|
||||
pObj->Restore(*localreader);
|
||||
if (expanded && vpd)
|
||||
this->signalExpandObject(*vpd, Gui::ExpandItem,0,0);
|
||||
this->signalExpandObject(*vpd, TreeItemMode::ExpandItem,0,0);
|
||||
}
|
||||
localreader->readEndElement("ViewProvider");
|
||||
if (it == obj.end())
|
||||
|
||||
@@ -53,7 +53,7 @@ class ViewProviderDocumentObject;
|
||||
class Application;
|
||||
class DocumentPy;
|
||||
class TransactionViewProvider;
|
||||
enum HighlightMode;
|
||||
enum class HighlightMode;
|
||||
|
||||
/** The Gui Document
|
||||
* This is the document on GUI level. Its main responsibility is keeping
|
||||
|
||||
@@ -317,10 +317,10 @@ PyObject* DocumentPy::toggleTreeItem(PyObject *args)
|
||||
Gui::ViewProviderDocumentObject* ActiveVp = dynamic_cast<Gui::ViewProviderDocumentObject*> (getDocumentPtr()->getViewProvider(Object));
|
||||
assert(ActiveVp);
|
||||
switch(mod) {
|
||||
case 0: getDocumentPtr()->signalExpandObject(*ActiveVp,Gui::ToggleItem,parent,subname); break;
|
||||
case 1: getDocumentPtr()->signalExpandObject(*ActiveVp,Gui::CollapseItem,parent,subname); break;
|
||||
case 2: getDocumentPtr()->signalExpandObject(*ActiveVp,Gui::ExpandItem,parent,subname); break;
|
||||
case 3: getDocumentPtr()->signalExpandObject(*ActiveVp,Gui::ExpandPath,parent,subname); break;
|
||||
case 0: getDocumentPtr()->signalExpandObject(*ActiveVp, TreeItemMode::ToggleItem, parent, subname); break;
|
||||
case 1: getDocumentPtr()->signalExpandObject(*ActiveVp, TreeItemMode::CollapseItem, parent, subname); break;
|
||||
case 2: getDocumentPtr()->signalExpandObject(*ActiveVp, TreeItemMode::ExpandItem, parent, subname); break;
|
||||
case 3: getDocumentPtr()->signalExpandObject(*ActiveVp, TreeItemMode::ExpandPath, parent, subname); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2572,7 +2572,7 @@ void TreeWidget::expandSelectedItems(TreeItemMode mode)
|
||||
|
||||
for(auto item : selectedItems()) {
|
||||
switch (mode) {
|
||||
case Gui::ExpandPath: {
|
||||
case TreeItemMode::ExpandPath: {
|
||||
QTreeWidgetItem* parentItem = item->parent();
|
||||
while (parentItem) {
|
||||
parentItem->setExpanded(true);
|
||||
@@ -2581,13 +2581,13 @@ void TreeWidget::expandSelectedItems(TreeItemMode mode)
|
||||
item->setExpanded(true);
|
||||
break;
|
||||
}
|
||||
case Gui::ExpandItem:
|
||||
case TreeItemMode::ExpandItem:
|
||||
item->setExpanded(true);
|
||||
break;
|
||||
case Gui::CollapseItem:
|
||||
case TreeItemMode::CollapseItem:
|
||||
item->setExpanded(false);
|
||||
break;
|
||||
case Gui::ToggleItem:
|
||||
case TreeItemMode::ToggleItem:
|
||||
if (item->isExpanded())
|
||||
item->setExpanded(false);
|
||||
else
|
||||
@@ -2597,8 +2597,8 @@ void TreeWidget::expandSelectedItems(TreeItemMode mode)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TreeWidget::setupText() {
|
||||
void TreeWidget::setupText()
|
||||
{
|
||||
this->headerItem()->setText(0, tr("Labels & Attributes"));
|
||||
this->headerItem()->setText(1, tr("Description"));
|
||||
this->rootItem->setText(0, tr("Application"));
|
||||
@@ -2638,7 +2638,8 @@ void TreeWidget::setupText() {
|
||||
this->recomputeObjectAction->setStatusTip(tr("Recompute the selected object"));
|
||||
}
|
||||
|
||||
void TreeWidget::syncView(ViewProviderDocumentObject *vp) {
|
||||
void TreeWidget::syncView(ViewProviderDocumentObject *vp)
|
||||
{
|
||||
if(currentDocItem && TreeParams::Instance()->SyncView()) {
|
||||
bool focus = hasFocus();
|
||||
currentDocItem->document()->setActiveView(vp);
|
||||
@@ -2647,7 +2648,8 @@ void TreeWidget::syncView(ViewProviderDocumentObject *vp) {
|
||||
}
|
||||
}
|
||||
|
||||
void TreeWidget::onShowHidden() {
|
||||
void TreeWidget::onShowHidden()
|
||||
{
|
||||
if (!this->contextItem) return;
|
||||
DocumentItem *docItem = nullptr;
|
||||
if(this->contextItem->type() == DocumentType)
|
||||
@@ -2658,14 +2660,14 @@ void TreeWidget::onShowHidden() {
|
||||
docItem->setShowHidden(showHiddenAction->isChecked());
|
||||
}
|
||||
|
||||
void TreeWidget::onHideInTree() {
|
||||
void TreeWidget::onHideInTree()
|
||||
{
|
||||
if (this->contextItem && this->contextItem->type() == ObjectType) {
|
||||
auto item = static_cast<DocumentObjectItem*>(contextItem);
|
||||
item->object()->ShowInTree.setValue(!hideInTreeAction->isChecked());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TreeWidget::changeEvent(QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange)
|
||||
@@ -3739,17 +3741,18 @@ void DocumentItem::slotExpandObject (const Gui::ViewProviderDocumentObject& obj,
|
||||
{
|
||||
getTree()->_updateStatus(false);
|
||||
|
||||
if((mode==Gui::ExpandItem||mode==Gui::ExpandPath)
|
||||
&& obj.getDocument()->getDocument()->testStatus(App::Document::Restoring))
|
||||
{
|
||||
if(!_ExpandInfo)
|
||||
if ((mode == TreeItemMode::ExpandItem ||
|
||||
mode == TreeItemMode::ExpandPath) &&
|
||||
obj.getDocument()->getDocument()->testStatus(App::Document::Restoring)) {
|
||||
if (!_ExpandInfo)
|
||||
_ExpandInfo.reset(new ExpandInfo);
|
||||
_ExpandInfo->emplace(std::string("*")+obj.getObject()->getNameInDocument(),ExpandInfoPtr());
|
||||
_ExpandInfo->emplace(std::string("*") + obj.getObject()->getNameInDocument(),ExpandInfoPtr());
|
||||
return;
|
||||
}
|
||||
if(parent && parent->getDocument()!=document()->getDocument()) {
|
||||
|
||||
if (parent && parent->getDocument()!=document()->getDocument()) {
|
||||
auto it = getTree()->DocumentMap.find(Application::Instance->getDocument(parent->getDocument()));
|
||||
if(it!=getTree()->DocumentMap.end())
|
||||
if (it!=getTree()->DocumentMap.end())
|
||||
it->second->slotExpandObject(obj,mode,parent,subname);
|
||||
return;
|
||||
}
|
||||
@@ -3761,7 +3764,7 @@ void DocumentItem::slotExpandObject (const Gui::ViewProviderDocumentObject& obj,
|
||||
assert(item->parent());
|
||||
|
||||
switch (mode) {
|
||||
case Gui::ExpandPath:
|
||||
case TreeItemMode::ExpandPath:
|
||||
if(!parent) {
|
||||
QTreeWidgetItem* parentItem = item->parent();
|
||||
while (parentItem) {
|
||||
@@ -3772,7 +3775,7 @@ void DocumentItem::slotExpandObject (const Gui::ViewProviderDocumentObject& obj,
|
||||
break;
|
||||
}
|
||||
// fall through
|
||||
case Gui::ExpandItem:
|
||||
case TreeItemMode::ExpandItem:
|
||||
if(!parent) {
|
||||
if(item->parent()->isExpanded())
|
||||
item->setExpanded(true);
|
||||
@@ -3789,10 +3792,10 @@ void DocumentItem::slotExpandObject (const Gui::ViewProviderDocumentObject& obj,
|
||||
item->setExpanded(true);
|
||||
}
|
||||
break;
|
||||
case Gui::CollapseItem:
|
||||
case TreeItemMode::CollapseItem:
|
||||
item->setExpanded(false);
|
||||
break;
|
||||
case Gui::ToggleItem:
|
||||
case TreeItemMode::ToggleItem:
|
||||
if (item->isExpanded())
|
||||
item->setExpanded(false);
|
||||
else
|
||||
@@ -4376,25 +4379,25 @@ void DocumentObjectItem::setHighlight(bool set, Gui::HighlightMode high) {
|
||||
};
|
||||
|
||||
switch (high) {
|
||||
case Gui::Bold:
|
||||
case HighlightMode::Bold:
|
||||
f.setBold(set);
|
||||
break;
|
||||
case Gui::Italic:
|
||||
case HighlightMode::Italic:
|
||||
f.setItalic(set);
|
||||
break;
|
||||
case Gui::Underlined:
|
||||
case HighlightMode::Underlined:
|
||||
f.setUnderline(set);
|
||||
break;
|
||||
case Gui::Overlined:
|
||||
case HighlightMode::Overlined:
|
||||
f.setOverline(set);
|
||||
break;
|
||||
case Gui::Blue:
|
||||
case HighlightMode::Blue:
|
||||
highlight(QColor(200,200,255));
|
||||
break;
|
||||
case Gui::LightBlue:
|
||||
case HighlightMode::LightBlue:
|
||||
highlight(QColor(230,230,255));
|
||||
break;
|
||||
case Gui::UserDefined:
|
||||
case HighlightMode::UserDefined:
|
||||
{
|
||||
QColor color(230,230,255);
|
||||
if (set) {
|
||||
@@ -4425,7 +4428,8 @@ void DocumentObjectItem::setHighlight(bool set, Gui::HighlightMode high) {
|
||||
this->setFont(0,f);
|
||||
}
|
||||
|
||||
const char *DocumentObjectItem::getTreeName() const {
|
||||
const char *DocumentObjectItem::getTreeName() const
|
||||
{
|
||||
return myData->getTreeName();
|
||||
}
|
||||
|
||||
@@ -4434,7 +4438,8 @@ Gui::ViewProviderDocumentObject* DocumentObjectItem::object() const
|
||||
return myData->viewObject;
|
||||
}
|
||||
|
||||
void DocumentObjectItem::testStatus(bool resetStatus) {
|
||||
void DocumentObjectItem::testStatus(bool resetStatus)
|
||||
{
|
||||
QIcon icon,icon2;
|
||||
testStatus(resetStatus,icon,icon2);
|
||||
}
|
||||
|
||||
@@ -49,20 +49,22 @@ typedef std::shared_ptr<DocumentObjectData> DocumentObjectDataPtr;
|
||||
class DocumentItem;
|
||||
|
||||
/// highlight modes for the tree items
|
||||
enum HighlightMode { Underlined,
|
||||
Italic,
|
||||
Overlined,
|
||||
Bold,
|
||||
Blue,
|
||||
LightBlue,
|
||||
UserDefined
|
||||
enum class HighlightMode {
|
||||
Underlined,
|
||||
Italic,
|
||||
Overlined,
|
||||
Bold,
|
||||
Blue,
|
||||
LightBlue,
|
||||
UserDefined
|
||||
};
|
||||
|
||||
/// highlight modes for the tree items
|
||||
enum TreeItemMode { ExpandItem,
|
||||
ExpandPath,
|
||||
CollapseItem,
|
||||
ToggleItem
|
||||
enum class TreeItemMode {
|
||||
ExpandItem,
|
||||
ExpandPath,
|
||||
CollapseItem,
|
||||
ToggleItem
|
||||
};
|
||||
|
||||
|
||||
@@ -417,7 +419,7 @@ public:
|
||||
// subname in selection
|
||||
int getSubName(std::ostringstream &str, App::DocumentObject *&topParent) const;
|
||||
|
||||
void setHighlight(bool set, Gui::HighlightMode mode = Gui::LightBlue);
|
||||
void setHighlight(bool set, HighlightMode mode = HighlightMode::LightBlue);
|
||||
|
||||
const char *getName() const;
|
||||
const char *getTreeName() const;
|
||||
|
||||
@@ -83,7 +83,7 @@ private:
|
||||
Py::Object setActiveAnalysis(const Py::Tuple& args)
|
||||
{
|
||||
if (FemGui::ActiveAnalysisObserver::instance()->hasActiveObject()) {
|
||||
FemGui::ActiveAnalysisObserver::instance()->highlightActiveObject(Gui::Blue,false);
|
||||
FemGui::ActiveAnalysisObserver::instance()->highlightActiveObject(Gui::HighlightMode::Blue,false);
|
||||
FemGui::ActiveAnalysisObserver::instance()->setActiveObject(0);
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ private:
|
||||
|
||||
// get the gui document of the Analysis Item
|
||||
FemGui::ActiveAnalysisObserver::instance()->setActiveObject(static_cast<Fem::FemAnalysis*>(obj));
|
||||
FemGui::ActiveAnalysisObserver::instance()->highlightActiveObject(Gui::Blue,true);
|
||||
FemGui::ActiveAnalysisObserver::instance()->highlightActiveObject(Gui::HighlightMode::Blue,true);
|
||||
}
|
||||
|
||||
return Py::None();
|
||||
|
||||
Reference in New Issue
Block a user