ui: new colors and other ui improvements
* smoothing for edge lines * fixed activation of token not working when multiple tokens active * changed inheritance arrow * thicker width for edges on focus
This commit is contained in:
@@ -32,9 +32,6 @@
|
||||
<FontName><!-- STRING: name of the font used for source view --></FontName> <!-- DEPRECATED -->
|
||||
<FontSize><!-- INTEGER: size of the font in the source view --></FontSize> <!-- DEPRECATED -->
|
||||
|
||||
<LinkColor><!-- COLOR: color of clickable elements in the source view --></LinkColor>
|
||||
<ScopeColor><!-- COLOR: color of clickable scopes in the source view --></ScopeColor>
|
||||
<ActiveLinkColor><!-- COLOR: color of active elements or scopes in the source view --></ActiveLinkColor>
|
||||
<snippet>
|
||||
<snap_range><!-- INTEGER: max amount of lines that the current snippet will be extended to snap to scope start/end --></snap_range>
|
||||
<expand_range><!-- INTEGER: amount of lines that the snippet range (not snapped) will be extended --></expand_range>
|
||||
@@ -44,8 +41,8 @@
|
||||
<colors>
|
||||
<!-- QueryNodeType -->
|
||||
<command>
|
||||
<normal>#FFE47A</normal>
|
||||
<hover>#FFCC00</hover>
|
||||
<normal>#8FBC92</normal>
|
||||
<hover>#5EA071</hover>
|
||||
</command>
|
||||
<operator>
|
||||
<normal>#FCA47E</normal>
|
||||
@@ -65,32 +62,32 @@
|
||||
<hover>#ededed</hover>
|
||||
</enum>
|
||||
<function>
|
||||
<normal>#ffe47a</normal>
|
||||
<hover>#ffcc00</hover>
|
||||
<normal>#F4D07D</normal>
|
||||
<hover>#F4BC3D</hover>
|
||||
</function>
|
||||
<method>
|
||||
<normal>#ffe47a</normal>
|
||||
<hover>#ffcc00</hover>
|
||||
<normal>#F4D07D</normal>
|
||||
<hover>#F4BC3D</hover>
|
||||
</method>
|
||||
<field>
|
||||
<normal>#9ab4ad</normal>
|
||||
<hover>#62b29d</hover>
|
||||
<normal>#6DA1BC</normal>
|
||||
<hover>#3190BA</hover>
|
||||
</field>
|
||||
<global>
|
||||
<normal>#9ab4ad</normal>
|
||||
<hover>#62b29d</hover>
|
||||
<normal>#6DA1BC</normal>
|
||||
<hover>#3190BA</hover>
|
||||
</global>
|
||||
<undefined>
|
||||
<normal>#00000000</normal>
|
||||
<hover>#00000000</hover>
|
||||
</undefined>
|
||||
<undefined_variable>
|
||||
<normal>#9ab4ad</normal>
|
||||
<hover>#62b29d</hover>
|
||||
<normal>#6DA1BC</normal>
|
||||
<hover>#3190BA</hover>
|
||||
</undefined_variable>
|
||||
<undefined_function>
|
||||
<normal>#ffe47a</normal>
|
||||
<hover>#ffcc00</hover>
|
||||
<normal>#F4D07D</normal>
|
||||
<hover>#F4BC3D</hover>
|
||||
</undefined_function>
|
||||
<undefined_type>
|
||||
<normal>#ededed</normal>
|
||||
@@ -105,16 +102,16 @@
|
||||
<hover>#ededed</hover>
|
||||
</typedef>
|
||||
<enum_constant>
|
||||
<normal>#9ab4ad</normal>
|
||||
<hover>#62b29d</hover>
|
||||
<normal>#6DA1BC</normal>
|
||||
<hover>#3190BA</hover>
|
||||
</enum_constant>
|
||||
<template_parameter_type>
|
||||
<normal>#ededed</normal>
|
||||
<hover>#ededed</hover>
|
||||
</template_parameter_type>
|
||||
<file>
|
||||
<normal>#A3BA8A</normal>
|
||||
<hover>#87BA50</hover>
|
||||
<normal>#88BAB3</normal>
|
||||
<hover>#6AA39B</hover>
|
||||
</file>
|
||||
</colors>
|
||||
</config>
|
||||
|
||||
@@ -191,21 +191,17 @@ void QtCodeArea::paintEvent(QPaintEvent* event)
|
||||
int top = blockBoundingGeometry(block).translated(contentOffset()).top();
|
||||
int blockHeight = blockBoundingRect(block).height();
|
||||
|
||||
Colori color = ApplicationSettings::getInstance()->getCodeScopeColor();
|
||||
Colori colorFocused = ApplicationSettings::getInstance()->getCodeActiveLinkColor();
|
||||
colorFocused.a /= 2;
|
||||
|
||||
QColor qColor;
|
||||
|
||||
for (const ScopeAnnotation& scope : m_scopeAnnotations)
|
||||
{
|
||||
if (scope.isFocused)
|
||||
{
|
||||
qColor.setRgb(colorFocused.r, colorFocused.g, colorFocused.b, colorFocused.a);
|
||||
qColor = QColor("#90E4EEF2");
|
||||
}
|
||||
else
|
||||
{
|
||||
qColor.setRgb(color.r, color.g, color.b, color.a);
|
||||
qColor = QColor("#60E4EEF2");
|
||||
}
|
||||
|
||||
painter.fillRect(
|
||||
@@ -245,13 +241,7 @@ void QtCodeArea::mouseReleaseEvent(QMouseEvent* event)
|
||||
|
||||
if (annotation)
|
||||
{
|
||||
const std::vector<Id>& ids = m_fileWidget->getActiveTokenIds();
|
||||
bool isActive = std::find(ids.begin(), ids.end(), annotation->tokenId) != ids.end();
|
||||
|
||||
if (!isActive)
|
||||
{
|
||||
MessageActivateTokenLocation(annotation->locationId).dispatch();
|
||||
}
|
||||
MessageActivateTokenLocation(annotation->locationId).dispatch();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -409,14 +399,15 @@ void QtCodeArea::createAnnotations(std::shared_ptr<TokenLocationFile> locationFi
|
||||
|
||||
void QtCodeArea::annotateText()
|
||||
{
|
||||
Colori color;
|
||||
Id focusedTokenId = m_fileWidget->getFocusedTokenId();
|
||||
const std::vector<Id>& ids = m_fileWidget->getActiveTokenIds();
|
||||
const std::vector<std::string>& errorMessages = m_fileWidget->getErrorMessages();
|
||||
QList<QTextEdit::ExtraSelection> extraSelections;
|
||||
|
||||
std::vector<ScopeAnnotation> scopeAnnotations;
|
||||
|
||||
QColor color;
|
||||
QList<QTextEdit::ExtraSelection> extraSelections;
|
||||
|
||||
for (const Annotation& annotation: m_annotations)
|
||||
{
|
||||
bool isActive = std::find(ids.begin(), ids.end(), annotation.tokenId) != ids.end();
|
||||
@@ -424,23 +415,23 @@ void QtCodeArea::annotateText()
|
||||
|
||||
if (&annotation == m_hoveredAnnotation && errorMessages.size())
|
||||
{
|
||||
color = Colori(255, 0, 0, 128);
|
||||
color.setNamedColor("#80FF0000");
|
||||
}
|
||||
else if (errorMessages.size())
|
||||
{
|
||||
color = Colori(255, 0, 0, 255);
|
||||
color.setNamedColor("#FFFF0000");
|
||||
}
|
||||
else if (isActive || isFocused)
|
||||
{
|
||||
color = ApplicationSettings::getInstance()->getCodeActiveLinkColor();
|
||||
color.setNamedColor("#90B6D1DD");
|
||||
}
|
||||
else
|
||||
{
|
||||
color = ApplicationSettings::getInstance()->getCodeLinkColor();
|
||||
color.setNamedColor("#90EBEBEB");
|
||||
}
|
||||
|
||||
QTextEdit::ExtraSelection selection;
|
||||
selection.format.setBackground(QColor(color.r, color.g, color.b, color.a));
|
||||
selection.format.setBackground(color);
|
||||
|
||||
ScopeAnnotation scopeAnnotation;
|
||||
|
||||
|
||||
@@ -31,11 +31,11 @@ QtHighlighter::QtHighlighter(QTextDocument *parent)
|
||||
|
||||
QColor directiveColor = QColor(27,136,86);
|
||||
QColor keywordColor = QColor(27,136,86);
|
||||
QColor typeColor = QColor(208,93,24);
|
||||
QColor typeColor = QColor("#C1492D");
|
||||
QColor commentColor = Qt::gray;
|
||||
QColor numberColor = QColor(153,22,165);
|
||||
QColor quotationColor = QColor(63,169,245);
|
||||
QColor functionColor = QColor(172,150,0);
|
||||
QColor numberColor = QColor("#C1315E");
|
||||
QColor quotationColor = QColor("#865F9E");
|
||||
QColor functionColor = QColor("#CC9533");
|
||||
|
||||
foreach (const QString &pattern, keywordPatterns)
|
||||
{
|
||||
|
||||
@@ -56,6 +56,7 @@ void QtGraphView::initView()
|
||||
QGraphicsView* view = new QGraphicsView(widget);
|
||||
view->setScene(scene);
|
||||
view->setDragMode(QGraphicsView::ScrollHandDrag);
|
||||
view->setRenderHints(QPainter::Antialiasing);
|
||||
|
||||
widget->layout()->addWidget(view);
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ void QtGraphEdge::onClick()
|
||||
message.isAggregation = true;
|
||||
message.dispatch();
|
||||
}
|
||||
else if (!m_isActive)
|
||||
else
|
||||
{
|
||||
MessageActivateTokens message(getData()->getId());
|
||||
message.isEdge = true;
|
||||
|
||||
@@ -35,7 +35,7 @@ Id QtGraphNodeData::getTokenId() const
|
||||
|
||||
void QtGraphNodeData::onClick()
|
||||
{
|
||||
if (!m_isActive && !m_data->isType(Node::NODE_UNDEFINED | Node::NODE_NAMESPACE))
|
||||
if (!m_data->isType(Node::NODE_UNDEFINED | Node::NODE_NAMESPACE))
|
||||
{
|
||||
MessageActivateTokens(m_data->getId()).dispatch();
|
||||
}
|
||||
|
||||
@@ -265,7 +265,6 @@ GraphViewStyle::NodeStyle GraphViewStyle::getStyleForNodeType(
|
||||
case Node::NODE_ENUM:
|
||||
case Node::NODE_TYPEDEF:
|
||||
case Node::NODE_TEMPLATE_PARAMETER_TYPE:
|
||||
case Node::NODE_FILE:
|
||||
if (isActive)
|
||||
{
|
||||
style.fontBold = true;
|
||||
@@ -295,6 +294,17 @@ GraphViewStyle::NodeStyle GraphViewStyle::getStyleForNodeType(
|
||||
}
|
||||
break;
|
||||
|
||||
case Node::NODE_FILE:
|
||||
if (isActive)
|
||||
{
|
||||
style.fontBold = true;
|
||||
}
|
||||
|
||||
style.cornerRadius = 6;
|
||||
style.textOffset.x = 8;
|
||||
style.textOffset.y = 8;
|
||||
break;
|
||||
|
||||
case Node::NODE_UNDEFINED_FUNCTION:
|
||||
case Node::NODE_UNDEFINED_VARIABLE:
|
||||
style.undefinedPattern = true;
|
||||
@@ -361,7 +371,7 @@ GraphViewStyle::EdgeStyle GraphViewStyle::getStyleForEdgeType(Edge::EdgeType typ
|
||||
{
|
||||
EdgeStyle style;
|
||||
|
||||
style.width = isActive ? 2 : 1;
|
||||
style.width = isActive ? 3 : 1;
|
||||
style.zValue = isActive ? 5 : 1;
|
||||
|
||||
style.arrowLength = 5;
|
||||
@@ -386,33 +396,35 @@ GraphViewStyle::EdgeStyle GraphViewStyle::getStyleForEdgeType(Edge::EdgeType typ
|
||||
break;
|
||||
|
||||
case Edge::EDGE_CALL:
|
||||
style.color = "#F1C100";
|
||||
style.color = "#F4BC3D";
|
||||
style.originOffset.y = 1;
|
||||
style.targetOffset.y = -1;
|
||||
style.verticalOffset = 4;
|
||||
break;
|
||||
case Edge::EDGE_USAGE:
|
||||
style.color = "#62B29D";
|
||||
style.color = "#3190BA";
|
||||
style.originOffset.y = 3;
|
||||
style.targetOffset.y = -3;
|
||||
style.verticalOffset = 6;
|
||||
break;
|
||||
case Edge::EDGE_INHERITANCE:
|
||||
style.arrowLength = 15;
|
||||
style.arrowWidth = 20;
|
||||
style.arrowLength = 20;
|
||||
style.arrowWidth = 14;
|
||||
style.arrowClosed = true;
|
||||
style.targetOffset.x = 29;
|
||||
style.targetOffset.x = 34;
|
||||
style.color = "#878787";
|
||||
break;
|
||||
case Edge::EDGE_OVERRIDE:
|
||||
style.color = "#CC5E89";
|
||||
break;
|
||||
case Edge::EDGE_INCLUDE:
|
||||
style.color = "#87BA50";
|
||||
style.color = "#5DA399";
|
||||
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";
|
||||
style.color = "#C1305D";
|
||||
break;
|
||||
default:
|
||||
style.color = "#878787";
|
||||
|
||||
@@ -56,36 +56,6 @@ void ApplicationSettings::setCodeFontSize(int codeFontSize)
|
||||
setValue<int>("code/FontSize", codeFontSize);
|
||||
}
|
||||
|
||||
Colori ApplicationSettings::getCodeLinkColor() const
|
||||
{
|
||||
return Colori::fromString(getValue<std::string>("code/LinkColor", Colori(255, 255, 0, 100).toString()));
|
||||
}
|
||||
|
||||
void ApplicationSettings::setCodeLinkColor(Colori color)
|
||||
{
|
||||
setValue<std::string>("code/LinkColor", color.toString());
|
||||
}
|
||||
|
||||
Colori ApplicationSettings::getCodeScopeColor() const
|
||||
{
|
||||
return Colori::fromString(getValue<std::string>("code/ScopeColor", Colori(255, 255, 0, 100).toString()));
|
||||
}
|
||||
|
||||
void ApplicationSettings::setCodeScopeColor(Colori color)
|
||||
{
|
||||
setValue<std::string>("code/ScopeColor", color.toString());
|
||||
}
|
||||
|
||||
Colori ApplicationSettings::getCodeActiveLinkColor() const
|
||||
{
|
||||
return Colori::fromString(getValue<std::string>("code/ActiveLinkColor", Colori(0, 255, 0, 100).toString()));
|
||||
}
|
||||
|
||||
void ApplicationSettings::setCodeActiveLinkColor(Colori color)
|
||||
{
|
||||
setValue<std::string>("code/ActiveLinkColor", color.toString());
|
||||
}
|
||||
|
||||
int ApplicationSettings::getCodeSnippetSnapRange() const
|
||||
{
|
||||
return getValue<int>("code/snippet/snap_range", 4);
|
||||
|
||||
@@ -29,15 +29,6 @@ public:
|
||||
int getCodeFontSize() const;
|
||||
void setCodeFontSize(int codeFontSize);
|
||||
|
||||
Colori getCodeLinkColor() const;
|
||||
void setCodeLinkColor(Colori color);
|
||||
|
||||
Colori getCodeScopeColor() const;
|
||||
void setCodeScopeColor(Colori color);
|
||||
|
||||
Colori getCodeActiveLinkColor() const;
|
||||
void setCodeActiveLinkColor(Colori color);
|
||||
|
||||
int getCodeSnippetSnapRange() const;
|
||||
void setCodeSnippetSnapRange(int range);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user