<commit_before>#include "NumberStrip.h"

void NumberStrip::Draw(Gdiplus::Bitmap *buffer, Gdiplus::Graphics *graphics) {
    int units = CalcUnits();
    int perc = units * (100 / _units);

    int digits[] = {
        perc % 10,
        (perc / 10) % 10,
        perc / 100,
    };

    int dispChars = 1;
    if (digits[1] > 0) {
        dispChars = 2;
    } else if (digits[2] > 0) {
        dispChars = 3;
    }

    int drawX = _charWidth * 2;
    if (_align == Left) {
        drawX = (dispChars - 1) * _charWidth;
    } else if (_align == Center) {
        drawX = (_charWidth * 2) - ((3 - dispChars) * (_charWidth / 2));
    }

    for (int i = 0, x = drawX; i < dispChars; ++i, x -= _charWidth) {
        int digit = digits[i];
        CLOG(L"Drawing digit [%d]: (%d, %d); %dx%d", digit,
            _rect.X + x, _rect.Y, _charWidth, _rect.Height);

        Gdiplus::Rect destRect(_rect.X + x, _rect.Y, _charWidth, _rect.Height);
        graphics->DrawImage(_bitmap, destRect,
            0, digit * _rect.Height, _charWidth, _rect.Height,
            Gdiplus::UnitPixel, NULL, NULL, NULL);
    }

    _lastValue = Value();
    _lastUnits = units;
}<commit_msg>Add some more info to ToString()<commit_after>#include "NumberStrip.h"

#include <sstream>

void NumberStrip::Draw(Gdiplus::Bitmap *buffer, Gdiplus::Graphics *graphics) {
    int units = CalcUnits();
    int perc = units * (100 / _units);

    int digits[] = {
        perc % 10,
        (perc / 10) % 10,
        perc / 100,
    };

    int dispChars = 1;
    if (digits[1] > 0) {
        dispChars = 2;
    } else if (digits[2] > 0) {
        dispChars = 3;
    }

    int drawX = _charWidth * 2;
    if (_align == Left) {
        drawX = (dispChars - 1) * _charWidth;
    } else if (_align == Center) {
        drawX = (_charWidth * 2) - ((3 - dispChars) * (_charWidth / 2));
    }

    for (int i = 0, x = drawX; i < dispChars; ++i, x -= _charWidth) {
        int digit = digits[i];
        CLOG(L"Drawing digit [%d]: (%d, %d); %dx%d", digit,
            _rect.X + x, _rect.Y, _charWidth, _rect.Height);

        Gdiplus::Rect destRect(_rect.X + x, _rect.Y, _charWidth, _rect.Height);
        graphics->DrawImage(_bitmap, destRect,
            0, digit * _rect.Height, _charWidth, _rect.Height,
            Gdiplus::UnitPixel, NULL, NULL, NULL);
    }

    _lastValue = Value();
    _lastUnits = units;
}

std::wstring NumberStrip::ToString() {
    std::wstringstream ss;
    ss << std::endl;
    ss << "Text Alignment: " << _align;
    return Meter::ToString() + ss.str();
}
{'fraction_non_alphanumeric': 0.15855572998430142, 'fraction_numerical': 0.02040816326530612, 'mean_word_length': 2.238881829733164, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3935101', 'n_tokens_mistral': 969, 'n_tokens_neox': 907, 'n_words': 234}