Browse Source

Add conditional compile option to disable timeline doublebuffering.

tags/non-daw-v1.1.0
Jonathan Moore Liles 17 years ago
parent
commit
546a0bde01
2 changed files with 52 additions and 22 deletions
  1. +32
    -14
      Timeline.C
  2. +20
    -8
      Timeline.H

+ 32
- 14
Timeline.C View File

@@ -328,6 +328,10 @@ Timeline::draw_clip ( void * v, int X, int Y, int W, int H )
} }




static unsigned char *rect_image;



void void
Timeline::draw ( void ) Timeline::draw ( void )
{ {
@@ -338,6 +342,19 @@ Timeline::draw ( void )
W = tracks->w() - Fl::box_dw( tracks->child( 0 )->box() ) - 1; W = tracks->w() - Fl::box_dw( tracks->child( 0 )->box() ) - 1;
H = tracks->h(); 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) if ( (damage() & FL_DAMAGE_ALL)
|| ||
damage() & FL_DAMAGE_EXPOSE ) damage() & FL_DAMAGE_EXPOSE )
@@ -358,7 +375,7 @@ Timeline::draw ( void )
redraw_overlay(); redraw_overlay();




Rectangle &r = _selection;
/* Rectangle &r = _selection; */


/* unsigned char *data = fl_read_image( NULL, r.x, r.y, r.w, r.h, 0 ); */ /* 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; */ /* 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; 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 ); */ /* 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.color_average( FL_BLACK, 0.50f ); */


/* bi.draw( r.x, r.y ); */ /* bi.draw( r.x, r.y ); */


/* delete[] data; */
/* delete[] rect_image; */
/* rect_image = NULL; */


fl_pop_clip(); fl_pop_clip();


@@ -554,8 +574,6 @@ Timeline::handle ( int m )


_selection.w = abs( ox ); _selection.w = abs( ox );
_selection.h = abs( oy ); _selection.h = abs( oy );

redraw();
break; break;
} }
case FL_RELEASE: case FL_RELEASE:


+ 20
- 8
Timeline.H View File

@@ -23,33 +23,43 @@
#include <FL/Fl_Pack.H> #include <FL/Fl_Pack.H>
#include <FL/Fl_Scrollbar.H> #include <FL/Fl_Scrollbar.H>
#include <FL/Fl_Widget.H> #include <FL/Fl_Widget.H>
#include <Fl/Fl_Overlay_Window.H>
#include <FL/fl_draw.H>


#include "Scalebar.H" #include "Scalebar.H"


#include "Audio_File.H" // just for nframes_t #include "Audio_File.H" // just for nframes_t
#include <math.h>


#include <math.h>
#include <assert.h> #include <assert.h>


#include <FL/fl_draw.H>

class Timeline; class Timeline;
extern Timeline *timeline; extern Timeline *timeline;


#include "Track.H" #include "Track.H"
// #include "Tempo_Track.H"


class Tempo_Track; class Tempo_Track;
class Time_Track; class Time_Track;


// #include "Tempo_Point.H"
// #include "Region.H"

#include <list> #include <list>
using std::list; using std::list;




// disables double-buffering to make unnecessary redrawing more apparent
// #define DEBUG_TIMELINE_DRAWING

#ifndef DEBUG_TIMELINE_DRAWING

#include <Fl/Fl_Overlay_Window.H>

#else

#include <FL/Fl_Single_Window.H>
#define Fl_Overlay_Window Fl_Single_Window
#define redraw_overlay()
#endif



struct Rectangle struct Rectangle
{ {
int x; 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 ) {} Rectangle ( int X, int Y, int W, int H ) : x( X ), y( Y ), w( W ), h( H ) {}
}; };




class Timeline : public Fl_Overlay_Window class Timeline : public Fl_Overlay_Window
{ {
static void draw_clip ( void * v, int X, int Y, int W, int H ); static void draw_clip ( void * v, int X, int Y, int W, int H );


Loading…
Cancel
Save