src: various fixes

* fixed crash when hovering GraphNode while expanding/collapsing it
* fixed clang warnings
* fixed GraphNodeExpandToggle to show empty circle
* fixed Searchbar showing empty block when nothing was parsed
* made template related edges in GraphView red
This commit is contained in:
Eberhard Graether
2015-05-05 23:12:25 +02:00
parent 0763dc9cdf
commit 7dcf8b0bdb
9 changed files with 65 additions and 77 deletions
+5 -2
View File
@@ -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)
@@ -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
@@ -13,7 +13,6 @@ SearchController::~SearchController()
{
}
#include <iostream>
void SearchController::handleMessage(MessageActivateTokens* message)
{
if (!m_ignoreNextMessageActivateTokens && message->tokenIds.size())
+6 -1
View File
@@ -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;
+8 -17
View File
@@ -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<TokenLocationFile> 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<TokenLocationFile> 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<TokenLocationFile> file = std::make_shared<TokenLocationFile>(filePath);
if (parent != child)
{
+1 -22
View File
@@ -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<clang::CXXMethodDecl>(templatedDecl))
{
const clang::CXXMethodDecl* methodDecl = clang::dyn_cast<const clang::CXXMethodDecl>(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());
}