Closes #164tags/non-daw-v1.2.0
| @@ -405,7 +405,7 @@ Audio_Region::draw_fade ( const Fade &fade, Fade::fade_dir_e dir, bool line, int | |||||
| if ( dir == Fade::In ) | if ( dir == Fade::In ) | ||||
| { | { | ||||
| fx = line_x(); | |||||
| fx = curve_x(); | |||||
| if ( fx + width < X || | if ( fx + width < X || | ||||
| fx > X + W ) | fx > X + W ) | ||||
| @@ -414,7 +414,7 @@ Audio_Region::draw_fade ( const Fade &fade, Fade::fade_dir_e dir, bool line, int | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| fx = line_x() + abs_w(); | |||||
| fx = curve_x() + abs_w(); | |||||
| if ( fx - width > X + W || | if ( fx - width > X + W || | ||||
| fx < X ) | fx < X ) | ||||
| @@ -431,8 +431,8 @@ Audio_Region::draw_fade ( const Fade &fade, Fade::fade_dir_e dir, bool line, int | |||||
| fl_vertex( fx, dy + height ); | fl_vertex( fx, dy + height ); | ||||
| { | { | ||||
| const float ti = 1.0f / (float)width; | |||||
| float ts = 0.0f; | |||||
| const double ti = 1.0 / (double)width; | |||||
| double ts = 0.0; | |||||
| const int xi = dir == Fade::In ? 1 : -1; | const int xi = dir == Fade::In ? 1 : -1; | ||||
| @@ -487,8 +487,7 @@ Audio_Region::draw_box( void ) | |||||
| b = FL_DOWN_FRAME; | b = FL_DOWN_FRAME; | ||||
| } | } | ||||
| fl_draw_box( b, line_x(), y(), abs_w(), h(), c ); | |||||
| fl_draw_box( b, x(), y(), w(), h(), c ); | |||||
| // fl_pop_clip(); | // fl_pop_clip(); | ||||
| } | } | ||||
| @@ -57,7 +57,7 @@ public: | |||||
| /* only for playback thread */ | /* only for playback thread */ | ||||
| nframes_t when ( void ) const { return _range.start; } | nframes_t when ( void ) const { return _range.start; } | ||||
| int abs_w ( void ) const { return 8; } | |||||
| long abs_w ( void ) const { return 8; } | |||||
| int y ( void ) const { return parent()->y() + ((float)parent()->h() * _y); } | int y ( void ) const { return parent()->y() + ((float)parent()->h() * _y); } | ||||
| int h ( void ) const { return 8; } | int h ( void ) const { return 8; } | ||||
| @@ -41,7 +41,7 @@ protected: | |||||
| public: | public: | ||||
| Fl_Align align ( void ) const { return FL_ALIGN_RIGHT; } | Fl_Align align ( void ) const { return FL_ALIGN_RIGHT; } | ||||
| virtual int abs_w ( void ) const { return 8; } | |||||
| virtual long abs_w ( void ) const { return 8; } | |||||
| // virtual int abs_x ( void ) const { return Sequence_Widget::abs_x() - ( abs_w() >> 1 ); } | // virtual int abs_x ( void ) const { return Sequence_Widget::abs_x() - ( abs_w() >> 1 ); } | ||||
| // virtual int x ( void ) const { return Sequence_Widget::line_x() - ( abs_w() >> 1 ); } | // virtual int x ( void ) const { return Sequence_Widget::line_x() - ( abs_w() >> 1 ); } | ||||
| @@ -239,7 +239,7 @@ Sequence_Region::draw_box ( void ) | |||||
| { | { | ||||
| Fl_Color c = selected() ? selection_color() : box_color(); | Fl_Color c = selected() ? selection_color() : box_color(); | ||||
| fl_draw_box( box(), line_x(), y(), abs_w(), h(), fl_color_add_alpha( c, 127 ) ); | |||||
| fl_draw_box( box(), x(), y(), w(), h(), fl_color_add_alpha( c, 127 ) ); | |||||
| } | } | ||||
| void | void | ||||
| @@ -189,8 +189,9 @@ public: | |||||
| int get_x( nframes_t frame ) const | int get_x( nframes_t frame ) const | ||||
| { | { | ||||
| return frame < timeline->xoffset ? | return frame < timeline->xoffset ? | ||||
| _sequence->drawable_x() : | |||||
| min( _sequence->drawable_x() + _sequence->drawable_w(), _sequence->drawable_x() + timeline->ts_to_x( frame - timeline->xoffset ) ); | |||||
| _sequence->drawable_x() - 10 : | |||||
| min( _sequence->drawable_x() + _sequence->drawable_w(), | |||||
| _sequence->drawable_x() + timeline->ts_to_x( frame - timeline->xoffset ) ); | |||||
| } | } | ||||
| virtual int x ( void ) const | virtual int x ( void ) const | ||||
| @@ -198,19 +199,27 @@ public: | |||||
| return get_x( _r->start ); | return get_x( _r->start ); | ||||
| } | } | ||||
| /* use this as x() when you need to draw lines between widgets */ | |||||
| /* use this as x() when you need to draw lines between widgets. Clamped to -32767-32767 to match max canvas size of FLTK/NTK */ | |||||
| int line_x ( void ) const | int line_x ( void ) const | ||||
| { | { | ||||
| return _r->start < timeline->xoffset ? | return _r->start < timeline->xoffset ? | ||||
| max( -32767, _sequence->drawable_x() - timeline->ts_to_x( timeline->xoffset - _r->start )) : | max( -32767, _sequence->drawable_x() - timeline->ts_to_x( timeline->xoffset - _r->start )) : | ||||
| min( 32767, _sequence->drawable_x() + timeline->ts_to_x( _r->start - timeline->xoffset ) ); | |||||
| min( 32767, _sequence->drawable_x() + timeline->ts_to_x( _r->start - timeline->xoffset )); | |||||
| } | |||||
| /* same as above but un-clamped for cairo */ | |||||
| long curve_x ( void ) const | |||||
| { | |||||
| return _r->start < timeline->xoffset ? | |||||
| _sequence->drawable_x() - timeline->ts_to_x( timeline->xoffset - _r->start ) : | |||||
| _sequence->drawable_x() + timeline->ts_to_x( _r->start - timeline->xoffset ); | |||||
| } | } | ||||
| virtual int w ( void ) const | virtual int w ( void ) const | ||||
| { | { | ||||
| // int tx = timeline->ts_to_x( _r->start ); | // int tx = timeline->ts_to_x( _r->start ); | ||||
| int rw; | |||||
| long rw; | |||||
| if ( _r->start < timeline->xoffset ) | if ( _r->start < timeline->xoffset ) | ||||
| { | { | ||||
| @@ -222,11 +231,11 @@ public: | |||||
| else | else | ||||
| rw = abs_w(); | rw = abs_w(); | ||||
| return min( rw, _sequence->drawable_w() ); | |||||
| return (int)min( rw, (long)(_sequence->drawable_w() + 20) ); | |||||
| } | } | ||||
| int abs_x ( void ) const { return timeline->ts_to_x( _r->start ); } | int abs_x ( void ) const { return timeline->ts_to_x( _r->start ); } | ||||
| virtual int abs_w ( void ) const { return timeline->ts_to_x( _r->length ); } | |||||
| virtual long abs_w ( void ) const { return timeline->ts_to_x( _r->length ); } | |||||
| Fl_Color color ( void ) const { return _color; } | Fl_Color color ( void ) const { return _color; } | ||||
| void color ( Fl_Color v ) { _color = v; } | void color ( Fl_Color v ) { _color = v; } | ||||