GUI tweaks.

This commit is contained in:
Jonathan Moore Liles 2012-03-02 00:03:53 -08:00
parent 26fa9eba3b
commit 32bd29a28b
4 changed files with 54 additions and 22 deletions

View File

@ -38,6 +38,7 @@ public:
{ {
clear_visible_focus(); clear_visible_focus();
up_box( FL_NO_BOX ); up_box( FL_NO_BOX );
when(FL_WHEN_ENTER_KEY);
} }
void up_box ( Fl_Boxtype b ) { _up_box = b; } void up_box ( Fl_Boxtype b ) { _up_box = b; }
@ -51,7 +52,7 @@ public:
else else
{ {
fl_draw_box( up_box(), x(), y(), w(), h(), color() ); fl_draw_box( up_box(), x(), y(), w(), h(), color() );
fl_color( FL_FOREGROUND_COLOR /* textcolor() */ ); fl_color( fl_contrast( textcolor(), color() ) );
fl_font( textfont(), textsize() ); fl_font( textfont(), textsize() );
fl_draw( value(), x(), y(), w(), h(), (Fl_Align)(FL_ALIGN_CENTER | FL_ALIGN_CLIP) ); fl_draw( value(), x(), y(), w(), h(), (Fl_Align)(FL_ALIGN_CENTER | FL_ALIGN_CLIP) );
} }

View File

@ -136,12 +136,13 @@ Chain::Chain ( ) : Fl_Group( 0, 0, 100, 100, "")
o->end(); o->end();
} }
{ Fl_Group *o = control_tab = new Fl_Group( X, Y, W, H, "" ); { Fl_Group *o = control_tab = new Fl_Group( X, Y, W, H, "" );
o->box( FL_NO_BOX ); o->box( FL_FLAT_BOX );
o->color( FL_BACKGROUND_COLOR );
o->labeltype( FL_NO_LABEL ); o->labeltype( FL_NO_LABEL );
o->hide(); o->hide();
{ Fl_Scroll *o = new Fl_Scroll( X, Y, W, H ); { Fl_Scroll *o = new Fl_Scroll( X, Y, W, H );
o->color( FL_BACKGROUND_COLOR ); // o->color( FL_BACKGROUND_COLOR );
o->box( FL_FLAT_BOX ); o->box( FL_NO_BOX );
o->type( Fl_Scroll::VERTICAL ); o->type( Fl_Scroll::VERTICAL );
{ Fl_Flowpack *o = controls_pack = new Fl_Flowpack( X, Y, W, H ); { Fl_Flowpack *o = controls_pack = new Fl_Flowpack( X, Y, W, H );
o->hspacing( 10 ); o->hspacing( 10 );

View File

@ -26,7 +26,7 @@
/* we cache the gradient for (probably excessive) speed */ /* we cache the gradient for (probably excessive) speed */
float DPM::_dim; float DPM::_dim;
Fl_Color DPM::_gradient[128] = { (Fl_Color)-1 }; Fl_Color DPM::_gradient[128] = { (Fl_Color)0 };
Fl_Color DPM::_dim_gradient[128]; Fl_Color DPM::_dim_gradient[128];
#include <FL/Fl.H> #include <FL/Fl.H>
@ -52,7 +52,7 @@ DPM::DPM ( int X, int Y, int W, int H, const char *L ) :
dim( 0.70f ); dim( 0.70f );
/* initialize gradients */ /* initialize gradients */
if ( DPM::_gradient[ 0 ] == -1 ) if ( DPM::_gradient[ 0 ] == 0 )
DPM::blend( FL_GREEN, FL_RED ); DPM::blend( FL_GREEN, FL_RED );
box( FL_ROUNDED_BOX ); box( FL_ROUNDED_BOX );
@ -121,6 +121,11 @@ DPM::draw ( void )
if ( ! fl_not_clipped( x(), y(), w(), h() ) ) if ( ! fl_not_clipped( x(), y(), w(), h() ) )
return; return;
int X = x() + 2;
int Y = y() + 2;
int W = w() - 4;
int H = h() - 4;
int v = pos( value() ); int v = pos( value() );
int pv = pos( peak() ); int pv = pos( peak() );
@ -128,8 +133,14 @@ DPM::draw ( void )
int bw = w() / _segments; int bw = w() / _segments;
if ( damage() == FL_DAMAGE_ALL ) if ( damage() == FL_DAMAGE_ALL )
{
draw_label(); draw_label();
draw_box( FL_UP_FRAME, x(), y(), w(), h(), FL_BLACK );
}
fl_push_clip( X, Y, W, H );
const int active = active_r(); const int active = active_r();
int hi, lo; int hi, lo;
@ -156,6 +167,7 @@ DPM::draw ( void )
_last_drawn_hi_segment = v; _last_drawn_hi_segment = v;
for ( int p = lo; p <= hi; p++ ) for ( int p = lo; p <= hi; p++ )
{ {
Fl_Color c = DPM::div_color( p ); Fl_Color c = DPM::div_color( p );
@ -166,26 +178,42 @@ DPM::draw ( void )
if ( ! active ) if ( ! active )
c = fl_inactive( c ); c = fl_inactive( c );
if ( _pixels_per_segment < 4 ) int yy = 0;
int xx = 0;
if ( type() == FL_HORIZONTAL )
{ {
if ( type() == FL_HORIZONTAL ) xx = X + p * bw;
fl_rectf( x() + (p * bw), y(), bw, h(), c ); fl_rectf( X + (p * bw), Y, bw, H, c );
else
fl_rectf( x(), y() + h() - ((p + 1) * bh), w(), bh, c );
} }
else else
{ {
if ( type() == FL_HORIZONTAL ) yy = Y + H - ((p + 1) * bh);
fl_draw_box( box(), x() + (p * bw), y(), bw, h(), c ); fl_rectf( X, yy, W, bh, c );
else
fl_draw_box( box(), x(), y() + h() - ((p + 1) * bh), w(), bh, c );
} }
/* fl_color( c ); */ if ( _pixels_per_segment > 3 )
/* fl_rectf( x(), y() + h() - (p * bh), w(), bh ); */ {
/* fl_color( FL_BLACK ); */ fl_color( FL_BLACK );
/* fl_rect( x(), y() + h() - (p * bh), w(), bh ); */
} if ( type() == FL_HORIZONTAL )
{
fl_line( xx, Y, xx, Y + H - 1 );
}
else
{
fl_line( X, yy, X + W - 1, yy );
}
}
/* } */
/* else */
/* { */
/* if ( type() == FL_HORIZONTAL ) */
/* fl_draw_box( box(), X + (p * bw), Y, bw, H, c ); */
/* else */
/* fl_draw_box( box(), X, Y + H - ((p + 1) * bh), W, bh, c ); */
/* } */
}
fl_pop_clip();
} }

View File

@ -240,7 +240,10 @@ void Mixer_Strip::cb_handle(Fl_Widget* o) {
command_close(); command_close();
} }
else if ( o == name_field ) else if ( o == name_field )
{
name( name_field->value() ); name( name_field->value() );
take_focus();
}
else if ( o == width_button ) else if ( o == width_button )
{ {
if ( width_button->value() ) if ( width_button->value() )
@ -378,7 +381,6 @@ Mixer_Strip::init ( )
o->textcolor( FL_FOREGROUND_COLOR ); o->textcolor( FL_FOREGROUND_COLOR );
o->value( name() ); o->value( name() );
o->callback( cb_handle, (void*)this ); o->callback( cb_handle, (void*)this );
} }
{ Fl_Scalepack *o = new Fl_Scalepack( 7, 143, 110, 25 ); { Fl_Scalepack *o = new Fl_Scalepack( 7, 143, 110, 25 );
o->type( Fl_Pack::HORIZONTAL ); o->type( Fl_Pack::HORIZONTAL );