Mixer: Make panner widget scalable again.
This commit is contained in:
parent
17e7ad0ad6
commit
19b19edf0e
|
@ -68,6 +68,7 @@ public:
|
||||||
/* TODO: other alignments */
|
/* TODO: other alignments */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
init_sizes();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~Fl_Labelpad_Group ( )
|
virtual ~Fl_Labelpad_Group ( )
|
||||||
|
|
|
@ -377,6 +377,7 @@ Module_Parameter_Editor::make_controls ( void )
|
||||||
|
|
||||||
Fl_Labelpad_Group *flg = new Fl_Labelpad_Group( o );
|
Fl_Labelpad_Group *flg = new Fl_Labelpad_Group( o );
|
||||||
|
|
||||||
|
flg->resizable(o);
|
||||||
control_pack->add( flg );
|
control_pack->add( flg );
|
||||||
|
|
||||||
controls_by_port[azimuth_port_number] = o;
|
controls_by_port[azimuth_port_number] = o;
|
||||||
|
|
|
@ -38,6 +38,8 @@ int Panner::_projection_mode = 0;
|
||||||
Panner::Panner ( int X, int Y, int W, int H, const char *L ) :
|
Panner::Panner ( int X, int Y, int W, int H, const char *L ) :
|
||||||
Fl_Group( X, Y, W, H, L )
|
Fl_Group( X, Y, W, H, L )
|
||||||
{
|
{
|
||||||
|
_bg_image = 0;
|
||||||
|
_bg_image_scaled = 0;
|
||||||
_range = 15.0f;
|
_range = 15.0f;
|
||||||
// _projection = POLAR;
|
// _projection = POLAR;
|
||||||
_points.push_back( Point( 1, 0 ) );
|
_points.push_back( Point( 1, 0 ) );
|
||||||
|
@ -70,16 +72,17 @@ Panner::Panner ( int X, int Y, int W, int H, const char *L ) :
|
||||||
}
|
}
|
||||||
|
|
||||||
end();
|
end();
|
||||||
|
|
||||||
_bg_image[0] = _bg_image[1] = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Panner::~Panner ( )
|
Panner::~Panner ( )
|
||||||
{
|
{
|
||||||
if ( _bg_image[0] )
|
if ( _bg_image )
|
||||||
((Fl_Shared_Image*)_bg_image[0])->release();
|
{
|
||||||
if ( _bg_image[1] )
|
if ( _bg_image_scaled )
|
||||||
((Fl_Shared_Image*)_bg_image[1])->release();
|
delete _bg_image;
|
||||||
|
else
|
||||||
|
((Fl_Shared_Image*)_bg_image)->release();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int find_numeric_menu_item( const Fl_Menu_Item *menu, int n )
|
static int find_numeric_menu_item( const Fl_Menu_Item *menu, int n )
|
||||||
|
@ -186,49 +189,53 @@ Panner::draw_the_box ( int tx, int ty, int tw, int th )
|
||||||
|
|
||||||
Fl_Image *i = 0;
|
Fl_Image *i = 0;
|
||||||
|
|
||||||
if ( ! ( _bg_image[0] && _bg_image[1] ))
|
if ( _bg_image && _bg_image->h() != th )
|
||||||
{
|
{
|
||||||
Fl_Image *i = NULL;
|
if ( _bg_image_scaled )
|
||||||
|
delete _bg_image;
|
||||||
switch ( tw )
|
|
||||||
{
|
|
||||||
case 802:
|
|
||||||
i = Fl_Shared_Image::get( PIXMAP_PATH "/non-mixer/panner-sphere-802x802.png" );
|
|
||||||
break;
|
|
||||||
case 92:
|
|
||||||
i = Fl_Shared_Image::get( PIXMAP_PATH "/non-mixer/panner-sphere-92x92.png" );
|
|
||||||
break;
|
|
||||||
case 502:
|
|
||||||
i = Fl_Shared_Image::get( PIXMAP_PATH "/non-mixer/panner-sphere-502x502.png" );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
_bg_image[0] = i;
|
|
||||||
|
|
||||||
i = NULL;
|
|
||||||
|
|
||||||
switch ( tw )
|
|
||||||
{
|
|
||||||
case 802:
|
|
||||||
i = Fl_Shared_Image::get( PIXMAP_PATH "/non-mixer/panner-plane-802x802.png" );
|
|
||||||
break;
|
|
||||||
case 92:
|
|
||||||
i = Fl_Shared_Image::get( PIXMAP_PATH "/non-mixer/panner-plane-92x92.png" );
|
|
||||||
break;
|
|
||||||
case 502:
|
|
||||||
i = Fl_Shared_Image::get( PIXMAP_PATH "/non-mixer/panner-plane-502x502.png" );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
_bg_image[1] = i;
|
|
||||||
}
|
|
||||||
if ( projection() == POLAR )
|
|
||||||
i = _bg_image[0];
|
|
||||||
else
|
else
|
||||||
i = _bg_image[1];
|
((Fl_Shared_Image*)_bg_image)->release();
|
||||||
|
|
||||||
if ( i )
|
_bg_image = 0;
|
||||||
i->draw( tx, ty );
|
}
|
||||||
|
|
||||||
|
if ( ! _bg_image )
|
||||||
|
{
|
||||||
|
if ( projection() == POLAR )
|
||||||
|
{
|
||||||
|
if ( th <= 92 )
|
||||||
|
i = Fl_Shared_Image::get( PIXMAP_PATH "/non-mixer/panner-sphere-92x92.png" );
|
||||||
|
else if ( th <= 502 )
|
||||||
|
i = Fl_Shared_Image::get( PIXMAP_PATH "/non-mixer/panner-sphere-502x502.png" );
|
||||||
|
else if ( th <= 802 )
|
||||||
|
i = Fl_Shared_Image::get( PIXMAP_PATH "/non-mixer/panner-sphere-802x802.png" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( th <= 92 )
|
||||||
|
i = Fl_Shared_Image::get( PIXMAP_PATH "/non-mixer/panner-plane-92x92.png" );
|
||||||
|
else if ( th <= 502 )
|
||||||
|
i = Fl_Shared_Image::get( PIXMAP_PATH "/non-mixer/panner-plane-502x502.png" );
|
||||||
|
else if ( th <= 802 )
|
||||||
|
i = Fl_Shared_Image::get( PIXMAP_PATH "/non-mixer/panner-plane-802x802.png" );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( i && i->h() != th )
|
||||||
|
{
|
||||||
|
Fl_Image *scaled = i->copy( th, th );
|
||||||
|
|
||||||
|
_bg_image = scaled;
|
||||||
|
_bg_image_scaled = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_bg_image = i;
|
||||||
|
_bg_image_scaled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( _bg_image )
|
||||||
|
_bg_image->draw( tx, ty );
|
||||||
}
|
}
|
||||||
|
|
||||||
/** translate angle /a/ into x/y coords and place the result in /X/ and /Y/ */
|
/** translate angle /a/ into x/y coords and place the result in /X/ and /Y/ */
|
||||||
|
@ -518,8 +525,12 @@ Panner::handle ( int m )
|
||||||
if ( POLAR == projection() )
|
if ( POLAR == projection() )
|
||||||
set_polar( drag,X,Y );
|
set_polar( drag,X,Y );
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if ( fabsf( X ) < 0.5f &&
|
||||||
|
fabsf( Y ) < 0.5f )
|
||||||
set_ortho( drag, X,Y );
|
set_ortho( drag, X,Y );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
set_polar_radius( drag,X,Y );
|
set_polar_radius( drag,X,Y );
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,9 @@ class Panner : public Fl_Group
|
||||||
Fl_Choice *_range_choice;
|
Fl_Choice *_range_choice;
|
||||||
Fl_Choice *_projection_choice;
|
Fl_Choice *_projection_choice;
|
||||||
|
|
||||||
Fl_Image *_bg_image[2];
|
Fl_Image *_bg_image;
|
||||||
|
bool _bg_image_scaled;
|
||||||
|
|
||||||
void draw_grid( int,int,int,int);
|
void draw_grid( int,int,int,int);
|
||||||
void draw_the_box( int, int, int, int );
|
void draw_the_box( int, int, int, int );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue