<commit_before>
@implementation SheetWindowController : CPWindowController
{
    @outlet CPButton _closeButton;
    @outlet CPButton _sheetWindowHackCheckbox;
    @outlet CPButton _altCloseButton;
    @outlet CPButton _otherCloseButton;
    @outlet CPButton _orderOutAfterCheckbox;
    @outlet CPRadioGroup _windowTypeMatrix;
    @outlet CPButton _titledMaskButton;
    @outlet CPButton _closableMaskButton;
    @outlet CPButton _miniaturizableMaskButton;
    @outlet CPButton _resizableMaskButton;
    @outlet CPButton _shadeWindowView;
    @outlet CPButton _shadeContentView;
    @outlet CPButton _shadeParentWindow;

    CPModalSession _modalSession;
    CPWindow       _parentWindow;
    CPWindow       _sheet;
    int            _returnCode;
    CPColor        _savedColor;
}

- (void)initWithWindowCibName:(CPString)cibName
{
    CPLog.debug("[%@ %@]", [self class], _cmd);

    self = [super initWithWindowCibName:cibName];

    _closeButton = nil;

    return self;
}

- (void)positionWindow
{
    var keyWindow = [CPApp keyWindow],
        origin = CGPointMake(40, 40);

    if (keyWindow)
    {
        origin = ([keyWindow frame]).origin;
        origin = CGPointMake(origin.x + 20, origin.y + 20);
    }

    [[self window] setFrameOrigin:origin];
}

- (void)awakeFromCib
{
    CPLog.debug("[%@ %@]", [self class], _cmd);

    if (!_closeButton)
        CPLog.fatal("_closeButton is not connected!");

    [_closeButton setTarget:self];
    [_closeButton setAction:@selector(unsetAction:)];
    [_altCloseButton setTarget:self];
    [_altCloseButton setAction:@selector(unsetAction:)];
    [_otherCloseButton setTarget:self];
    [_otherCloseButton setAction:@selector(unsetAction:)];
}

- (void)unsetAction:(id)sender
{
    CPLog.warn("No action set on this %@", [sender class]);
}

- (void)addButtons:(CPWindow)aWindow
{
    var x = 10,
        unsetAction = @selector(unsetAction:);

    _closeButton = [[CPButton alloc] initWithFrame:CGRectMake(x, 10, 32, 100)];
    [_closeButton setTitle:@"Close"];
    [_closeButton setButtonType:CPMomentaryPushInButton];
    [_closeButton setBezelStyle:CPBezelBorder];
    [_closeButton sizeToFit];
    [_closeButton setTarget:self];
    [_closeButton setAction:unsetAction];
    [[aWindow contentView] addSubview:_closeButton positioned:CPWindowAbove relativeTo:nil];
    x += 10 + CGRectGetWidth([_closeButton frame]);

    _altCloseButton = [[CPButton alloc] initWithFrame:CGRectMake(x, 10, 32, 100)];
    [_altCloseButton setTitle:@"Close Parent Too"];
    [_altCloseButton setButtonType:CPMomentaryPushInButton];
    [_altCloseButton setBezelStyle:CPBezelBorder];
    [_altCloseButton sizeToFit];
    [_altCloseButton setTarget:self];
    [_altCloseButton setAction:unsetAction];
    [[aWindow contentView] addSubview:_altCloseButton positioned:CPWindowAbove relativeTo:nil];
    x += 10 + CGRectGetWidth([_altCloseButton frame]);

    _otherCloseButton = [[CPButton alloc] initWithFrame:CGRectMake(x, 10, 32, 100)];
    [_otherCloseButton setTitle:@"Chain Sheets"];
    [_otherCloseButton setButtonType:CPMomentaryPushInButton];
    [_otherCloseButton setBezelStyle:CPBezelBorder];
    [_otherCloseButton sizeToFit];
    [_otherCloseButton setTarget:self];
    [_otherCloseButton setAction:unsetAction];
    [[aWindow contentView] addSubview:_otherCloseButton positioned:CPWindowAbove relativeTo:nil];
}

- (SheetWindowController)initWithStyleMask:(int)styleMask debug:(int)debug
{
    CPLog.debug("[%@ %@] mask=%d radioGroup=%@", [self class], _cmd, styleMask, _windowTypeMatrix);

    if (styleMask < 0)
        return [self initWithWindowCibName:@"Window"];

    var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMake(0, 0, 400, 300) styleMask:styleMask];
<commit_msg>Use HUD style buttons in HUD style test window.<commit_after>
@implementation SheetWindowController : CPWindowController
{
    @outlet CPButton _closeButton;
    @outlet CPButton _sheetWindowHackCheckbox;
    @outlet CPButton _altCloseButton;
    @outlet CPButton _otherCloseButton;
    @outlet CPButton _orderOutAfterCheckbox;
    @outlet CPRadioGroup _windowTypeMatrix;
    @outlet CPButton _titledMaskButton;
    @outlet CPButton _closableMaskButton;
    @outlet CPButton _miniaturizableMaskButton;
    @outlet CPButton _resizableMaskButton;
    @outlet CPButton _shadeWindowView;
    @outlet CPButton _shadeContentView;
    @outlet CPButton _shadeParentWindow;

    CPModalSession _modalSession;
    CPWindow       _parentWindow;
    CPWindow       _sheet;
    int            _returnCode;
    CPColor        _savedColor;
}

- (void)initWithWindowCibName:(CPString)cibName
{
    CPLog.debug("[%@ %@]", [self class], _cmd);

    self = [super initWithWindowCibName:cibName];

    _closeButton = nil;

    return self;
}

- (void)positionWindow
{
    var keyWindow = [CPApp keyWindow],
        origin = CGPointMake(40, 40);

    if (keyWindow)
    {
        origin = ([keyWindow frame]).origin;
        origin = CGPointMake(origin.x + 20, origin.y + 20);
    }

    [[self window] setFrameOrigin:origin];
}

- (void)awakeFromCib
{
    CPLog.debug("[%@ %@]", [self class], _cmd);

    if (!_closeButton)
        CPLog.fatal("_closeButton is not connected!");

    [_closeButton setTarget:self];
    [_closeButton setAction:@selector(unsetAction:)];
    [_altCloseButton setTarget:self];
    [_altCloseButton setAction:@selector(unsetAction:)];
    [_otherCloseButton setTarget:self];
    [_otherCloseButton setAction:@selector(unsetAction:)];
}

- (void)unsetAction:(id)sender
{
    CPLog.warn("No action set on this %@", [sender class]);
}

- (void)addButtons:(CPWindow)aWindow
{
    var x = 10,
        unsetAction = @selector(unsetAction:);

    _closeButton = [[CPButton alloc] initWithFrame:CGRectMake(x, 10, 32, 100)];
    [_closeButton setTitle:@"Close"];
    [_closeButton setButtonType:CPMomentaryPushInButton];
    [_closeButton setBezelStyle:CPBezelBorder];
    [_closeButton sizeToFit];
    [_closeButton setTarget:self];
    [_closeButton setAction:unsetAction];
    [[aWindow contentView] addSubview:_closeButton positioned:CPWindowAbove relativeTo:nil];
    x += 10 + CGRectGetWidth([_closeButton frame]);

    _altCloseButton = [[CPButton alloc] initWithFrame:CGRectMake(x, 10, 32, 100)];
    [_altCloseButton setTitle:@"Close Parent Too"];
    [_altCloseButton setButtonType:CPMomentaryPushInButton];
    [_altCloseButton setBezelStyle:CPBezelBorder];
    [_altCloseButton sizeToFit];
    [_altCloseButton setTarget:self];
    [_altCloseButton setAction:unsetAction];
    [[aWindow contentView] addSubview:_altCloseButton positioned:CPWindowAbove relativeTo:nil];
    x += 10 + CGRectGetWidth([_altCloseButton frame]);

    _otherCloseButton = [[CPButton alloc] initWithFrame:CGRectMake(x, 10, 32, 100)];
    [_otherCloseButton setTitle:@"Chain Sheets"];
    [_otherCloseButton setButtonType:CPMomentaryPushInButton];
    [_otherCloseButton setBezelStyle:CPBezelBorder];
    [_otherCloseButton sizeToFit];
    [_otherCloseButton setTarget:self];
    [_otherCloseButton setAction:unsetAction];
    [[aWindow contentView] addSubview:_otherCloseButton positioned:CPWindowAbove relativeTo:nil];

    if ([aWindow styleMask] & CPHUDBackgroundWindowMask)
        [[_closeButton, _altCloseButton, _otherCloseButton] makeObjectsPerformSelector:@selector(setTheme:) withObject:[CPTheme defaultHudTheme]];

}

- (SheetWindowController)initWithStyleMask:(int)styleMask debug:(int)debug
{
    CPLog.debug("[%@ %@] mask=%d radioGroup=%@", [self class], _cmd, styleMask, _windowTypeMatrix);

    if (styleMask < 0)
        return [self initWithWindowCibName:@"Window"];

    var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMake(0, 0, 400, 300) styleMask:styleMask];

{'fraction_non_alphanumeric': 0.11201761201761201, 'fraction_numerical': 0.011396011396011397, 'mean_word_length': 4.776364996260284, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '1210825', 'n_tokens_mistral': 2607, 'n_tokens_neox': 2373, 'n_words': 480}