Clean up some focus and display issues.

pull/3/head
Jonathan Moore Liles 2008-04-26 22:50:58 -05:00
parent 82ada52b71
commit 754aa55af4
6 changed files with 52 additions and 52 deletions

View File

@ -42,7 +42,7 @@ public:
Fl_Input::draw(); Fl_Input::draw();
else else
{ {
fl_color( FL_WHITE /* textcolor() */ ); fl_color( FL_FOREGROUND_COLOR /* textcolor() */ );
fl_font( textfont(), textsize() ); fl_font( textfont(), textsize() );
fl_draw( value(), x(), y(), w(), h(), FL_ALIGN_CENTER ); fl_draw( value(), x(), y(), w(), h(), FL_ALIGN_CENTER );
} }
@ -65,47 +65,14 @@ public:
return r; return r;
case FL_UNFOCUS: case FL_UNFOCUS:
_editing = false; _editing = false;
{
/* lame, but we have to find the next parent
* with a box in order to clear the background
* properly */
Fl_Group *g = parent(); if ( window() )
window()->damage( FL_DAMAGE_EXPOSE, x(), y(), w(), h() );
for ( ; g; g = g->parent() )
{
switch ( g->box() )
{
case FL_NO_BOX:
case FL_UP_FRAME:
case FL_DOWN_FRAME:
case FL_THIN_UP_FRAME:
case FL_THIN_DOWN_FRAME:
case FL_ENGRAVED_FRAME:
case FL_EMBOSSED_FRAME:
// case FL_SHADOW_FRAME:
// case FL_PLASTIC_UP_FRAME:
// case FL_PLASTIC_DOWN_FRAME:
// case FL_ROUNDED_FRAME:
// case FL_OVAL_FRAME:
continue;
default:
break;
}
break;
}
if ( g )
{
printf( "damaging parent\n" );
g->damage( FL_DAMAGE_EXPOSE, x(), y(), w(), h() );
}
}
redraw(); redraw();
return r; return r;
default: default:
return r; return r;
} }
} }
}; };

View File

@ -134,11 +134,11 @@ protected:
else if ( ! strcmp( s, ":fade-in-type" ) ) else if ( ! strcmp( s, ":fade-in-type" ) )
_fade_in.type = (Fade::fade_type_e)atoi( v ); _fade_in.type = (Fade::fade_type_e)atoi( v );
else if ( ! strcmp( s, ":fade-in-duration" ) ) else if ( ! strcmp( s, ":fade-in-duration" ) )
_fade_in.length = atol( v ); _fade_in.length = atoll( v );
else if ( ! strcmp( s, ":fade-out-type" ) ) else if ( ! strcmp( s, ":fade-out-type" ) )
_fade_out.type = (Fade::fade_type_e)atoi( v ); _fade_out.type = (Fade::fade_type_e)atoi( v );
else if ( ! strcmp( s, ":fade-out-duration" ) ) else if ( ! strcmp( s, ":fade-out-duration" ) )
_fade_out.length = atol( v ); _fade_out.length = atoll( v );
else if ( ! strcmp( s, ":source" ) ) else if ( ! strcmp( s, ":source" ) )
{ {
if ( ! ( _clip = Audio_File::from_file( v ) ) ) if ( ! ( _clip = Audio_File::from_file( v ) ) )

View File

@ -179,7 +179,7 @@ exit( 0 );}
xywh {0 0 74 25} xywh {0 0 74 25}
} { } {
MenuItem {} { MenuItem {} {
label Home label Start
callback {transport->locate( 0 );} callback {transport->locate( 0 );}
xywh {0 0 40 25} shortcut 0xff50 xywh {0 0 40 25} shortcut 0xff50
} }
@ -200,6 +200,7 @@ exit( 0 );}
} }
MenuItem {} { MenuItem {} {
label Record label Record
callback {transport->toggle_record();} selected
xywh {40 40 40 25} shortcut 0x50072 xywh {40 40 40 25} shortcut 0x50072
} }
} }
@ -252,7 +253,7 @@ exit( 0 );}
} { } {
MenuItem {} { MenuItem {} {
label Bars label Bars
callback {Timeline::snap_to = Timeline::Bars;} selected callback {Timeline::snap_to = Timeline::Bars;}
xywh {0 0 40 25} type Radio value 1 xywh {0 0 40 25} type Radio value 1
} }
MenuItem {} { MenuItem {} {

View File

@ -465,7 +465,7 @@ Timeline::draw ( void )
|| ||
damage() & FL_DAMAGE_EXPOSE ) damage() & FL_DAMAGE_EXPOSE )
{ {
draw_box( box(), 0, 0, w(), h(), color() ); draw_box( box(), 0, 0, w(), h(), this == Fl::focus() ? color() : fl_darker( color() ) );
fl_push_clip( 0, rulers->y(), w(), rulers->h() ); fl_push_clip( 0, rulers->y(), w(), rulers->h() );
draw_child( *rulers ); draw_child( *rulers );
@ -717,8 +717,17 @@ Timeline::handle ( int m )
switch ( m ) switch ( m )
{ {
case FL_FOCUS:
case FL_UNFOCUS:
redraw();
return 1;
case FL_KEYBOARD: case FL_KEYBOARD:
case FL_SHORTCUT:
{ {
if ( Fl::event_state() & ( FL_ALT || FL_CTRL || FL_SHIFT ) )
/* we don't want any keys with modifiers... */
return 0;
switch ( Fl::event_key() ) switch ( Fl::event_key() )
{ {
case FL_Delete: case FL_Delete:
@ -727,14 +736,10 @@ Timeline::handle ( int m )
return 1; return 1;
} }
case FL_Home:
/* case FL_Home: */ case FL_End:
/* transport->locate( 0 ); */ /* keep scrollbar from eating these. */
/* return 1; */ return 0;
/* case ' ': */
/* transport->toggle(); */
/* return 1; */
case 'p': case 'p':
{ {
int X = Fl::event_x() - Track::width(); int X = Fl::event_x() - Track::width();
@ -776,6 +781,10 @@ Timeline::handle ( int m )
} }
default: default:
{ {
if ( m == FL_PUSH )
Fl::focus( this );
int r = Fl_Overlay_Window::handle( m ); int r = Fl_Overlay_Window::handle( m );
if ( m != FL_RELEASE && r ) if ( m != FL_RELEASE && r )
@ -788,7 +797,7 @@ Timeline::handle ( int m )
{ {
case FL_PUSH: case FL_PUSH:
{ {
take_focus(); // take_focus();
if ( Fl::event_button1() ) if ( Fl::event_button1() )
{ {

View File

@ -130,10 +130,10 @@ Track::init ( void )
o->color( ( Fl_Color ) 53 ); o->color( ( Fl_Color ) 53 );
{ {
Fl_Input *o = name_field = new Fl_Sometimes_Input( 2, 2, 144, 24 ); Fl_Input *o = name_field = new Fl_Sometimes_Input( 2, 2, 144, 24 );
o->color( ( Fl_Color ) 33 ); o->color( FL_BACKGROUND_COLOR );
o->labeltype( FL_NO_LABEL ); o->labeltype( FL_NO_LABEL );
o->labelcolor( FL_GRAY0 ); o->labelcolor( FL_GRAY0 );
o->textcolor( 32 ); o->textcolor( FL_FOREGROUND_COLOR );
o->callback( cb_input_field, (void*)this ); o->callback( cb_input_field, (void*)this );
} }

View File

@ -67,6 +67,17 @@ private:
public: public:
void toggle_record ( void )
{
if ( _record_button->value() )
_record_button->value( 0 );
else
_record_button->value( 1 );
_record_button->do_callback();
}
Transport ( int X, int Y, int W, int H, const char *L=0 ) Transport ( int X, int Y, int W, int H, const char *L=0 )
: Fl_Pack( X, Y, W, H, L ) : Fl_Pack( X, Y, W, H, L )
{ {
@ -104,6 +115,18 @@ public:
end(); end();
} }
int
handle ( int m )
{
/* FIXME: hack to avoid stealing focus */
if ( m == FL_FOCUS )
return 0;
else
return Fl_Pack::handle( m );
}
bool rolling; bool rolling;
void poll ( void ); void poll ( void );