| 1 |
// |
| 2 |
// AudioEffectLayoutView.m |
| 3 |
// Alchemusica |
| 4 |
// |
| 5 |
// Created by Toshi Nagata on 2017/10/09. |
| 6 |
// Copyright 2006-2017 Toshi Nagata. All rights reserved. |
| 7 |
// |
| 8 |
/* |
| 9 |
This program is free software; you can redistribute it and/or modify |
| 10 |
it under the terms of the GNU General Public License as published by |
| 11 |
the Free Software Foundation version 2 of the License. |
| 12 |
|
| 13 |
This program is distributed in the hope that it will be useful, |
| 14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
GNU General Public License for more details. |
| 17 |
*/ |
| 18 |
|
| 19 |
#import "AudioEffectLayoutView.h" |
| 20 |
#import "AudioEffectPanelController.h" |
| 21 |
|
| 22 |
@implementation AudioEffectLayoutView |
| 23 |
|
| 24 |
- (id)initWithFrame:(NSRect)frame |
| 25 |
{ |
| 26 |
self = [super initWithFrame:frame]; |
| 27 |
if (self) { |
| 28 |
// Initialization code here. |
| 29 |
} |
| 30 |
return self; |
| 31 |
} |
| 32 |
|
| 33 |
- (BOOL)acceptsFirstResponder |
| 34 |
{ |
| 35 |
return YES; |
| 36 |
} |
| 37 |
|
| 38 |
- (void)drawRect:(NSRect)rect |
| 39 |
{ |
| 40 |
CGFloat x; |
| 41 |
int i, n; |
| 42 |
// NSDrawWindowBackground(rect); |
| 43 |
if (dataSource != nil) { |
| 44 |
NSRect b = [self bounds]; |
| 45 |
x = [dataSource xpos_output]; |
| 46 |
n = [dataSource numberOfChains]; |
| 47 |
[[NSColor blackColor] set]; |
| 48 |
for (i = 0; i < n; i++) { |
| 49 |
CGFloat xx, ybase; |
| 50 |
if (i == 0) |
| 51 |
xx = x; |
| 52 |
else |
| 53 |
xx = x - 16; |
| 54 |
ybase = b.size.height - 20 - 25 * i; |
| 55 |
[NSBezierPath strokeLineFromPoint:NSMakePoint(122, ybase) toPoint:NSMakePoint(xx, ybase)]; |
| 56 |
if (i == n - 1) { |
| 57 |
[NSBezierPath strokeLineFromPoint:NSMakePoint(xx, ybase - 1) toPoint:NSMakePoint(xx, b.size.height - 21)]; |
| 58 |
} |
| 59 |
} |
| 60 |
} |
| 61 |
} |
| 62 |
|
| 63 |
- (void)setDataSource:(AudioEffectPanelController *)aDataSource |
| 64 |
{ |
| 65 |
dataSource = aDataSource; |
| 66 |
} |
| 67 |
|
| 68 |
@end |