Clean up some focus and display issues.
This commit is contained in:
parent
82ada52b71
commit
754aa55af4
|
@ -42,7 +42,7 @@ public:
|
|||
Fl_Input::draw();
|
||||
else
|
||||
{
|
||||
fl_color( FL_WHITE /* textcolor() */ );
|
||||
fl_color( FL_FOREGROUND_COLOR /* textcolor() */ );
|
||||
fl_font( textfont(), textsize() );
|
||||
fl_draw( value(), x(), y(), w(), h(), FL_ALIGN_CENTER );
|
||||
}
|
||||
|
@ -65,47 +65,14 @@ public:
|
|||
return r;
|
||||
case FL_UNFOCUS:
|
||||
_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();
|
||||
return r;
|
||||
default:
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -134,11 +134,11 @@ protected:
|
|||
else if ( ! strcmp( s, ":fade-in-type" ) )
|
||||
_fade_in.type = (Fade::fade_type_e)atoi( v );
|
||||
else if ( ! strcmp( s, ":fade-in-duration" ) )
|
||||
_fade_in.length = atol( v );
|
||||
_fade_in.length = atoll( v );
|
||||
else if ( ! strcmp( s, ":fade-out-type" ) )
|
||||
_fade_out.type = (Fade::fade_type_e)atoi( v );
|
||||
else if ( ! strcmp( s, ":fade-out-duration" ) )
|
||||
_fade_out.length = atol( v );
|
||||
_fade_out.length = atoll( v );
|
||||
else if ( ! strcmp( s, ":source" ) )
|
||||
{
|
||||
if ( ! ( _clip = Audio_File::from_file( v ) ) )
|
||||
|
|
|
@ -179,7 +179,7 @@ exit( 0 );}
|
|||
xywh {0 0 74 25}
|
||||
} {
|
||||
MenuItem {} {
|
||||
label Home
|
||||
label Start
|
||||
callback {transport->locate( 0 );}
|
||||
xywh {0 0 40 25} shortcut 0xff50
|
||||
}
|
||||
|
@ -200,6 +200,7 @@ exit( 0 );}
|
|||
}
|
||||
MenuItem {} {
|
||||
label Record
|
||||
callback {transport->toggle_record();} selected
|
||||
xywh {40 40 40 25} shortcut 0x50072
|
||||
}
|
||||
}
|
||||
|
@ -252,7 +253,7 @@ exit( 0 );}
|
|||
} {
|
||||
MenuItem {} {
|
||||
label Bars
|
||||
callback {Timeline::snap_to = Timeline::Bars;} selected
|
||||
callback {Timeline::snap_to = Timeline::Bars;}
|
||||
xywh {0 0 40 25} type Radio value 1
|
||||
}
|
||||
MenuItem {} {
|
||||
|
|
|
@ -465,7 +465,7 @@ Timeline::draw ( void )
|
|||
||
|
||||
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() );
|
||||
draw_child( *rulers );
|
||||
|
@ -717,8 +717,17 @@ Timeline::handle ( int m )
|
|||
|
||||
switch ( m )
|
||||
{
|
||||
case FL_FOCUS:
|
||||
case FL_UNFOCUS:
|
||||
redraw();
|
||||
return 1;
|
||||
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() )
|
||||
{
|
||||
case FL_Delete:
|
||||
|
@ -727,14 +736,10 @@ Timeline::handle ( int m )
|
|||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* case FL_Home: */
|
||||
/* transport->locate( 0 ); */
|
||||
/* return 1; */
|
||||
/* case ' ': */
|
||||
/* transport->toggle(); */
|
||||
/* return 1; */
|
||||
|
||||
case FL_Home:
|
||||
case FL_End:
|
||||
/* keep scrollbar from eating these. */
|
||||
return 0;
|
||||
case 'p':
|
||||
{
|
||||
int X = Fl::event_x() - Track::width();
|
||||
|
@ -776,6 +781,10 @@ Timeline::handle ( int m )
|
|||
}
|
||||
default:
|
||||
{
|
||||
|
||||
if ( m == FL_PUSH )
|
||||
Fl::focus( this );
|
||||
|
||||
int r = Fl_Overlay_Window::handle( m );
|
||||
|
||||
if ( m != FL_RELEASE && r )
|
||||
|
@ -788,7 +797,7 @@ Timeline::handle ( int m )
|
|||
{
|
||||
case FL_PUSH:
|
||||
{
|
||||
take_focus();
|
||||
// take_focus();
|
||||
|
||||
if ( Fl::event_button1() )
|
||||
{
|
||||
|
|
|
@ -130,10 +130,10 @@ Track::init ( void )
|
|||
o->color( ( Fl_Color ) 53 );
|
||||
{
|
||||
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->labelcolor( FL_GRAY0 );
|
||||
o->textcolor( 32 );
|
||||
o->textcolor( FL_FOREGROUND_COLOR );
|
||||
|
||||
o->callback( cb_input_field, (void*)this );
|
||||
}
|
||||
|
|
|
@ -67,6 +67,17 @@ private:
|
|||
|
||||
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 )
|
||||
: Fl_Pack( X, Y, W, H, L )
|
||||
{
|
||||
|
@ -104,6 +115,18 @@ public:
|
|||
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;
|
||||
|
||||
void poll ( void );
|
||||
|
|
Loading…
Reference in New Issue