Make properly register burnished box.
This commit is contained in:
parent
860c4fc23c
commit
3082d8ce03
|
@ -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 <FL/fl_draw.H>
|
||||||
|
|
||||||
|
/** 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 );
|
||||||
|
}
|
|
@ -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 <Fl/Fl.H>
|
||||||
|
|
||||||
|
#define FL_BURNISHED_OVAL_BOX FL_FREE_BOXTYPE
|
||||||
|
|
||||||
|
void init_boxtypes ( void );
|
|
@ -39,42 +39,6 @@ public:
|
||||||
|
|
||||||
private:
|
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:
|
protected:
|
||||||
|
|
||||||
|
@ -116,8 +80,11 @@ protected:
|
||||||
int W = w();
|
int W = w();
|
||||||
int H = h();
|
int H = h();
|
||||||
|
|
||||||
if ( damage() & FL_DAMAGE_ALL )
|
/* if ( damage() & FL_DAMAGE_ALL ) */
|
||||||
draw_box( box(), X, Y, W, H, color() );
|
draw_box();
|
||||||
|
// draw_box( box(), X, Y, W, H, color() );
|
||||||
|
|
||||||
|
// draw_burnished_oval_box( x(), y(), w(), h(), color() );
|
||||||
|
|
||||||
X += Fl::box_dx(box());
|
X += Fl::box_dx(box());
|
||||||
Y += Fl::box_dy(box());
|
Y += Fl::box_dy(box());
|
||||||
|
@ -127,7 +94,6 @@ protected:
|
||||||
double angle = ( angle2() - angle1() ) * ( value() - minimum()) / ( maximum() - minimum() ) + angle1();
|
double angle = ( angle2() - angle1() ) * ( value() - minimum()) / ( maximum() - minimum() ) + angle1();
|
||||||
|
|
||||||
// draw_box();
|
// draw_box();
|
||||||
draw_burnished_oval_box( x(), y(), w(), h(), color() );
|
|
||||||
|
|
||||||
draw_label();
|
draw_label();
|
||||||
|
|
||||||
|
|
4
Makefile
4
Makefile
|
@ -26,8 +26,8 @@ $(OBJS): Makefile
|
||||||
test: $(OBJS)
|
test: $(OBJS)
|
||||||
$(CXX) $(CXXFLAGS) $(LIBS) $(OBJS) -o $@
|
$(CXX) $(CXXFLAGS) $(LIBS) $(OBJS) -o $@
|
||||||
|
|
||||||
mixer: Mixer_Strip.o Mixer.o DPM.o Fl_Scalepack.o Panner.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 Panner.o -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
|
ESRCS=Audio_File.C Audio_File_SF.C Loggable.C
|
||||||
|
|
|
@ -14,6 +14,9 @@ decl {\#include "Fl_Scalepack.H"} {public global
|
||||||
decl {\#include "Fl_Flip_Button.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
|
decl {\#include "Fl_Arc_Dial.H"} {public global
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,27 +89,28 @@ widget_class Mixer_Strip {open
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Fl_Box {} {
|
Fl_Box {} {
|
||||||
label Pan selected
|
label Pan
|
||||||
xywh {6 693 110 90} box THIN_UP_BOX color 32 labelsize 11 align 1
|
xywh {6 693 110 90} box THIN_UP_BOX color 32 labelsize 11 align 1
|
||||||
class Panner
|
class Panner
|
||||||
}
|
}
|
||||||
Fl_Progress {} {
|
|
||||||
xywh {8 789 110 21} labeltype NO_LABEL
|
|
||||||
}
|
|
||||||
Fl_Dial {} {
|
Fl_Dial {} {
|
||||||
xywh {10 36 41 39} box OVAL_FRAME color 52 selection_color 55
|
xywh {10 36 41 39} box OVAL_FRAME color 52 selection_color 55
|
||||||
|
code0 {o->box( FL_BURNISHED_OVAL_BOX );}
|
||||||
class Fl_Arc_Dial
|
class Fl_Arc_Dial
|
||||||
}
|
}
|
||||||
Fl_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
|
class Fl_Arc_Dial
|
||||||
}
|
}
|
||||||
Fl_Dial {} {
|
Fl_Dial {} {
|
||||||
xywh {73 36 41 39} box OVAL_FRAME color 52 selection_color 55
|
xywh {73 36 41 39} box OVAL_FRAME color 52 selection_color 55
|
||||||
|
code0 {o->box( FL_BURNISHED_OVAL_BOX );}
|
||||||
class Fl_Arc_Dial
|
class Fl_Arc_Dial
|
||||||
}
|
}
|
||||||
Fl_Dial {} {
|
Fl_Dial {} {selected
|
||||||
xywh {73 80 41 39} box OVAL_FRAME color 52 selection_color 55
|
xywh {73 80 41 39} box OVAL_FRAME color 52 selection_color 55
|
||||||
|
code0 {o->box( FL_BURNISHED_OVAL_BOX );}
|
||||||
class Fl_Arc_Dial
|
class Fl_Arc_Dial
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
40
Panner.C
40
Panner.C
|
@ -223,19 +223,10 @@ Panner::draw ( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return the current gain setting for the path in/out */
|
/* return the current gain setting for the path in/out */
|
||||||
float
|
Panner::Point
|
||||||
Panner::gain ( int ich, int och )
|
Panner::point( int i )
|
||||||
{
|
{
|
||||||
int a = _configs[ _outs ][ och ];
|
return _points[ i ];
|
||||||
|
|
||||||
// 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -269,30 +260,13 @@ Panner::handle ( int m )
|
||||||
int tx, ty, tw, th;
|
int tx, ty, tw, th;
|
||||||
bbox( tx, ty, tw, th );
|
bbox( tx, ty, tw, th );
|
||||||
|
|
||||||
if ( _outs < 3 )
|
/* if ( _outs < 3 ) */
|
||||||
drag->angle( (float)(X / (tw / 2)) - 1.0f, 0.0f );
|
/* drag->angle( (float)(X / (tw / 2)) - 1.0f, 0.0f ); */
|
||||||
else
|
/* else */
|
||||||
drag->angle( (float)(X / (tw / 2)) - 1.0f, (float)(Y / (th / 2)) - 1.0f );
|
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 ];
|
printf( "%f %f\n", drag->a, drag->d );
|
||||||
|
|
||||||
// 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" );
|
|
||||||
}
|
|
||||||
|
|
||||||
redraw();
|
redraw();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue