diff --git a/src/app/qt/view/QtGraphView.cpp b/src/app/qt/view/QtGraphView.cpp index 04322aa2..c8c090a6 100644 --- a/src/app/qt/view/QtGraphView.cpp +++ b/src/app/qt/view/QtGraphView.cpp @@ -100,6 +100,16 @@ void QtGraphView::switchToNewGraphData() { m_oldGraph = m_graph; + for (const std::shared_ptr& node : m_oldNodes) + { + node->hide(); + } + + for (const std::shared_ptr& edge : m_oldEdges) + { + edge->hide(); + } + m_oldNodes = m_nodes; m_oldEdges = m_edges; diff --git a/src/app/qt/view/graphElements/QtGraphNodeExpandToggle.cpp b/src/app/qt/view/graphElements/QtGraphNodeExpandToggle.cpp index f4cb9703..6e6ee040 100644 --- a/src/app/qt/view/graphElements/QtGraphNodeExpandToggle.cpp +++ b/src/app/qt/view/graphElements/QtGraphNodeExpandToggle.cpp @@ -1,5 +1,6 @@ #include "qt/view/graphElements/QtGraphNodeExpandToggle.h" +#include "utility/logging/logging.h" #include "utility/messaging/type/MessageGraphNodeExpand.h" #include "qt/graphics/QtRoundedRectItem.h" @@ -8,31 +9,29 @@ QtGraphNodeExpandToggle::QtGraphNodeExpandToggle(bool expanded, int invisibleSubNodeCount) : m_allVisible(invisibleSubNodeCount == 0) { + if (!expanded && !invisibleSubNodeCount) + { + LOG_ERROR("ExpandToggle shouldn't be visible"); + return; + } + const int iconHeight = 4; m_icon = new QGraphicsPixmapItem(this); - if (!expanded && !invisibleSubNodeCount) + QtDeviceScaledPixmap pixmap("data/gui/graph_view/images/arrow.png"); + pixmap.scaleToHeight(iconHeight); + + if (invisibleSubNodeCount) { - this->hide(); - return; + QString numberStr = QString::number(invisibleSubNodeCount); + m_text->setText(numberStr); } else { - QtDeviceScaledPixmap pixmap("data/gui/graph_view/images/arrow.png"); - pixmap.scaleToHeight(iconHeight); - - if (invisibleSubNodeCount) - { - QString numberStr = QString::number(invisibleSubNodeCount); - m_text->setText(numberStr); - } - else - { - pixmap.mirror(); - } - - m_icon->setPixmap(pixmap.pixmap()); + pixmap.mirror(); } + + m_icon->setPixmap(pixmap.pixmap()); } QtGraphNodeExpandToggle::~QtGraphNodeExpandToggle() diff --git a/src/lib/Application.cpp b/src/lib/Application.cpp index 4655afbc..2dddfdae 100644 --- a/src/lib/Application.cpp +++ b/src/lib/Application.cpp @@ -99,12 +99,15 @@ void Application::handleMessage(MessageFinishedParsing* message) Id mainId = m_storageAccessProxy->getIdForNodeWithName("main"); - if (!mainId) + if (!mainId && m_storageAccessProxy->getNameForNodeWithId(1).size() > 0) { mainId = 1; } - MessageActivateTokens(mainId).dispatch(); + if (mainId) + { + MessageActivateTokens(mainId).dispatch(); + } } void Application::handleMessage(MessageLoadProject* message) diff --git a/src/lib/component/controller/GraphController.cpp b/src/lib/component/controller/GraphController.cpp index 86ebbfa1..8db8ed7d 100644 --- a/src/lib/component/controller/GraphController.cpp +++ b/src/lib/component/controller/GraphController.cpp @@ -523,7 +523,10 @@ void GraphController::addExpandToggleNode(DummyNode& node) const } } - node.subNodes.push_back(expandNode); + if (expandNode.isExpanded() || expandNode.invisibleSubNodeCount) + { + node.subNodes.push_back(expandNode); + } } void GraphController::layoutToGrid(DummyNode& node) const diff --git a/src/lib/component/controller/SearchController.cpp b/src/lib/component/controller/SearchController.cpp index b031054d..28a1eafb 100644 --- a/src/lib/component/controller/SearchController.cpp +++ b/src/lib/component/controller/SearchController.cpp @@ -13,7 +13,6 @@ SearchController::~SearchController() { } -#include void SearchController::handleMessage(MessageActivateTokens* message) { if (!m_ignoreNextMessageActivateTokens && message->tokenIds.size()) diff --git a/src/lib/component/view/GraphViewStyle.cpp b/src/lib/component/view/GraphViewStyle.cpp index 1f087887..c7de69fb 100644 --- a/src/lib/component/view/GraphViewStyle.cpp +++ b/src/lib/component/view/GraphViewStyle.cpp @@ -407,7 +407,12 @@ GraphViewStyle::EdgeStyle GraphViewStyle::getStyleForEdgeType(Edge::EdgeType typ case Edge::EDGE_INCLUDE: style.color = "#87BA50"; break; - + case Edge::EDGE_TEMPLATE_PARAMETER_OF: + case Edge::EDGE_TEMPLATE_ARGUMENT_OF: + case Edge::EDGE_TEMPLATE_DEFAULT_ARGUMENT_OF: + case Edge::EDGE_TEMPLATE_SPECIALIZATION_OF: + style.color = "#DD0000"; + break; default: style.color = "#878787"; break; diff --git a/src/lib/data/Storage.cpp b/src/lib/data/Storage.cpp index 42025232..4cd53f0d 100644 --- a/src/lib/data/Storage.cpp +++ b/src/lib/data/Storage.cpp @@ -547,12 +547,10 @@ Id Storage::onTemplateArgumentTypeParsed( Node* argumentNode = addNodeHierarchy(Node::NODE_UNDEFINED_TYPE, argumentNameHierarchy); Node* templateNode = addNodeHierarchy(Node::NODE_UNDEFINED_TYPE, templateNameHierarchy); - m_graph.createEdge(Edge::EDGE_TEMPLATE_ARGUMENT_OF, argumentNode, templateNode); + Edge* argumentOfEdge = m_graph.createEdge(Edge::EDGE_TEMPLATE_ARGUMENT_OF, argumentNode, templateNode); - if (location.isValid()) - { - addTokenLocation(argumentNode, location); - } + addTokenLocation(argumentNode, location); + addTokenLocation(argumentOfEdge, location); return argumentNode->getId(); } @@ -1060,14 +1058,9 @@ std::shared_ptr Storage::getTokenLocationOfParentScope(const const TokenLocation* parent = child; const FilePath filePath = child->getFilePath(); const TokenLocationFile* locationFile = m_locationCollection.findTokenLocationFileByPath(child->getFilePath()); - locationFile->forEachTokenLocation( + locationFile->forEachStartTokenLocation( [&](TokenLocation* tokenLocation) -> void { - if (tokenLocation->isStartTokenLocation()) - { - TokenLocation::LocationType lt = tokenLocation->getType(); - int sln = tokenLocation->getLineNumber(); - int eln = tokenLocation->getEndTokenLocation()->getLineNumber(); if (tokenLocation->getType() == TokenLocation::LOCATION_SCOPE && tokenLocation->isStartTokenLocation() && (*tokenLocation) < *(child->getStartTokenLocation()) && @@ -1077,17 +1070,15 @@ std::shared_ptr Storage::getTokenLocationOfParentScope(const { parent = tokenLocation; } - else + // since tokenLocation is a start location the > location indicates the scope that is closer to the child. + else if ((*tokenLocation) > *parent) { - if ((*tokenLocation) > *parent) // since tokenLocation is a start location the > location indiceates the scope that is closer to the child. - { - parent = tokenLocation; - } + parent = tokenLocation; } } - } } ); + std::shared_ptr file = std::make_shared(filePath); if (parent != child) { diff --git a/src/lib/data/parser/cxx/ASTVisitor.cpp b/src/lib/data/parser/cxx/ASTVisitor.cpp index 62b39c8f..6e5a9914 100644 --- a/src/lib/data/parser/cxx/ASTVisitor.cpp +++ b/src/lib/data/parser/cxx/ASTVisitor.cpp @@ -918,26 +918,5 @@ ParseFunction ASTVisitor::getParseFunction(const clang::FunctionDecl* declaratio ParseFunction ASTVisitor::getParseFunction(const clang::FunctionTemplateDecl* declaration) const { - bool isStatic = false; - bool isConst = false; - - const clang::FunctionDecl* templatedDecl = declaration->getTemplatedDecl(); - if (clang::isa(templatedDecl)) - { - const clang::CXXMethodDecl* methodDecl = clang::dyn_cast(templatedDecl); - isStatic = methodDecl->isStatic(); - isConst = methodDecl->isConst(); - } - else - { - isStatic = templatedDecl->getStorageClass() == clang::SC_Static; - } - - return ParseFunction( - getParseTypeUsageOfReturnType(templatedDecl), - utility::getDeclNameHierarchy(declaration), - getParameters(templatedDecl), - isStatic, - isConst - ); + return getParseFunction(declaration->getTemplatedDecl()); } diff --git a/src/test/CxxParserTestSuite.h b/src/test/CxxParserTestSuite.h index 806a47f9..584c052c 100644 --- a/src/test/CxxParserTestSuite.h +++ b/src/test/CxxParserTestSuite.h @@ -2437,22 +2437,21 @@ public: TS_ASSERT_EQUALS(client->errors[0], "use of undeclared identifier \'b\' <1:9 1:9>"); } - - void ___test_TEST() - { - std::shared_ptr client = parseCode( - "template class> class T>\n" - "class A {\n" - "T<>\n" - "};\n" - "template class T>\n" - "class B {};\n" - "template \n" - "class C {};\n" - "A a;\n" - ); - int ofo = 0; - } + // void ___test_TEST() + // { + // std::shared_ptr client = parseCode( + // "template class> class T>\n" + // "class A {\n" + // "T<>\n" + // "};\n" + // "template class T>\n" + // "class B {};\n" + // "template \n" + // "class C {};\n" + // "A a;\n" + // ); + // int ofo = 0; + // } private: class TestParserClient: public ParserClient