void CodeEditorComponent::resized() { linesOnScreen = (getHeight() - scrollbarThickness) / lineHeight; columnsOnScreen = (int) ((getWidth() - scrollbarThickness) / charWidth); lines.clear(); rebuildLineTokens(); ((CaretComponent*) caret)->updatePosition (*this); verticalScrollBar->setBounds (getWidth() - scrollbarThickness, 0, scrollbarThickness, getHeight() - scrollbarThickness); horizontalScrollBar->setBounds (gutter, getHeight() - scrollbarThickness, getWidth() - scrollbarThickness - gutter, scrollbarThickness); updateScrollBars(); }
//============================================================================== void CodeEditorComponent::resized() { const int visibleWidth = getWidth() - scrollbarThickness - getGutterSize(); linesOnScreen = jmax (1, (getHeight() - scrollbarThickness) / lineHeight); columnsOnScreen = jmax (1, (int) (visibleWidth / charWidth)); lines.clear(); rebuildLineTokens(); updateCaretPosition(); if (gutter != nullptr) gutter->setBounds (0, 0, getGutterSize() - 2, getHeight()); verticalScrollBar.setBounds (getWidth() - scrollbarThickness, 0, scrollbarThickness, getHeight() - scrollbarThickness); horizontalScrollBar.setBounds (getGutterSize(), getHeight() - scrollbarThickness, visibleWidth, scrollbarThickness); updateScrollBars(); }
void CodeEditorComponent::handleAsyncUpdate() { rebuildLineTokens(); }