From 53389dbe54c1a5b97f27bc330cc0b8db0193b8cd Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Fri, 14 Mar 2008 00:37:10 -0500 Subject: [PATCH] Minor cleanup --- Mixer_Strip.fl | 23 +++++++++++++++++++++-- Panner.C | 34 ++++++++++++++++++++-------------- Panner.H | 11 +++++++++++ 3 files changed, 52 insertions(+), 16 deletions(-) diff --git a/Mixer_Strip.fl b/Mixer_Strip.fl index 646d820..9ea1544 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 "Fl_Arc_Dial.H"} {public global +} + widget_class Mixer_Strip {open xywh {1051 42 124 816} type Double box UP_FRAME color 32 selection_color 63 resizable code0 {size( 120, h() );} visible @@ -24,7 +27,7 @@ widget_class Mixer_Strip {open } Fl_Box {} { label {} - xywh {7 33 110 104} box UP_FRAME + xywh {7 33 110 104} box UP_FRAME hide } Fl_Group {} {open xywh {7 143 110 25} @@ -83,11 +86,27 @@ widget_class Mixer_Strip {open } } Fl_Box {} { - label Pan selected + label Pan xywh {6 693 110 90} box THIN_UP_BOX 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 + class Fl_Arc_Dial + } + Fl_Dial {} {selected + xywh {10 80 41 39} box OVAL_FRAME color 52 selection_color 55 + class Fl_Arc_Dial + } + Fl_Dial {} { + xywh {73 36 41 39} box OVAL_FRAME color 52 selection_color 55 + class Fl_Arc_Dial + } + Fl_Dial {} { + xywh {73 80 41 39} box OVAL_FRAME color 52 selection_color 55 + class Fl_Arc_Dial + } } diff --git a/Panner.C b/Panner.C index bbc5e77..1af0420 100644 --- a/Panner.C +++ b/Panner.C @@ -105,28 +105,28 @@ Panner::event_point ( void ) return NULL; } -#if 0 /* translate angle /a/ into x/y coords and place the result in /X/ and /Y/ */ -void -Panner::angle_to_axes ( float a, float *X, float *Y ) +Panner::Point +Panner::angle_to_axes ( float a ) { + Point p; - float A; -// int X, Y; + a -= 90; + a = 360 - a; + + double A; A = a * ( M_PI / 180 ); - float r = tw / 2; + // const float r = tw / 2; - X = r * cos( A ); - Y = -r * sin( A ); + const double r = 1.0f; -/* fl_push_matrix(); */ - -/* fl_translate( (tx + (tw / 2)) + X, (ty + (th / 2)) + Y ); */ + p.x = r * cos( A ); + p.y = -r * sin( A ); + return p; } -#endif void Panner::draw ( void ) @@ -161,9 +161,13 @@ Panner::draw ( void ) a -= 90; a = 360 - a; -/* fl_color( FL_WHITE ); */ +/* /\* fl_color( FL_WHITE ); *\/ */ +/* fl_line_style( FL_SOLID, 10 ); */ +/* fl_arc( tx, ty, tw, th, a - 20, a + 20 ); */ +/* fl_line_style( FL_SOLID, 0 ); */ -/* fl_arc( tx, ty, tw, th, a - 3, a + 3 ); */ + Point p = angle_to_axes( a ); +// printf( "%d: %f, %f\n", i, p.x, p.y ); { float A; @@ -245,6 +249,8 @@ Panner::handle ( int m ) drag->x = (float)(X / (w() / 2)) - 1.0f; drag->y = (float)(Y / (h() / 2)) - 1.0f; + printf( "%f\n", drag->distance( angle_to_axes( _configs[ _outs ][ 0 ] ) ) ); + redraw(); return 1; diff --git a/Panner.H b/Panner.H index e88c807..919d20d 100644 --- a/Panner.H +++ b/Panner.H @@ -23,6 +23,8 @@ #include #include +#include + #include using namespace std; @@ -36,6 +38,14 @@ class Panner : public Fl_Widget Point ( ) : x( 0.0f ), y( 0.0f ) { } Point ( float X, float Y ) : x( X ), y( Y ) { } + + + /* return the distance between the point and that referenced by /p/ */ + float + distance ( const Point &p ) + { + return sqrt( pow( x - p.x, 2 ) + pow( y - p.y, 2 ) ); + } }; @@ -59,6 +69,7 @@ class Panner : public Fl_Widget } Point * event_point ( void ); + Point angle_to_axes ( float a ); public: