Improve panner layout rendering.

This commit is contained in:
Jonathan Moore Liles 2008-03-13 16:03:00 -05:00
parent 65a87dde02
commit c6de6b85d6
2 changed files with 23 additions and 22 deletions

View File

@ -25,16 +25,20 @@
/* multichannel layouts, in degrees */
int Panner::_configs[][12] =
{
/* none */
{ -1 },
/* mono */
{ -1 },
/* stereo */
{ 270, 90, -1 },
{ 270, 90 },
{ -1 },
/* quad */
{ 315, 45, 225, 135, -1 },
{ 315, 45, 225, 135 },
/* 5.1 */
{ 315, 45, 225, 135, 0, -1 },
{ 315, 45, 225, 135, 0 },
{ -1 },
/* 7.1 */
{ 315, 45, 225, 135, 0, 270, 90, -1 },
{ 315, 45, 225, 135, 0, 270, 90 },
};
@ -47,6 +51,9 @@ Panner::event_point ( void )
bbox( X, Y, W, H );
W -= pw();
H -= ph();
for ( int i = _ins; i--; )
{
Point *p = &_points[ i ];
@ -70,26 +77,21 @@ Panner::draw ( void )
bbox( tx, ty, tw, th );
fl_color( FL_GRAY );
switch ( _outs )
fl_color( FL_WHITE );
if ( _configs[ _outs ][0] >= 0 )
{
case 2: /* stereo */
case 4: /* quad */
fl_line( x(), y(), x()+ w(), y() + h() );
fl_line( x() + w(), y(), x(), y() + h() );
break;
case 5: /* 5.1 */
fl_line( x(), y(), x() + w(), y() + h() );
fl_line( x() + w(), y(), x(), y() + h() );
fl_line( x() + (w() / 2), y(), x() + (w() / 2), y() + (h() / 2) );
break;
for ( int i = _outs; i--; )
{
int a = _configs[ _outs ][ i ];
a += 90;
fl_arc( tx, ty, tw, th, a - 3, a + 3 );
}
}
tw -= pw();
th -= ph();
for ( int i = _ins; i--; )
{

View File

@ -52,8 +52,8 @@ class Panner : public Fl_Widget
void bbox ( int &X, int &Y, int &W, int &H )
{
W = w() - Fl::box_dw( box() ) - pw();
H = h() - Fl::box_dh( box() ) - ph();
W = w() - Fl::box_dw( box() );
H = h() - Fl::box_dh( box() );
X = x() + Fl::box_dx( box() );
Y = y() + Fl::box_dy( box() );
}
@ -72,7 +72,6 @@ public:
_points.push_back( Point( 1, -1 ) );
_outs = 5;
}
virtual ~Panner ( ) { }