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:
@@ -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