Browse Source

Timeline: Add keybindings for split region at mouse and crop region to range.

tags/non-daw-v1.2.0
Jonathan Moore Liles 13 years ago
parent
commit
0a963f5c8a
3 changed files with 32 additions and 1 deletions
  1. +23
    -1
      timeline/src/Audio_Region.C
  2. +4
    -0
      timeline/src/Timeline.C
  3. +5
    -0
      timeline/src/Timeline.H

+ 23
- 1
timeline/src/Audio_Region.C View File

@@ -31,7 +31,7 @@
#include "Track.H"

#include "Engine/Audio_File.H"
#include "Transport.H"
#include "const.h"
#include "debug.h"

@@ -45,6 +45,7 @@ using std::max;
extern void draw_full_arrow_symbol ( Fl_Color color );

extern Timeline *timeline;
extern Transport *transport;

bool Audio_Region::inherit_track_color = true;

@@ -237,6 +238,23 @@ Audio_Region::menu_cb ( const Fl_Menu_ *m )
_fade_out.type = Fade::Parabolic;
else if ( ! strcmp( picked, "/Color" ) )
box_color( fl_show_colormap( box_color() ) );
else if ( ! strcmp( picked, "/Split at mouse" ) )
{
Loggable::block_start();
split( timeline->x_to_offset( Fl::event_x() ) );
log_end();
Loggable::block_end();

log_start();
}
else if ( ! strcmp( picked, "/Crop to range" ) )
{
trim_left( timeline->range_start() );
trim_right( timeline->range_end() );
}
else if ( ! strcmp( picked, "/Fade in to mouse" ) )
{
nframes_t offset = x_to_offset( Fl::event_x() );
@@ -312,6 +330,8 @@ Audio_Region::menu ( void )
{ 0 },
{ 0 },
{ "Color", 0, 0, 0, inherit_track_color ? FL_MENU_INACTIVE : 0 },
{ "Split at mouse", 's', 0, 0 },
{ "Crop to range", 'c', 0, 0 },
{ "Fade in to mouse", FL_F + 3, 0, 0 },
{ "Fade out to mouse", FL_F + 4, 0, 0 },
{ "Loop point to mouse", 'l', 0, 0 },
@@ -663,6 +683,8 @@ Audio_Region::split ( nframes_t where )

Audio_Region *copy = new Audio_Region( *this );

Logger _log( copy );

_fade_in.length = old_fade_in;
_fade_out.length = 256;



+ 4
- 0
timeline/src/Timeline.C View File

@@ -307,6 +307,8 @@ Timeline::menu_cb ( Fl_Menu_ *m )
p1 = xoffset + x_to_ts( X );
}

fix_range();

/* FIXME: only needs to damage the location of the old cursor! */
redraw();
}
@@ -319,6 +321,8 @@ Timeline::menu_cb ( Fl_Menu_ *m )
p2 = xoffset + x_to_ts( X );
}

fix_range();

/* FIXME: only needs to damage the location of the old cursor! */
redraw();
}


+ 5
- 0
timeline/src/Timeline.H View File

@@ -114,6 +114,7 @@ class Timeline : public Fl_Single_Window, public RWLock
int _fpp; /* frames per pixel, power of two */

nframes_t p1, p2; /* cursors */
nframes_t _playhead;

/* not permitted */
Timeline ( const Timeline &rhs );
@@ -162,8 +163,12 @@ public:

const char *session_manager_name ( void );

nframes_t fpp ( void ) const { return 1 << _fpp; }
void range ( nframes_t start, nframes_t length );
nframes_t range_start ( void ) const { return p1; }
nframes_t range_end ( void ) const { return p2; }
// nframes_t playhead ( void ) const { return transport->frame; }
nframes_t length ( void ) const;
void sample_rate ( nframes_t r ) { _sample_rate = r; }
nframes_t sample_rate ( void ) const { return _sample_rate; }


Loading…
Cancel
Save