diff --git a/Boxtypes.C b/Boxtypes.C new file mode 100644 index 0000000..436bfa2 --- /dev/null +++ b/Boxtypes.C @@ -0,0 +1,67 @@ + +/*******************************************************************************/ +/* Copyright (C) 2008 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 */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +#include "Boxtypes.H" +#include + +/** This simple box is suitable for use with knob-type widgets. It + * comprises a border with shadow, and a cap with glare-lines akin + * to those seen on burnished aluminum knobs. */ +static void +draw_burnished_oval_box ( int x, int y, int w, int h, Fl_Color c ) +{ + /* draw background */ + fl_color( fl_darker( c ) ); + fl_pie( x, y, w, h, 0, 360 ); + fl_color( fl_darker( fl_darker( c ) ) ); + fl_pie( x, y, w, h, 180 + 215, 180 + 45 ); + + /* shrink */ + x += 4; + y += 4; + w -= 7; + h -= 7; + + /* draw cap */ + fl_color( c ); + fl_pie( x, y, w, h, 0, 360 ); + + /* draw glare */ + + const int a1 = 10; + const int a2 = 90; + + fl_color( fl_lighter( c ) ); + fl_pie( x, y, w, h, a1, a2 ); + fl_pie( x, y, w, h, 180 + a1, 180 + a2 ); + fl_color( fl_lighter( fl_lighter( c ) ) ); + + const int d = (a2 - a1) / 2; + fl_pie( x, y, w, h, a1 + (d / 2), a2 - (d / 2) ); + fl_pie( x, y, w, h, 180 + a1 + (d / 2), 180 + a2 - (d / 2) ); +} + + + + +void +init_boxtypes ( void ) +{ + Fl::set_boxtype( FL_BURNISHED_OVAL_BOX, draw_burnished_oval_box, 4, 4, 7, 7 ); +} diff --git a/Boxtypes.H b/Boxtypes.H new file mode 100644 index 0000000..2b81280 --- /dev/null +++ b/Boxtypes.H @@ -0,0 +1,24 @@ + +/*******************************************************************************/ +/* Copyright (C) 2008 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 */ +/* Free Software Foundation; either version 2 of the License, or (at your */ +/* option) any later version. */ +/* */ +/* This program is distributed in the hope that it will be useful, but WITHOUT */ +/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ +/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */ +/* more details. */ +/* */ +/* You should have received a copy of the GNU General Public License along */ +/* with This program; see the file COPYING. If not,write to the Free Software */ +/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/*******************************************************************************/ + +#include + +#define FL_BURNISHED_OVAL_BOX FL_FREE_BOXTYPE + +void init_boxtypes ( void ); diff --git a/Fl_Arc_Dial.H b/Fl_Arc_Dial.H index 4b308ba..e532bb9 100644 --- a/Fl_Arc_Dial.H +++ b/Fl_Arc_Dial.H @@ -39,42 +39,6 @@ public: private: - /** This simple box is suitable for use with knob-type widgets. It - * comprises a border with shadow, and a cap with glare-lines akin - * to those seen on burnished aluminum knobs. */ - static void - draw_burnished_oval_box ( int x, int y, int w, int h, Fl_Color c ) - { - /* draw background */ - fl_color( fl_darker( c ) ); - fl_pie( x, y, w, h, 0, 360 ); - fl_color( fl_darker( fl_darker( c ) ) ); - fl_pie( x, y, w, h, 180 + 215, 180 + 45 ); - - /* shrink */ - x += w / 8; - y += h / 8; - h -= h / 4; - w -= w / 4; - - /* draw cap */ - fl_color( c ); - fl_pie( x, y, w, h, 0, 360 ); - - /* draw glare */ - - const int a1 = 10; - const int a2 = 90; - - fl_color( fl_lighter( c ) ); - fl_pie( x, y, w, h, a1, a2 ); - fl_pie( x, y, w, h, 180 + a1, 180 + a2 ); - fl_color( fl_lighter( fl_lighter( c ) ) ); - - const int d = (a2 - a1) / 2; - fl_pie( x, y, w, h, a1 + (d / 2), a2 - (d / 2) ); - fl_pie( x, y, w, h, 180 + a1 + (d / 2), 180 + a2 - (d / 2) ); - } protected: @@ -116,8 +80,11 @@ protected: int W = w(); int H = h(); - if ( damage() & FL_DAMAGE_ALL ) - draw_box( box(), X, Y, W, H, color() ); +/* if ( damage() & FL_DAMAGE_ALL ) */ + draw_box(); +// draw_box( box(), X, Y, W, H, color() ); + +// draw_burnished_oval_box( x(), y(), w(), h(), color() ); X += Fl::box_dx(box()); Y += Fl::box_dy(box()); @@ -127,7 +94,6 @@ protected: double angle = ( angle2() - angle1() ) * ( value() - minimum()) / ( maximum() - minimum() ) + angle1(); // draw_box(); - draw_burnished_oval_box( x(), y(), w(), h(), color() ); draw_label(); diff --git a/Makefile b/Makefile index 469d04b..a2101b9 100644 --- a/Makefile +++ b/Makefile @@ -26,8 +26,8 @@ $(OBJS): Makefile test: $(OBJS) $(CXX) $(CXXFLAGS) $(LIBS) $(OBJS) -o $@ -mixer: Mixer_Strip.o Mixer.o DPM.o Fl_Scalepack.o Panner.o - $(CXX) $(CXXFLAGS) $(LIBS) Mixer_Strip.o Mixer.o DPM.o Fl_Scalepack.o Panner.o -o $@ +mixer: Mixer_Strip.o Mixer.o DPM.o Fl_Scalepack.o Panner.o Boxtypes.o + $(CXX) $(CXXFLAGS) $(LIBS) Mixer_Strip.o Mixer.o DPM.o Fl_Scalepack.o Boxtypes.o Panner.o -o $@ ESRCS=Audio_File.C Audio_File_SF.C Loggable.C diff --git a/Mixer_Strip.fl b/Mixer_Strip.fl index eb1f344..121627b 100644 --- a/Mixer_Strip.fl +++ b/Mixer_Strip.fl @@ -14,6 +14,9 @@ decl {\#include "Fl_Scalepack.H"} {public global decl {\#include "Fl_Flip_Button.H"} {public global } +decl {\#include "Boxtypes.H"} {public global +} + decl {\#include "Fl_Arc_Dial.H"} {public global } @@ -86,27 +89,28 @@ widget_class Mixer_Strip {open } } Fl_Box {} { - label Pan selected + label Pan xywh {6 693 110 90} box THIN_UP_BOX color 32 labelsize 11 align 1 class Panner } - Fl_Progress {} { - xywh {8 789 110 21} labeltype NO_LABEL - } Fl_Dial {} { xywh {10 36 41 39} box OVAL_FRAME color 52 selection_color 55 + code0 {o->box( FL_BURNISHED_OVAL_BOX );} class Fl_Arc_Dial } Fl_Dial {} { - xywh {10 80 41 39} box OVAL_FRAME color 52 selection_color 55 + xywh {10 80 41 39} selection_color 55 + code0 {o->box( FL_BURNISHED_OVAL_BOX );} class Fl_Arc_Dial } Fl_Dial {} { xywh {73 36 41 39} box OVAL_FRAME color 52 selection_color 55 + code0 {o->box( FL_BURNISHED_OVAL_BOX );} class Fl_Arc_Dial } - Fl_Dial {} { + Fl_Dial {} {selected xywh {73 80 41 39} box OVAL_FRAME color 52 selection_color 55 + code0 {o->box( FL_BURNISHED_OVAL_BOX );} class Fl_Arc_Dial } } diff --git a/Panner.C b/Panner.C index b39859c..a5ba63e 100644 --- a/Panner.C +++ b/Panner.C @@ -223,19 +223,10 @@ Panner::draw ( void ) } /* return the current gain setting for the path in/out */ -float -Panner::gain ( int ich, int och ) +Panner::Point +Panner::point( int i ) { - int a = _configs[ _outs ][ och ]; - -// float g = 1.0f - drag->distance( Point( 1.0f, a ) ) / 2.0f; - float g = _points[ ich ].distance( Point( 1.0f, a ) ) / 2.0f; - -/* g = 1.0f / pow( g, 2 ); */ - -/* g = 20.0f * log10f( g ); */ - - return g; + return _points[ i ]; } int @@ -269,30 +260,13 @@ Panner::handle ( int m ) int tx, ty, tw, th; bbox( tx, ty, tw, th ); - if ( _outs < 3 ) - drag->angle( (float)(X / (tw / 2)) - 1.0f, 0.0f ); - else +/* if ( _outs < 3 ) */ +/* drag->angle( (float)(X / (tw / 2)) - 1.0f, 0.0f ); */ +/* else */ drag->angle( (float)(X / (tw / 2)) - 1.0f, (float)(Y / (th / 2)) - 1.0f ); - /* calculate gains for all output channels */ - { - for ( int i = _ins; i--; ) - { - int a = _configs[ _outs ][ i ]; - -// float g = 1.0f - drag->distance( Point( 1.0f, a ) ) / 2.0f; - float g = drag->distance( Point( 1.0f, a ) ) / 2.0f; - -/* g = 1.0f / pow( g, 2 ); */ - -/* g = 20.0f * log10f( g ); */ - - printf( "%d:%f ", i, g ); - } - - printf( "\n" ); - } + printf( "%f %f\n", drag->a, drag->d ); redraw(); diff --git a/Panner.H b/Panner.H index 8afcf1b..4b8c307 100644 --- a/Panner.H +++ b/Panner.H @@ -151,7 +151,7 @@ public: _ins = 1; - _outs = 7; + _outs = 1; // _ins = _outs = 4; @@ -166,6 +166,6 @@ public: virtual ~Panner ( ) { } - float gain ( int ich, int och ); + Panner::Point point ( int i ); };