ui: Added on-screen search feature (issue #79)

* Use menu action "Edit -> Find in View" or Ctrl + D
* UI displayed as search bar at bottom of main window
* Hide search bar with ECS or close button
* Entering a query searches in name of graph nodes and code contents of code view
* Use Enter to iterate through matches, well move match into view in graph and code view
* Checkboxes allow for adding/removing results for certain views
* Create Bookmark shortcut is now CTRL + S

bug id = 79
This commit is contained in:
Eberhard Graether
2017-09-19 14:00:40 +02:00
parent 4731f379f4
commit 95ef8c3eec
64 changed files with 1642 additions and 174 deletions
+24
View File
@@ -22,6 +22,7 @@ float GraphViewStyle::s_zoomFactor;
std::map<std::string, GraphViewStyle::NodeColor> GraphViewStyle::s_nodeColors;
std::map<std::string, std::string> GraphViewStyle::s_edgeColors;
std::map<bool, GraphViewStyle::NodeColor> GraphViewStyle::s_screenMatchColors;
Vec2i GraphViewStyle::alignOnRaster(Vec2i position)
{
@@ -142,6 +143,7 @@ void GraphViewStyle::loadStyleSettings()
s_nodeColors.clear();
s_edgeColors.clear();
s_screenMatchColors.clear();
s_gridCellPadding = getImpl()->getCharHeightForNodeType(Node::NODE_TYPE) - 8;
s_gridCellSize = s_gridCellPadding / 2;
@@ -713,6 +715,28 @@ const std::string& GraphViewStyle::getEdgeColor(const std::string& typeStr, bool
return s_edgeColors.find(type)->second;
}
const GraphViewStyle::NodeColor& GraphViewStyle::getScreenMatchColor(bool focus)
{
auto it = s_screenMatchColors.find(focus);
if (it != s_screenMatchColors.end())
{
return it->second;
}
NodeColor color;
ColorScheme* scheme = ColorScheme::getInstance().get();
ColorScheme::ColorState state = focus ? ColorScheme::FOCUS : ColorScheme::NORMAL;
color.fill = scheme->getCodeAnnotationTypeColor("screen_search", "fill", state);
color.border = scheme->getCodeAnnotationTypeColor("screen_search", "border", state);
color.text = scheme->getCodeAnnotationTypeColor("screen_search", "text", state);
s_screenMatchColors.emplace(focus, color);
return s_screenMatchColors.find(focus)->second;
}
void GraphViewStyle::addIcon(Node::NodeType type, bool hasChildren, NodeStyle* style)
{
switch (type)