MCPcopy Create free account
hub / github.com/SpartanJ/eepp / drawLineNumbersBefore

Method drawLineNumbersBefore

src/tools/ecode/plugins/debugger/debuggerplugin.cpp:1562–1669  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1560}
1561
1562void DebuggerPlugin::drawLineNumbersBefore( UICodeEditor* editor,
1563 const DocumentLineRange& lineRange,
1564 const Vector2f& startScroll,
1565 const Vector2f& screenStart, const Float& lineHeight,
1566 const Float&, const int&, const Float& ) {
1567 Primitives p;
1568 Float gutterSpace = editor->getGutterSpace( this );
1569 Float radius = lineHeight * 0.5f;
1570 Float lineOffset = editor->getLineOffset();
1571 Float offset = editor->getGutterLocalStartOffset( this );
1572
1573 p.setColor( Color( editor->getLineNumberBackgroundColor() ).blendAlpha( editor->getAlpha() ) );
1574 p.drawRectangle( Rectf( { screenStart.x - editor->getPluginsGutterSpace() + offset,
1575 screenStart.y + editor->getPluginsTopSpace() },
1576 Sizef( gutterSpace, editor->getPixelsSize().getHeight() -
1577 editor->getPluginsTopSpace() ) ) );
1578
1579 if ( editor->getDocument().hasFilepath() ) {
1580 auto docIt = mBreakpoints.find( editor->getDocument().getFilePath() );
1581 if ( docIt != mBreakpoints.end() && !docIt->second.empty() ) {
1582 const auto& breakpoints = docIt->second;
1583
1584 p.setColor( Color( editor->getColorScheme().getEditorColor( SyntaxStyleTypes::Error ) )
1585 .blendAlpha( editor->getAlpha() ) );
1586
1587 for ( const SourceBreakpointStateful& breakpoint : breakpoints ) {
1588 int line = breakpoint.line - 1; // Breakpoints start at 1
1589 if ( line >= 0 && line >= lineRange.first && line <= lineRange.second ) {
1590 if ( !editor->getDocumentView().isLineVisible( line ) )
1591 continue;
1592
1593 Vector2f lnPos(
1594 screenStart.x - editor->getPluginsGutterSpace() + offset,
1595 startScroll.y +
1596 editor->getDocumentView().getLineYOffset( line, lineHeight ) +
1597 lineOffset );
1598
1599 Color color( Color( editor->getColorScheme().getEditorColor(
1600 breakpoint.enabled ? SyntaxStyleTypes::Error
1601 : SyntaxStyleTypes::LineNumber2 ) )
1602 .blendAlpha( editor->getAlpha() ) );
1603
1604 static UIIcon* circleFilled = getUISceneNode()->findIcon( "circle-perfect" );
1605
1606 if ( circleFilled ) {
1607 Float finalHeight = eefloor( radius * 1.75f );
1608 Drawable* drawable = circleFilled->getSize( finalHeight );
1609 if ( drawable ) {
1610 Color oldColor = drawable->getColor();
1611 drawable->setColor( color );
1612 drawable->draw(
1613 Sizef{ lnPos.x, lnPos.y + ( lineHeight - finalHeight ) * 0.5f }
1614 .floor() );
1615 drawable->setColor( oldColor );
1616 }
1617 } else {
1618 p.setColor( color );
1619

Callers 1

drawLineNumbersMethod · 0.45

Calls 15

getGutterSpaceMethod · 0.80
getLineOffsetMethod · 0.80
getPluginsGutterSpaceMethod · 0.80
hasFilepathMethod · 0.80
getDocumentMethod · 0.80
getFilePathMethod · 0.80
isLineVisibleMethod · 0.80
getLineYOffsetMethod · 0.80
drawCircleMethod · 0.80
isStoppedMethod · 0.80
isCurrentScopePosMethod · 0.80

Tested by

no test coverage detected