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

Method draw

src/eepp/ui/uicodeeditor.cpp:250–453  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

248}
249
250void UICodeEditor::draw() {
251 if ( !mVisible || mAlpha == 0 )
252 return;
253
254 UIWidget::draw();
255
256 if ( mFont == NULL )
257 return;
258
259 if ( mDisplayLoaderIfDocumentLoading && mDoc->isLoading() ) {
260 UILoader* loader = getLoader();
261 loader->setParent( this );
262 loader->setVisible( true );
263 loader->setEnabled( false );
264 loader->setPixelsSize( getPixelsSize() );
265 } else if ( mLoader != nullptr && !mDoc->isLoading() && mLoader->isVisible() ) {
266 mLoader->setVisible( false );
267 }
268
269 if ( mDoc->isLoading() || mSize.getWidth() == 0 )
270 return;
271
272 bool needsClipping = mPaddingPx != Rectf::Zero;
273 if ( isClipped() && needsClipping ) {
274 clipSmartEnable( mScreenPos.x + mPaddingPx.Left, mScreenPos.y + mPaddingPx.Top,
275 editorWidth(), editorHeight() );
276 }
277
278 if ( mDirtyEditor )
279 updateEditor();
280
281 if ( mDocView.isPendingReconstruction() )
282 mDocView.invalidateCache();
283
284 Color col;
285 auto lineRange = getDocumentLineRange();
286 auto visibleLineRange = getVisibleLineRange();
287 Float charSize = getCharacterSize();
288 Float lineHeight = getLineHeight();
289 int lineNumberDigits = getLineNumberDigits();
290 Float gutterWidth = getGutterWidth();
291 Vector2f screenStart( getScreenStart() );
292 Vector2f start( screenStart.x + gutterWidth, screenStart.y + getPluginsTopSpace() );
293 Vector2f startScroll( start - mScroll );
294 Primitives primitives;
295 TextPosition cursor( mDoc->getSelection().start() );
296
297 for ( auto& plugin : mPlugins )
298 plugin->preDraw( this, startScroll, lineHeight, cursor );
299
300 if ( !mLocked && mHighlightCurrentLine ) {
301 for ( const auto& sel : mDoc->getSelections() ) {
302 if ( mDocView.isFolded( sel.start().line(), true ) )
303 continue;
304 primitives.setColor( Color( mCurrentLineBackgroundColor ).blendAlpha( mAlpha ) );
305 Float height = 1;
306 if ( mDocView.isWrappedLine( sel.start().line() ) )
307 height = mDocView.getVisibleLineInfo( sel.start().line() ).visualLines.size();

Callers 4

drawLockedIconMethod · 0.45
drawLineNumbersMethod · 0.45
drawLineEndingsMethod · 0.45
drawMinimapMethod · 0.45

Calls 15

getLoaderFunction · 0.85
eeminFunction · 0.85
setParentMethod · 0.80
isFoldedMethod · 0.80
isWrappedLineMethod · 0.80
getVisibleLineInfoMethod · 0.80
getLineYOffsetMethod · 0.80
getSelectionsSortedMethod · 0.80
isLineVisibleMethod · 0.80
drawGutterMethod · 0.80
isLoadingMethod · 0.45

Tested by

no test coverage detected