Add marks to ruler.
This commit is contained in:
parent
2ccae56fb1
commit
55a1e60484
|
@ -103,6 +103,9 @@ parse_alist( const char *s )
|
|||
|
||||
char *pair = (char*)malloc( l + 1 );
|
||||
|
||||
if ( c[ strlen( c ) - 1 ] == ' ' )
|
||||
--l;
|
||||
|
||||
strncpy( pair, c, l );
|
||||
|
||||
pair[ l ] = '\0';
|
||||
|
@ -119,9 +122,8 @@ parse_alist( const char *s )
|
|||
if ( *v == '"' )
|
||||
{
|
||||
// v++;
|
||||
v[ strlen( v ) - 2 ] = '\0';
|
||||
v[ strlen( v ) - 1 ] = '\0';
|
||||
memmove( v, v + 1, strlen( v ) + 1 );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -221,9 +221,6 @@ Region::trim ( enum trim_e t, int X )
|
|||
}
|
||||
}
|
||||
|
||||
/* convert a screen x coord into an offset into the region */
|
||||
#define x_to_offset( X ) ( timeline->x_to_ts( scroll_x() + ( (X) - _track->x() ) ) - _r->offset )
|
||||
|
||||
int
|
||||
Region::handle ( int m )
|
||||
{
|
||||
|
|
|
@ -66,7 +66,6 @@ protected:
|
|||
|
||||
Ruler_Point ( )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public:
|
||||
|
@ -74,8 +73,10 @@ public:
|
|||
/* for loggable */
|
||||
LOG_CREATE_FUNC( Ruler_Point );
|
||||
|
||||
Ruler_Point ( nframes_t when, const char *name )
|
||||
Ruler_Point ( Sequence *track, nframes_t when, const char *name )
|
||||
{
|
||||
_track = track;
|
||||
|
||||
_r->offset = when;
|
||||
|
||||
_label = strdup( name );
|
||||
|
|
|
@ -38,6 +38,30 @@ public:
|
|||
{
|
||||
Sequence::draw();
|
||||
timeline->draw_measure_BBT( x(), y(), w(), h(), FL_WHITE );
|
||||
}
|
||||
|
||||
int handle ( int m )
|
||||
{
|
||||
|
||||
if ( Sequence::handle( m ) )
|
||||
return 1;
|
||||
|
||||
switch ( m )
|
||||
{
|
||||
case FL_PUSH:
|
||||
{
|
||||
if ( Fl::event_button1() )
|
||||
{
|
||||
add( new Ruler_Point( this, x_to_offset( Fl::event_x() ), "mark" ) );
|
||||
redraw();
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -51,6 +51,12 @@ Sequence::~Sequence ( )
|
|||
// log_destroy();
|
||||
}
|
||||
|
||||
nframes_t
|
||||
Sequence::x_to_offset ( int X )
|
||||
{
|
||||
return timeline->xoffset + timeline->x_to_ts( X - x() );
|
||||
}
|
||||
|
||||
void
|
||||
Sequence::sort ( void )
|
||||
{
|
||||
|
|
|
@ -31,8 +31,6 @@
|
|||
|
||||
#include <list>
|
||||
|
||||
// using namespace std;
|
||||
|
||||
class Track;
|
||||
class Sequence_Widget;
|
||||
|
||||
|
@ -97,6 +95,8 @@ public:
|
|||
|
||||
virtual ~Sequence ( );
|
||||
|
||||
nframes_t x_to_offset ( int X );
|
||||
|
||||
const char * name ( void ) const { return _name; }
|
||||
void name ( const char *s )
|
||||
{
|
||||
|
|
|
@ -308,6 +308,11 @@ public:
|
|||
void start ( nframes_t v ) { _r->start = v; }
|
||||
nframes_t start ( void ) const { return _r->start; }
|
||||
|
||||
/** convert a screen x coord into an offset into the region */
|
||||
nframes_t x_to_offset ( int X )
|
||||
{
|
||||
return timeline->x_to_ts( scroll_x() + ( X - _track->x() ) ) - _r->offset;
|
||||
}
|
||||
|
||||
int active_r ( void ) const { return _track->active_r(); }
|
||||
virtual nframes_t length ( void ) const { return _r->end - _r->start; }
|
||||
|
|
|
@ -492,9 +492,6 @@ Timeline::draw ( void )
|
|||
|
||||
if ( damage() & FL_DAMAGE_CHILD )
|
||||
{
|
||||
// draw_box( box(), 0, 0, w(), h(), color() );
|
||||
|
||||
// fl_push_clip( rulers->x(), rulers->y(), rulers->w() - vscroll->w(), rulers->h() );
|
||||
fl_push_clip( rulers->x(), rulers->y(), rulers->w(), rulers->h() );
|
||||
update_child( *rulers );
|
||||
fl_pop_clip();
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "Timeline.H"
|
||||
#include "Tempo_Sequence.H"
|
||||
#include "Time_Sequence.H"
|
||||
#include "Ruler_Sequence.H"
|
||||
#include "Control_Sequence.H"
|
||||
|
||||
#include "Transport.H"
|
||||
|
@ -88,6 +89,7 @@ main ( int argc, char **argv )
|
|||
LOG_REGISTER_CREATE( Region );
|
||||
LOG_REGISTER_CREATE( Time_Point );
|
||||
LOG_REGISTER_CREATE( Tempo_Point );
|
||||
LOG_REGISTER_CREATE( Ruler_Point );
|
||||
LOG_REGISTER_CREATE( Control_Point );
|
||||
LOG_REGISTER_CREATE( Track );
|
||||
LOG_REGISTER_CREATE( Audio_Sequence );
|
||||
|
|
Loading…
Reference in New Issue