Browse Source

Add marks to ruler.

tags/non-daw-v1.1.0
Jonathan Moore Liles 17 years ago
parent
commit
55a1e60484
9 changed files with 46 additions and 12 deletions
  1. +4
    -2
      Timeline/Loggable.C
  2. +0
    -3
      Timeline/Region.C
  3. +3
    -2
      Timeline/Ruler_Point.H
  4. +24
    -0
      Timeline/Ruler_Sequence.H
  5. +6
    -0
      Timeline/Sequence.C
  6. +2
    -2
      Timeline/Sequence.H
  7. +5
    -0
      Timeline/Sequence_Widget.H
  8. +0
    -3
      Timeline/Timeline.C
  9. +2
    -0
      Timeline/main.C

+ 4
- 2
Timeline/Loggable.C View File

@@ -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 );

}
}



+ 0
- 3
Timeline/Region.C View File

@@ -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 )
{


+ 3
- 2
Timeline/Ruler_Point.H View File

@@ -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 );


+ 24
- 0
Timeline/Ruler_Sequence.H View File

@@ -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;
}
};

+ 6
- 0
Timeline/Sequence.C View File

@@ -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 )
{


+ 2
- 2
Timeline/Sequence.H View File

@@ -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 )
{


+ 5
- 0
Timeline/Sequence_Widget.H View File

@@ -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; }


+ 0
- 3
Timeline/Timeline.C View File

@@ -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();


+ 2
- 0
Timeline/main.C View File

@@ -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…
Cancel
Save