Timeline: Make entire window an Fl_Overlay_Window instead of using a subwindow for timeline.

pull/3/head
Jonathan Moore Liles 2012-05-20 20:28:09 -07:00
parent c9a7e56b80
commit fa5d739ac7
3 changed files with 41 additions and 43 deletions

View File

@ -28,6 +28,9 @@ decl {const float STATUS_UPDATE_FREQ = 0.5f;} {private local
decl {class Fl_Flowpack;} {public global
}
decl {\#include <FL/Fl_Overlay_Window.H>} {private local
}
decl {\#include "Fl_Menu_Settings.H"} {private local
}
@ -97,6 +100,23 @@ decl {extern NSM_Client *nsm;} {private global
decl {extern char *user_config_dir;} {private global
}
class TLE_Window {open : {public Fl_Overlay_Window}
} {
Function {TLE_Window(int W, int H, const char *L = 0) : Fl_Overlay_Window( W, H, L )} {open
} {
code {} {}
}
Function {draw_overlay(void)} {open return_type void
} {
code {timeline->draw_overlay();} {}
}
Function {~TLE_Window()} {open return_type virtual
} {
code {} {selected
}
}
}
class TLE {open
} {
decl {Fl_Color system_colors[3];} {private local
@ -230,7 +250,8 @@ Loggable::progress_callback( &TLE::progress_cb, this );} {}
label {Non DAW : Timeline}
callback {if ( Fl::event_key() != FL_Escape )
timeline->command_quit();} open
xywh {485 131 1025 770} type Double resizable xclass Non_DAW size_range {900 300 0 0} visible
xywh {485 131 1025 770} type Double resizable
class TLE_Window xclass Non_DAW size_range {900 300 0 0} visible
} {
Fl_Menu_Bar menubar {open
private xywh {0 0 1025 25}
@ -702,7 +723,7 @@ ab.run();}
class Fl_Blink_Button
}
Fl_Button seek_blinker {
label SEEK selected
label SEEK
xywh {745 32 50 15} box ROUNDED_BOX down_box ROUNDED_BOX color 10 selection_color 2 labelfont 2 labelcolor 39 deactivate
code0 {\#include "FL/Fl_Blink_Button.H"}
code1 {o->blink_interval( Fl_Blink_Button::FAST );}

View File

@ -60,9 +60,9 @@ extern NSM_Client *nsm;
#ifdef USE_WIDGET_FOR_TIMELINE
#define BASE Fl_Group
#define redraw_overlay()
#define BX x()
#define BY y()
#define redraw_overlay() ((Fl_Overlay_Window*)window())->redraw_overlay()
#define BX this->x()
#define BY this->y()
#else
#ifdef USE_SINGLEBUFFERED_TIMELINE
#warning Using singlebuffered timeline window. This may cause flicker and makes the cursors invisible.
@ -400,12 +400,6 @@ Timeline::ntracks ( void ) const
Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : BASE( X, Y, W, H, L )
{
if ( ! can_do_overlay() )
{
WARNING( "Display lacks hardware overlay visual. Playhead and selection rectangle will flicker." );
}
Loggable::snapshot_callback( &Timeline::snapshot, this );
osc_thread = 0;
@ -711,7 +705,7 @@ draw_measure_cb ( nframes_t frame, const BBT &bbt, void *arg )
const int x = timeline->ts_to_x( frame - timeline->xoffset ) + Track::width();
fl_line( x, 0, x, timeline->h() );
fl_line( x, 0, x, 2000 );
}
/* FIXME: wrong place for this */
@ -938,7 +932,7 @@ Timeline::draw ( void )
adjust_vscroll();
#ifndef USE_UNOPTIMIZED_DRAWING
if ( ( damage() & FL_DAMAGE_ALL ) || ( damage() & FL_DAMAGE_EXPOSE ) )
if ( ( damage() & FL_DAMAGE_ALL ) )
#else
#warning Optimized drawing of timeline disabled. This will waste your CPU.
#endif
@ -1026,34 +1020,25 @@ Timeline::draw_cursor ( nframes_t frame, Fl_Color color, void (*symbol)(Fl_Color
if ( x > tracks->x() + tracks->w() )
return;
fl_color( color );
const int y = rulers->y() + rulers->h();
const int h = this->h() - hscroll->h() - 1;
const int h = this->h() - rulers->h() - hscroll->h();
fl_push_clip( tracks->x() + Track::width(), y, tracks->w(), h );
fl_line( x, y, x, h );
fl_color( fl_darker( color ) );
fl_line( x - 1, y, x - 1, h );
fl_color( FL_BLACK );
fl_line( x + 1, y, x + 1, h );
fl_line_style( FL_SOLID, 0 );
fl_color( color );
fl_line( x, y, x, y + h );
fl_push_matrix();
fl_translate( x, y );
fl_scale( 16, 8 );
fl_scale( 8, 4 );
symbol( color );
fl_pop_matrix();
fl_pop_clip();
}
void
@ -1116,20 +1101,9 @@ Timeline::draw_overlay ( void )
const Rectangle &r = _selection;
fl_color( FL_BLACK );
fl_line_style( FL_SOLID, 2 );
fl_rect( r.x + 2, r.y + 2, r.w, r.h );
fl_color( FL_MAGENTA );
fl_line_style( FL_DASH, 2 );
fl_rect( r.x, r.y, r.w, r.h );
fl_line( r.x, r.y, r.x + r.w, r.y + r.h );
fl_line( r.x + r.w, r.y, r.x, r.y + r.h );
fl_line_style( FL_SOLID, 0 );
fl_rect( r.x, r.y, r.w, r.h );
fl_pop_clip();

View File

@ -55,6 +55,9 @@ class Sequence_Widget;
namespace OSC { class Endpoint; }
#define USE_WIDGET_FOR_TIMELINE
#include <lo/lo.h>
#ifndef USE_SINGLEBUFFERED_TIMELINE