Mixer: Allow copy/paste of mixer strips (even between instances).
This commit is contained in:
parent
fadeea8a33
commit
54b8dfefb7
|
@ -54,6 +54,7 @@ extern char *user_config_dir;
|
|||
extern char *instance_name;
|
||||
|
||||
#include "debug.h"
|
||||
#include "string_util.h"
|
||||
|
||||
#include "NSM.H"
|
||||
|
||||
|
@ -269,6 +270,10 @@ void Mixer::cb_menu(Fl_Widget* o) {
|
|||
fl_alert( "%s", "Failed to import strip!" );
|
||||
}
|
||||
}
|
||||
else if ( !strcmp( picked, "&Mixer/Paste" ) )
|
||||
{
|
||||
Fl::paste(*this);
|
||||
}
|
||||
else if (! strcmp( picked, "&Project/Se&ttings/&Rows/One") )
|
||||
{
|
||||
rows( 1 );
|
||||
|
@ -413,6 +418,7 @@ Mixer::Mixer ( int X, int Y, int W, int H, const char *L ) :
|
|||
o->add( "&Mixer/&Add Strip", 'a', 0, 0 );
|
||||
o->add( "&Mixer/Add &N Strips" );
|
||||
o->add( "&Mixer/&Import Strip" );
|
||||
o->add( "&Mixer/Paste", FL_CTRL + 'v', 0, 0 );
|
||||
o->add( "&View/&Theme", 0, 0, 0 );
|
||||
o->add( "&Help/&Manual" );
|
||||
o->add( "&Help/&About" );
|
||||
|
@ -746,6 +752,44 @@ Mixer::update_menu ( void )
|
|||
|
||||
|
||||
|
||||
int
|
||||
Mixer::handle ( int m )
|
||||
{
|
||||
|
||||
if ( Fl_Group::handle( m ) )
|
||||
return 1;
|
||||
|
||||
switch ( m )
|
||||
{
|
||||
case FL_PASTE:
|
||||
{
|
||||
if ( ! Fl::event_inside( this ) )
|
||||
return 0;
|
||||
|
||||
const char *text = Fl::event_text();
|
||||
|
||||
char *file;
|
||||
|
||||
if ( ! sscanf( text, "file://%a[^\r\n]\n", &file ) )
|
||||
{
|
||||
WARNING( "invalid drop \"%s\"\n", text );
|
||||
return 0;
|
||||
}
|
||||
|
||||
unescape_url( file );
|
||||
|
||||
printf( "pasted file \"%s\"\n", file );
|
||||
|
||||
if (! Mixer_Strip::import_strip( file ) )
|
||||
fl_alert( "%s", "Failed to import strip!" );
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/************/
|
||||
/* Commands */
|
||||
/************/
|
||||
|
|
|
@ -74,6 +74,8 @@ private:
|
|||
static int osc_non_hello ( const char *, const char *, lo_arg **, int , lo_message msg, void * );
|
||||
|
||||
public:
|
||||
|
||||
virtual int handle ( int m );
|
||||
|
||||
char * get_unique_track_name ( const char *name );
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
*/
|
||||
/* Each mixer strip comprises a fader and a panner */
|
||||
|
||||
#include "Project.H"
|
||||
#include "Mixer_Strip.H"
|
||||
#include "Engine/Engine.H"
|
||||
#include <dsp.h>
|
||||
|
@ -597,6 +598,17 @@ Mixer_Strip::menu_cb ( const Fl_Menu_ *m )
|
|||
{
|
||||
((Fl_Sometimes_Input*)name_field)->take_focus();
|
||||
}
|
||||
else if ( ! strcmp( picked, "/Copy" ) )
|
||||
{
|
||||
export_strip( "clipboard.strip" );
|
||||
|
||||
char *s;
|
||||
asprintf( &s, "file://%s/%s\r\n", Project::path(), "clipboard.strip" );
|
||||
|
||||
Fl::copy( s, strlen(s), 0 );
|
||||
|
||||
free(s);
|
||||
}
|
||||
else if ( ! strcmp( picked, "/Color" ) )
|
||||
{
|
||||
unsigned char r, g, b;
|
||||
|
@ -661,6 +673,7 @@ Mixer_Strip::menu ( void ) const
|
|||
{ "Move Left", '[', 0, 0 },
|
||||
{ "Move Right", ']', 0, 0 },
|
||||
{ "Color", 0, 0, 0 },
|
||||
{ "Copy", FL_CTRL + 'c', 0, 0 },
|
||||
{ "Export Strip", 0, 0, 0 },
|
||||
{ "Rename", FL_CTRL + 'n', 0, 0 },
|
||||
{ "Remove", FL_Delete, 0, 0 },
|
||||
|
|
|
@ -58,6 +58,7 @@ public:
|
|||
static int open ( const char *name );
|
||||
static bool open ( void ) { return _is_open; }
|
||||
static bool create ( const char *name, const char *template_name );
|
||||
|
||||
|
||||
static const char *path ( void ) { return _path; }
|
||||
static const char *created_on ( void ) { return _created_on; }
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue