Timeline: Tweak region appearance.

This commit is contained in:
Jonathan Moore Liles 2013-09-20 17:40:20 -07:00
parent 2ea366a409
commit 51bce6124e
4 changed files with 53 additions and 8 deletions

View File

@ -56,6 +56,42 @@ draw_focus_frame ( int x, int y, int w, int h, Fl_Color c )
fl_pop_clip();
}
void
draw_selection_frame ( int x, int y, int w, int h, Fl_Color c )
{
fl_push_clip( x, y, w, h );
fl_color( fl_color_average( FL_GRAY, c, 0.50 ) );
/// fl_color( fl_color_add_alpha( c, 100 ) );
fl_line_style( FL_DASH, 2 );
fl_rect( x, y, w, h );
fl_line_style( FL_SOLID, 3 );
fl_color( c );
int l = 15;
fl_line( x, y, x + l, y );
fl_line( x, y + l, x, y );
fl_line( x + w - 1, y, x + w - l - 1, y );
fl_line( x + w - 1, y, x + w - 1, y + l - 1 );
fl_line( x, y + h - 1, x, y + h - l - 1);
fl_line( x, y + h - 1, x + l, y + h - 1 );
fl_line( x + w - 1, y + h - 1, x + w - 1, y + h - l - 1 );
fl_line( x + w - 1, y + h - 1, x + w - l, y + h - 1 );
fl_line_style( FL_SOLID, 0 );
fl_pop_clip();
}
bool
focused_r ( Fl_Widget *w )
{

View File

@ -17,6 +17,6 @@
/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/*******************************************************************************/
void
draw_focus_frame ( int x, int y, int w, int h, Fl_Color c );
void draw_focus_frame ( int x, int y, int w, int h, Fl_Color c );
void draw_selection_frame ( int x, int y, int w, int h, Fl_Color c );
bool focused_r ( Fl_Widget *w );

@ -1 +1 @@
Subproject commit 1238f916dc30c018d333859513f63da9ab8bcb7b
Subproject commit 127328b00c3ceddebeeff6fac59f207a8469f6dc

View File

@ -34,6 +34,7 @@
#include "Transport.H"
#include "const.h"
#include "debug.h"
#include <FL/focus_frame.H>
#include <algorithm>
using std::min;
@ -50,7 +51,7 @@ extern Transport *transport;
bool Audio_Region::inherit_track_color = true;
bool Audio_Region::show_box = true;
Fl_Boxtype Audio_Region::_box = FL_FLAT_BOX;
Fl_Boxtype Audio_Region::_box = FL_BORDER_BOX;
Fl_Color Audio_Region::_selection_color = FL_MAGENTA;
@ -436,7 +437,7 @@ Audio_Region::actual_box_color ( void ) const
void
Audio_Region::draw_box( void )
{
fl_push_clip( x(), y(), w(), h() );
// fl_push_clip( x(), y(), w(), h() );
Fl_Color selection_color = _selection_color;
@ -455,7 +456,7 @@ Audio_Region::draw_box( void )
}
Fl_Boxtype b;
Fl_Color c = selected() ? selection_color : color;
Fl_Color c = selected() ? fl_color_average( color, fl_rgb_color(10,10,10), 0.4f ) : color;
if ( Audio_Region::show_box )
{
@ -466,9 +467,10 @@ Audio_Region::draw_box( void )
b = FL_DOWN_FRAME;
}
fl_draw_box( b, x(), y(), w(), h(), c );
fl_draw_box( b, line_x(), y(), abs_w(), h(), c );
fl_pop_clip();
// fl_pop_clip();
}
void
@ -688,6 +690,13 @@ Audio_Region::draw ( void )
fl_line_style( FL_SOLID, 0 );
}
if ( selected() )
draw_selection_frame( line_x() + Fl::box_dx(box()),
y() + Fl::box_dy(box()),
abs_w() - Fl::box_dw(box()),
h() - Fl::box_dh(box()),
selection_color() );
/* if ( current() ) */
/* { */
/* /\* draw length bubble *\/ */