Mixer: Cleanup.

pull/3/head
Jonathan Moore Liles 2010-02-24 09:06:11 -06:00
parent 4a97f3dcb9
commit fc31233d70
5 changed files with 23 additions and 49 deletions

View File

@ -47,7 +47,7 @@ DPM::DPM ( int X, int Y, int W, int H, const char *L ) :
type( FL_VERTICAL );
resize( X, Y, W, H );
// resize( X, Y, W, H );
dim( 0.70f );
@ -113,6 +113,7 @@ DPM::resize ( int X, int Y, int W, int H )
void
DPM::draw ( void )
{
snprintf( peak_string, sizeof( peak_string ), "%.1f", peak() );
tooltip( peak_string );

View File

@ -97,33 +97,3 @@ public:
void reset ( void ) { _peak = -80.0f; redraw(); }
};
#include <FL/Fl_Group.H>
#include <stdio.h>
/* ... Extension methods for any group containing only meters. Access
* via a cast to (Meter_Pack *) */
class Meter_Pack : public Fl_Group
{
public:
/** return a pointer to the meter for channel /c/ in group of meters /g/ */
Meter *
channel ( int c )
{
if ( c > children() )
{
fprintf( stderr, "no such channel\n" );
return NULL;
}
return (Meter *)child( c );
}
int
channels ( void ) const { return children(); }
};

View File

@ -1,6 +1,6 @@
/*******************************************************************************/
/* Copyright (C) 2009 Jonathan Moore Liles */
/* Copyright (C) 2010 Jonathan Moore Liles */
/* */
/* This program is free software; you can redistribute it and/or modify it */
/* under the terms of the GNU General Public License as published by the */
@ -48,10 +48,10 @@ const float CONTROL_UPDATE_FREQ = 0.1f;
Meter_Indicator_Module::Meter_Indicator_Module ( bool is_default )
: Module ( is_default, 50, 100, name() )
{
box( FL_NO_BOX );
box( FL_FLAT_BOX );
color( FL_GREEN );
_pad = true;
control = 0;
control_value = 0;
add_port( Port( this, Port::INPUT, Port::CONTROL ) );
@ -59,10 +59,12 @@ Meter_Indicator_Module::Meter_Indicator_Module ( bool is_default )
dpm_pack = new Fl_Scalepack( x(), y(), w(), h() );
dpm_pack->type( FL_HORIZONTAL );
end();
control_value = new float[1];
*control_value = -70.0f;
end();
align( (Fl_Align)(FL_ALIGN_CENTER | FL_ALIGN_INSIDE ) );
clear_visible_focus();
@ -163,7 +165,6 @@ Meter_Indicator_Module::update_cb ( void )
DPM *dpm = new DPM( x(), y(), w(), h() );
dpm->type( FL_VERTICAL );
align( (Fl_Align)(FL_ALIGN_CENTER | FL_ALIGN_INSIDE ) );
dpm_pack->add( dpm );
@ -171,6 +172,8 @@ Meter_Indicator_Module::update_cb ( void )
dpm->value( -70.0f );
}
// redraw();
/* engine->unlock(); */
}
else
@ -181,8 +184,6 @@ Meter_Indicator_Module::update_cb ( void )
}
}
}
// redraw();
}
void
@ -190,11 +191,12 @@ Meter_Indicator_Module::connect_to ( Port *p )
{
control_input[0].connect_to( p );
DPM *o = new DPM( x(), y(), this->w(), h() );
o->type( FL_VERTICAL );
align( (Fl_Align)(FL_ALIGN_CENTER | FL_ALIGN_INSIDE ) );
/* DPM *o = new DPM( 10, 10, 10, 10 ); */
/* o->type( FL_VERTICAL ); */
dpm_pack->add( o );
/* dpm_pack->add( o ); */
redraw();
}
@ -206,7 +208,7 @@ Meter_Indicator_Module::handle ( int m )
{
case FL_PUSH:
{
if ( test_press( FL_BUTTON1 ) )
if ( Fl::event_button1() )
{
/* don't let Module::handle eat our click */
return Fl_Group::handle( m );
@ -214,7 +216,7 @@ Meter_Indicator_Module::handle ( int m )
}
}
return 0;
return Module::handle( m );
}
@ -244,10 +246,13 @@ Meter_Indicator_Module::handle_control_changed ( Port *p )
align( (Fl_Align)(FL_ALIGN_CENTER | FL_ALIGN_INSIDE ) );
dpm_pack->add( dpm );
dpm_pack->redraw();
control_value[i] = -70.0f;
dpm->value( -70.0f );
}
redraw();
}
}
}

View File

@ -67,7 +67,7 @@ protected:
virtual void draw ( void )
{
draw_box();
// draw_box();
Fl_Group::draw();
}
@ -75,6 +75,4 @@ protected:
private:
Fl_Valuator *control;
};

View File

@ -61,10 +61,11 @@ Module::Module ( bool is_default, int W, int H, const char *L ) : Fl_Group( 0, 0
log_create();
}
Module::Module ( ) : Fl_Group( 0, 0, 0, 50, "Unnamed" )
Module::Module ( ) : Fl_Group( 0, 0, 50, 50, "Unnamed" )
{
init();
log_create();
}
@ -186,7 +187,6 @@ Module::paste_before ( void )
m->copy();
}
void
Module::set ( Log_Entry &e )
{