Minor cleanup

This commit is contained in:
Jonathan Moore Liles 2008-03-14 00:37:10 -05:00
parent a002805fcc
commit 53389dbe54
3 changed files with 52 additions and 16 deletions

View File

@ -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 {<Oscilloscope>}
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
}
}

View File

@ -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;

View File

@ -23,6 +23,8 @@
#include <FL/fl_draw.H>
#include <FL/Fl.H>
#include <math.h>
#include <vector>
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: