diff --git a/Timeline.C b/Timeline.C index b9fefde..746edeb 100644 --- a/Timeline.C +++ b/Timeline.C @@ -328,6 +328,10 @@ Timeline::draw_clip ( void * v, int X, int Y, int W, int H ) } +static unsigned char *rect_image; + + + void Timeline::draw ( void ) { @@ -338,6 +342,19 @@ Timeline::draw ( void ) W = tracks->w() - Fl::box_dw( tracks->child( 0 )->box() ) - 1; H = tracks->h(); + + +/* if ( damage() & FL_DAMAGE_USER1 ) */ +/* { */ + +/* /\* save the rectangle so we can draw it (darkened) in the overlay *\/ */ +/* Rectangle &r = _selection; */ +/* make_current(); */ +/* rect_image = fl_read_image( NULL, r.x, r.y, r.w, r.h, 0 ); */ + +/* return; */ +/* } */ + if ( (damage() & FL_DAMAGE_ALL) || damage() & FL_DAMAGE_EXPOSE ) @@ -358,7 +375,7 @@ Timeline::draw ( void ) redraw_overlay(); - Rectangle &r = _selection; +/* Rectangle &r = _selection; */ /* unsigned char *data = fl_read_image( NULL, r.x, r.y, r.w, r.h, 0 ); */ @@ -371,18 +388,18 @@ Timeline::draw ( void ) /* delete[] data; */ - if ( r.w && r.h ) - { - const unsigned char data[] = { 0, 127, 0, 96, - 0, 96, 0, 127 }; - Fl_RGB_Image bi( data, 2, 2, 2 ); +/* if ( r.w && r.h ) */ +/* { */ +/* const unsigned char data[] = { 0, 127, 0, 96, */ +/* 0, 96, 0, 127 }; */ +/* Fl_RGB_Image bi( data, 2, 2, 2 ); */ - Fl_Image *bi2 = bi.copy( r.w, r.h ); +/* Fl_Image *bi2 = bi.copy( r.w, r.h ); */ - bi2->draw( r.x, r.y ); +/* bi2->draw( r.x, r.y ); */ - delete bi2; - } +/* delete bi2; */ +/* } */ return; } @@ -468,13 +485,16 @@ Timeline::draw_overlay ( void ) /* unsigned char *data = fl_read_image( NULL, r.x, r.y, r.w, r.h, 0 ); */ -/* Fl_RGB_Image bi( data, r.w, r.h, 3 ); */ + + +/* Fl_RGB_Image bi( rect_image, r.w, r.h, 3 ); */ /* bi.color_average( FL_BLACK, 0.50f ); */ /* bi.draw( r.x, r.y ); */ -/* delete[] data; */ +/* delete[] rect_image; */ +/* rect_image = NULL; */ fl_pop_clip(); @@ -554,8 +574,6 @@ Timeline::handle ( int m ) _selection.w = abs( ox ); _selection.h = abs( oy ); - - redraw(); break; } case FL_RELEASE: diff --git a/Timeline.H b/Timeline.H index 2fe0293..bce0100 100644 --- a/Timeline.H +++ b/Timeline.H @@ -23,33 +23,43 @@ #include #include #include -#include +#include #include "Scalebar.H" #include "Audio_File.H" // just for nframes_t -#include +#include #include -#include - class Timeline; extern Timeline *timeline; #include "Track.H" -// #include "Tempo_Track.H" class Tempo_Track; class Time_Track; -// #include "Tempo_Point.H" -// #include "Region.H" - #include using std::list; +// disables double-buffering to make unnecessary redrawing more apparent +// #define DEBUG_TIMELINE_DRAWING + +#ifndef DEBUG_TIMELINE_DRAWING + +#include + +#else + +#include +#define Fl_Overlay_Window Fl_Single_Window +#define redraw_overlay() +#endif + + + struct Rectangle { int x; @@ -61,6 +71,8 @@ struct Rectangle Rectangle ( int X, int Y, int W, int H ) : x( X ), y( Y ), w( W ), h( H ) {} }; + + class Timeline : public Fl_Overlay_Window { static void draw_clip ( void * v, int X, int Y, int W, int H );