From fa5d739ac7207eeaa479bb70cb82c7f3bb01e223 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Sun, 20 May 2012 20:28:09 -0700 Subject: [PATCH] Timeline: Make entire window an Fl_Overlay_Window instead of using a subwindow for timeline. --- timeline/src/TLE.fl | 25 ++++++++++++++++-- timeline/src/Timeline.C | 56 +++++++++++------------------------------ timeline/src/Timeline.H | 3 +++ 3 files changed, 41 insertions(+), 43 deletions(-) diff --git a/timeline/src/TLE.fl b/timeline/src/TLE.fl index 76aaf39..eb5beb3 100644 --- a/timeline/src/TLE.fl +++ b/timeline/src/TLE.fl @@ -28,6 +28,9 @@ decl {const float STATUS_UPDATE_FREQ = 0.5f;} {private local decl {class Fl_Flowpack;} {public global } +decl {\#include } {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 );} diff --git a/timeline/src/Timeline.C b/timeline/src/Timeline.C index 751e566..57f0c97 100644 --- a/timeline/src/Timeline.C +++ b/timeline/src/Timeline.C @@ -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(); diff --git a/timeline/src/Timeline.H b/timeline/src/Timeline.H index 04f4d65..756661e 100644 --- a/timeline/src/Timeline.H +++ b/timeline/src/Timeline.H @@ -55,6 +55,9 @@ class Sequence_Widget; namespace OSC { class Endpoint; } +#define USE_WIDGET_FOR_TIMELINE + + #include #ifndef USE_SINGLEBUFFERED_TIMELINE