void CodeEditorComponent::paint (Graphics& g)
{
    handleUpdateNowIfNeeded();

    g.fillAll (findColour (CodeEditorComponent::backgroundColourId));

    g.reduceClipRegion (gutter, 0, verticalScrollBar->getX() - gutter, horizontalScrollBar->getY());

    g.setFont (font);
    const int baselineOffset = (int) font.getAscent();
    const Colour defaultColour (findColour (CodeEditorComponent::defaultTextColourId));
    const Colour highlightColour (findColour (CodeEditorComponent::highlightColourId));

    const Rectangle clip (g.getClipBounds());
    const int firstLineToDraw = jmax (0, clip.getY() / lineHeight);
    const int lastLineToDraw = jmin (lines.size(), clip.getBottom() / lineHeight + 1);

    for (int j = firstLineToDraw; j < lastLineToDraw; ++j)
    {
        lines.getUnchecked(j)->draw (*this, g, font,
                                     (float) (gutter - xOffset * charWidth),
                                     lineHeight * j, baselineOffset, lineHeight,
                                     highlightColour);
    }
}
Esempio n. 2
0
void FilenameComponent::setCurrentFile (File newFile,
                                        const bool addToRecentlyUsedList,
                                        NotificationType notification)
{
    if (enforcedSuffix.isNotEmpty())
        newFile = newFile.withFileExtension (enforcedSuffix);

    if (newFile.getFullPathName() != lastFilename)
    {
        lastFilename = newFile.getFullPathName();

        if (addToRecentlyUsedList)
            addRecentlyUsedFile (newFile);

        filenameBox.setText (lastFilename, dontSendNotification);

        if (notification != dontSendNotification)
        {
            triggerAsyncUpdate();

            if (notification == sendNotificationSync)
                handleUpdateNowIfNeeded();
        }
    }
}
Esempio n. 3
0
void ComboBox::sendChange (const NotificationType notification)
{
    if (notification != dontSendNotification)
        triggerAsyncUpdate();

    if (notification == sendNotificationSync)
        handleUpdateNowIfNeeded();
}