Make use of a sub-window for the timeline a compile-time option.

This commit is contained in:
Jonathan Moore Liles 2010-01-08 00:04:28 -06:00
parent e904ff9fae
commit 167a924caf
4 changed files with 39 additions and 13 deletions

View File

@ -61,6 +61,10 @@ ifeq ($(USE_SINGLEBUFFERED_TIMELINE),yes)
CFLAGS+=-DUSE_SINGLEBUFFERED_TIMELINE CFLAGS+=-DUSE_SINGLEBUFFERED_TIMELINE
endif endif
ifeq ($(USE_WIDGET_FOR_TIMELINE),yes)
CFLAGS+=-DUSE_WIDGET_FOR_TIMELINE
endif
CFLAGS+=-DVERSION=\"$(VERSION)\" \ CFLAGS+=-DVERSION=\"$(VERSION)\" \
-DINSTALL_PREFIX=\"$(prefix)\" \ -DINSTALL_PREFIX=\"$(prefix)\" \
-DSYSTEM_PATH=\"$(SYSTEM_PATH)\" \ -DSYSTEM_PATH=\"$(SYSTEM_PATH)\" \

View File

@ -46,9 +46,21 @@
#include "const.h" #include "const.h"
#include "util/debug.h" #include "util/debug.h"
#ifdef USE_WIDGET_FOR_TIMELINE
#define BASE Fl_Group
#define redraw_overlay()
#define BX x()
#define BY y()
#else
#ifdef USE_SINGLEBUFFERED_TIMELINE #ifdef USE_SINGLEBUFFERED_TIMELINE
#warning Using singlebuffered timeline window. This may cause flicker and makes the cursors invisible. #warning Using singlebuffered timeline window. This may cause flicker and makes the cursors invisible.
#define BASE Fl_Single_Window
#define redraw_overlay() #define redraw_overlay()
#else
#define BASE Fl_Overlay_Window
#endif
#define BX 0
#define BY 0
#endif #endif
@ -366,7 +378,7 @@ Timeline::ntracks ( void ) const
} }
Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Overlay_Window( X, Y, W, H, L ) Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : BASE( X, Y, W, H, L )
{ {
Loggable::snapshot_callback( &Timeline::snapshot, this ); Loggable::snapshot_callback( &Timeline::snapshot, this );
@ -378,7 +390,9 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Overlay_Wi
_old_yposition = 0; _old_yposition = 0;
_old_xposition = 0; _old_xposition = 0;
#ifndef USE_WIDGET_FOR_TIMELINE
X = Y = 0; X = Y = 0;
#endif
p1 = p2 = 0; p1 = p2 = 0;
@ -504,7 +518,6 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Overlay_Wi
end(); end();
Fl::add_timeout( UPDATE_FREQ, update_cb, this ); Fl::add_timeout( UPDATE_FREQ, update_cb, this );
} }
void void
@ -865,13 +878,13 @@ Timeline::draw_clip ( void * v, int X, int Y, int W, int H )
void void
Timeline::resize ( int X, int Y, int W, int H ) Timeline::resize ( int X, int Y, int W, int H )
{ {
Fl_Overlay_Window::resize( X, Y, W, H ); BASE::resize( X, Y, W, H );
/* why is this necessary? */ /* why is this necessary? */
rulers->resize( Track::width(), 0, W - Track::width() - vscroll->w(), rulers->h() ); rulers->resize( BX + Track::width(), BY, W - Track::width() - vscroll->w(), rulers->h() );
/* why is THIS necessary? */ /* why is THIS necessary? */
hscroll->resize( 0, H - 18, hscroll->w(), 18 ); hscroll->resize( BX, BY + H - 18, hscroll->w(), 18 );
vscroll->size( vscroll->w(), H - 18 ); vscroll->size( vscroll->w(), H - 18 );
} }
@ -909,9 +922,9 @@ Timeline::draw ( void )
{ {
DMESSAGE( "complete redraw" ); DMESSAGE( "complete redraw" );
draw_box( box(), 0, 0, w(), h(), color() ); draw_box( box(), BX, BY, w(), h(), color() );
fl_push_clip( 0, rulers->y(), w(), rulers->h() ); fl_push_clip( BX, rulers->y(), w(), rulers->h() );
draw_child( *rulers ); draw_child( *rulers );
fl_pop_clip(); fl_pop_clip();
@ -1157,7 +1170,7 @@ Timeline::handle ( int m )
/* if ( m != FL_NO_EVENT ) */ /* if ( m != FL_NO_EVENT ) */
/* DMESSAGE( "%s", event_name( m ) ); */ /* DMESSAGE( "%s", event_name( m ) ); */
/* int r = Fl_Overlay_Window::handle( m ); */ /* int r = BASE::handle( m ); */
switch ( m ) switch ( m )
{ {
@ -1194,14 +1207,14 @@ Timeline::handle ( int m )
/* keep scrollbar from eating these. */ /* keep scrollbar from eating these. */
return 0; return 0;
default: default:
return Fl_Overlay_Window::handle( m ); return BASE::handle( m );
} }
return 0; return 0;
} }
default: default:
{ {
int r = Fl_Overlay_Window::handle( m ); int r = BASE::handle( m );
if ( m != FL_RELEASE && r ) if ( m != FL_RELEASE && r )
return r; return r;

View File

@ -55,7 +55,6 @@ class Sequence_Widget;
#include <Fl/Fl_Overlay_Window.H> #include <Fl/Fl_Overlay_Window.H>
#else #else
#include <FL/Fl_Single_Window.H> #include <FL/Fl_Single_Window.H>
#define Fl_Overlay_Window Fl_Single_Window
#endif #endif
struct position_info; struct position_info;
@ -73,7 +72,16 @@ struct Rectangle
#include "RWLock.H" #include "RWLock.H"
#ifdef USE_WIDGET_FOR_TIMELINE
class Timeline : public Fl_Group, public RWLock
#else
#ifndef USE_SINGLEBUFFERED_TIMELINE
class Timeline : public Fl_Overlay_Window, public RWLock class Timeline : public Fl_Overlay_Window, public RWLock
#else
class Timeline : public Fl_Single_Window, public RWLock
#endif
#endif
{ {
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 );

3
configure vendored
View File

@ -16,7 +16,8 @@ ask "Build for debugging" USE_DEBUG no
using DEBUG && using DEBUG &&
{ {
ask "Use unoptimized drawing routines" USE_UNOPTIMIZED_DRAWING no ask "Use unoptimized drawing routines" USE_UNOPTIMIZED_DRAWING no
ask "Use singlebuffered timeline" USE_SINGLEBUFFERED_TIMELINE no ask "Use widget for timeline" USE_WIDGET_FOR_TIMELINE no
using WIDGET_FOR_TIMELINE || ask "Use singlebuffered timeline" USE_SINGLEBUFFERED_TIMELINE no
} }
begin_tests begin_tests