Timeline: Add keybindings for split region at mouse and crop region to range.
This commit is contained in:
parent
bc6f94e769
commit
0a963f5c8a
|
@ -31,7 +31,7 @@
|
||||||
#include "Track.H"
|
#include "Track.H"
|
||||||
|
|
||||||
#include "Engine/Audio_File.H"
|
#include "Engine/Audio_File.H"
|
||||||
|
#include "Transport.H"
|
||||||
#include "const.h"
|
#include "const.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
|
@ -45,6 +45,7 @@ using std::max;
|
||||||
extern void draw_full_arrow_symbol ( Fl_Color color );
|
extern void draw_full_arrow_symbol ( Fl_Color color );
|
||||||
|
|
||||||
extern Timeline *timeline;
|
extern Timeline *timeline;
|
||||||
|
extern Transport *transport;
|
||||||
|
|
||||||
bool Audio_Region::inherit_track_color = true;
|
bool Audio_Region::inherit_track_color = true;
|
||||||
|
|
||||||
|
@ -237,6 +238,23 @@ Audio_Region::menu_cb ( const Fl_Menu_ *m )
|
||||||
_fade_out.type = Fade::Parabolic;
|
_fade_out.type = Fade::Parabolic;
|
||||||
else if ( ! strcmp( picked, "/Color" ) )
|
else if ( ! strcmp( picked, "/Color" ) )
|
||||||
box_color( fl_show_colormap( box_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" ) )
|
else if ( ! strcmp( picked, "/Fade in to mouse" ) )
|
||||||
{
|
{
|
||||||
nframes_t offset = x_to_offset( Fl::event_x() );
|
nframes_t offset = x_to_offset( Fl::event_x() );
|
||||||
|
@ -312,6 +330,8 @@ Audio_Region::menu ( void )
|
||||||
{ 0 },
|
{ 0 },
|
||||||
{ 0 },
|
{ 0 },
|
||||||
{ "Color", 0, 0, 0, inherit_track_color ? FL_MENU_INACTIVE : 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 in to mouse", FL_F + 3, 0, 0 },
|
||||||
{ "Fade out to mouse", FL_F + 4, 0, 0 },
|
{ "Fade out to mouse", FL_F + 4, 0, 0 },
|
||||||
{ "Loop point to mouse", 'l', 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 );
|
Audio_Region *copy = new Audio_Region( *this );
|
||||||
|
|
||||||
|
Logger _log( copy );
|
||||||
|
|
||||||
_fade_in.length = old_fade_in;
|
_fade_in.length = old_fade_in;
|
||||||
_fade_out.length = 256;
|
_fade_out.length = 256;
|
||||||
|
|
||||||
|
|
|
@ -307,6 +307,8 @@ Timeline::menu_cb ( Fl_Menu_ *m )
|
||||||
p1 = xoffset + x_to_ts( X );
|
p1 = xoffset + x_to_ts( X );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fix_range();
|
||||||
|
|
||||||
/* FIXME: only needs to damage the location of the old cursor! */
|
/* FIXME: only needs to damage the location of the old cursor! */
|
||||||
redraw();
|
redraw();
|
||||||
}
|
}
|
||||||
|
@ -319,6 +321,8 @@ Timeline::menu_cb ( Fl_Menu_ *m )
|
||||||
p2 = xoffset + x_to_ts( X );
|
p2 = xoffset + x_to_ts( X );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fix_range();
|
||||||
|
|
||||||
/* FIXME: only needs to damage the location of the old cursor! */
|
/* FIXME: only needs to damage the location of the old cursor! */
|
||||||
redraw();
|
redraw();
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,6 +114,7 @@ class Timeline : public Fl_Single_Window, public RWLock
|
||||||
int _fpp; /* frames per pixel, power of two */
|
int _fpp; /* frames per pixel, power of two */
|
||||||
|
|
||||||
nframes_t p1, p2; /* cursors */
|
nframes_t p1, p2; /* cursors */
|
||||||
|
nframes_t _playhead;
|
||||||
|
|
||||||
/* not permitted */
|
/* not permitted */
|
||||||
Timeline ( const Timeline &rhs );
|
Timeline ( const Timeline &rhs );
|
||||||
|
@ -162,8 +163,12 @@ public:
|
||||||
|
|
||||||
const char *session_manager_name ( void );
|
const char *session_manager_name ( void );
|
||||||
|
|
||||||
|
|
||||||
nframes_t fpp ( void ) const { return 1 << _fpp; }
|
nframes_t fpp ( void ) const { return 1 << _fpp; }
|
||||||
void range ( nframes_t start, nframes_t length );
|
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;
|
nframes_t length ( void ) const;
|
||||||
void sample_rate ( nframes_t r ) { _sample_rate = r; }
|
void sample_rate ( nframes_t r ) { _sample_rate = r; }
|
||||||
nframes_t sample_rate ( void ) const { return _sample_rate; }
|
nframes_t sample_rate ( void ) const { return _sample_rate; }
|
||||||
|
|
Loading…
Reference in New Issue