Mixer: Make spatializer view options song global.

pull/116/head
Jonathan Moore Liles 2013-09-02 12:11:10 -07:00
parent cf5c557c2f
commit 9fba8a8577
2 changed files with 34 additions and 7 deletions

View File

@ -32,6 +32,8 @@
/* 2D Panner widget. Supports various multichannel configurations. */
Panner::Point *Panner::drag;
int Panner::_range_mode = 1;
int Panner::_projection_mode = 0;
Panner::Panner ( int X, int Y, int W, int H, const char *L ) :
Fl_Group( X, Y, W, H, L )
@ -51,7 +53,8 @@ Panner::Panner ( int X, int Y, int W, int H, const char *L ) :
o->add("5 Meters",0,0,&ranges[1]);
o->add("10 Meters",0,0,&ranges[2]);
o->add("15 Meters",0,0,&ranges[3]);
o->value(1);
o->value(_range_mode);
o->callback( cb_mode, this );
}
{ Fl_Choice *o = _projection_choice = new Fl_Choice(X + W - 75,Y + H - 18,75,18,"Projection:");
@ -62,7 +65,8 @@ Panner::Panner ( int X, int Y, int W, int H, const char *L ) :
o->align(FL_ALIGN_LEFT);
o->add("Spherical");
o->add("Planar");
o->value(0);
o->value(_projection_mode);
o->callback( cb_mode, this );
}
end();
@ -89,12 +93,29 @@ static int find_numeric_menu_item( const Fl_Menu_Item *menu, int n )
return -1;
}
void
Panner::cb_mode ( Fl_Widget *w, void *v )
{
((Panner*)v)->cb_mode( w );
}
void
Panner::cb_mode ( Fl_Widget *w )
{
if ( w == _range_choice )
_range_mode = _range_choice->value();
else if ( w == _projection_choice )
_projection_mode = _projection_choice->value();
}
void
Panner::range ( float v )
{
int i = find_numeric_menu_item( _range_choice->menu(), v );
_range_choice->value( i );
_range_mode = i;
}
/** set X, Y, W, and H to the bounding box of point /p/ in screen coords */
@ -435,6 +456,8 @@ Panner::handle ( int m )
{
case FL_ENTER:
case FL_LEAVE:
_projection_choice->value(_projection_mode);
_range_choice->value(_range_mode);
redraw();
return 1;
case FL_PUSH:

View File

@ -36,6 +36,9 @@ class Panner : public Fl_Group
Fl_Image *_bg_image[2];
void draw_grid( int,int,int,int);
void draw_the_box( int, int, int, int );
static int _range_mode;
static int _projection_mode;
public:
@ -168,8 +171,9 @@ private:
void project_polar ( const Point *p, float *X, float *Y, float *S ) const;
void project_ortho ( const Point *p, float *X, float *Y, float *S ) const;
int _projection;
static void cb_mode ( Fl_Widget *w, void *v );
void cb_mode ( Fl_Widget *w );
protected:
virtual void draw ( void );
@ -179,12 +183,12 @@ public:
enum { POLAR, ORTHO };
int projection ( void ) const { return _projection_choice->value(); }
void projection ( int v ) { _projection_choice->value(v); }
int projection ( void ) const { return _projection_mode; }
void projection ( int v ) { _projection_choice->value(v); _projection_mode = v; }
Panner ( int X, int Y, int W, int H, const char *L = 0 );
float range ( void ) const { return *((int*)_range_choice->mvalue()->user_data()); }
float range ( void ) const { return *((int*)_range_choice->menu()[_range_mode].user_data()); }
void range ( float v );
void clear_points ( void ) { _points.clear(); }