src: replaced references to NodeType::Type in GraphViewStyle
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "data/NodeType.h"
|
||||
|
||||
#include "utility/ResourcePaths.h"
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
NodeType::NodeType(Type type)
|
||||
@@ -24,6 +25,13 @@ bool NodeType::isFile() const
|
||||
return ((m_type & mask) > 0);
|
||||
}
|
||||
|
||||
bool NodeType::isNonIndexed() const
|
||||
{
|
||||
const NodeType::TypeMask mask =
|
||||
NodeType::NODE_NON_INDEXED;
|
||||
return ((m_type & mask) > 0);
|
||||
}
|
||||
|
||||
bool NodeType::isInheritable() const
|
||||
{
|
||||
// what about java enums?
|
||||
@@ -54,6 +62,14 @@ bool NodeType::isCallable() const
|
||||
return ((m_type & mask) > 0);
|
||||
}
|
||||
|
||||
bool NodeType::isVariable() const
|
||||
{
|
||||
const NodeType::TypeMask mask =
|
||||
NodeType::NODE_GLOBAL_VARIABLE |
|
||||
NodeType::NODE_FIELD;
|
||||
return ((m_type & mask) > 0);
|
||||
}
|
||||
|
||||
bool NodeType::isUsable() const
|
||||
{
|
||||
const NodeType::TypeMask mask =
|
||||
@@ -102,14 +118,46 @@ bool NodeType::isVisibleAsParentInGraph() const
|
||||
return !isPackage();
|
||||
}
|
||||
|
||||
int NodeType::getFontSizeOffset() const
|
||||
FilePath NodeType::getIconPath() const
|
||||
{
|
||||
switch (m_type)
|
||||
{
|
||||
case NodeType::NODE_NAMESPACE:
|
||||
case NodeType::NODE_PACKAGE:
|
||||
return - 3;
|
||||
// package icon cannot be changed
|
||||
return ResourcePaths::getGuiPath().concat(FilePath("graph_view/images/namespace.png"));
|
||||
case NodeType::NODE_ENUM:
|
||||
return ResourcePaths::getGuiPath().concat(FilePath("graph_view/images/enum.png"));
|
||||
case NodeType::NODE_TYPEDEF:
|
||||
return ResourcePaths::getGuiPath().concat(FilePath("graph_view/images/typedef.png"));
|
||||
case NodeType::NODE_MACRO:
|
||||
return ResourcePaths::getGuiPath().concat(FilePath("graph_view/images/macro.png"));
|
||||
case NodeType::NODE_FILE:
|
||||
return ResourcePaths::getGuiPath().concat(FilePath("graph_view/images/file.png"));
|
||||
default:
|
||||
return FilePath();
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeType::hasIcon() const
|
||||
{
|
||||
const NodeType::TypeMask mask =
|
||||
NodeType::NODE_NAMESPACE |
|
||||
NodeType::NODE_PACKAGE |
|
||||
NodeType::NODE_ENUM |
|
||||
NodeType::NODE_TYPEDEF |
|
||||
NodeType::NODE_FILE |
|
||||
NodeType::NODE_MACRO;
|
||||
return ((m_type & mask) > 0);
|
||||
}
|
||||
|
||||
NodeType::StyleType NodeType::getNodeStyle() const
|
||||
{
|
||||
switch (m_type)
|
||||
{
|
||||
case NodeType::NODE_NAMESPACE:
|
||||
case NodeType::NODE_PACKAGE:
|
||||
return STYLE_PACKAGE;
|
||||
case NodeType::NODE_NON_INDEXED:
|
||||
case NodeType::NODE_TYPE:
|
||||
case NodeType::NODE_BUILTIN_TYPE:
|
||||
@@ -123,14 +171,13 @@ int NodeType::getFontSizeOffset() const
|
||||
case NodeType::NODE_TYPE_PARAMETER:
|
||||
case NodeType::NODE_FILE:
|
||||
case NodeType::NODE_MACRO:
|
||||
return 0;
|
||||
|
||||
return STYLE_BIG_NODE;
|
||||
case NodeType::NODE_FUNCTION:
|
||||
case NodeType::NODE_METHOD:
|
||||
case NodeType::NODE_GLOBAL_VARIABLE:
|
||||
case NodeType::NODE_FIELD:
|
||||
case NodeType::NODE_ENUM_CONSTANT:
|
||||
return - 3;
|
||||
return STYLE_SMALL_NODE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+14
-2
@@ -6,6 +6,7 @@
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
#include "utility/file/FilePath.h"
|
||||
#include "utility/types.h"
|
||||
|
||||
class NodeType
|
||||
@@ -41,6 +42,13 @@ public:
|
||||
NODE_MAX_VALUE = NODE_UNION
|
||||
};
|
||||
|
||||
enum StyleType
|
||||
{
|
||||
STYLE_PACKAGE = 0,
|
||||
STYLE_SMALL_NODE = 1,
|
||||
STYLE_BIG_NODE = 2
|
||||
};
|
||||
|
||||
NodeType(Type type);
|
||||
|
||||
bool operator==(const NodeType& o) const;
|
||||
@@ -48,15 +56,19 @@ public:
|
||||
Type getType() const;
|
||||
|
||||
bool isFile() const;
|
||||
bool isNonIndexed() const;
|
||||
bool isInheritable() const;
|
||||
bool isPackage() const;
|
||||
bool isCallable() const;
|
||||
bool isVariable() const;
|
||||
bool isUsable() const;
|
||||
bool isPotentialMember() const;
|
||||
bool isCollapsible() const;
|
||||
bool isVisibleAsParentInGraph() const;
|
||||
|
||||
int getFontSizeOffset() const;
|
||||
FilePath getIconPath() const;
|
||||
|
||||
bool hasIcon() const;
|
||||
StyleType getNodeStyle() const;
|
||||
|
||||
std::string getUnderscoredTypeString() const;
|
||||
std::string getReadableTypeString() const;
|
||||
|
||||
@@ -90,7 +90,7 @@ NodeType StorageAccessProxy::getNodeTypeForNodeWithId(Id id) const
|
||||
{
|
||||
return m_subject->getNodeTypeForNodeWithId(id);
|
||||
}
|
||||
return NodeType::NODE_NON_INDEXED;
|
||||
return NodeType(NodeType::NODE_NON_INDEXED);
|
||||
}
|
||||
|
||||
Id StorageAccessProxy::getIdForEdge(
|
||||
|
||||
@@ -679,7 +679,7 @@ std::vector<SearchMatch> PersistentStorage::getAutocompletionSymbolMatches(
|
||||
match.searchType = SearchMatch::SEARCH_TOKEN;
|
||||
|
||||
if (storageSymbolMap.find(firstNode->id) == storageSymbolMap.end() &&
|
||||
match.nodeType.getType() != NodeType::NODE_NON_INDEXED)
|
||||
!match.nodeType.isNonIndexed())
|
||||
{
|
||||
match.typeName = "non-indexed " + match.typeName;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user