@@ -54,6 +54,7 @@ extern char *user_config_dir; | |||||
extern char *instance_name; | extern char *instance_name; | ||||
#include "debug.h" | #include "debug.h" | ||||
#include "string_util.h" | |||||
#include "NSM.H" | #include "NSM.H" | ||||
@@ -269,6 +270,10 @@ void Mixer::cb_menu(Fl_Widget* o) { | |||||
fl_alert( "%s", "Failed to import strip!" ); | 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") ) | else if (! strcmp( picked, "&Project/Se&ttings/&Rows/One") ) | ||||
{ | { | ||||
rows( 1 ); | 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 Strip", 'a', 0, 0 ); | ||||
o->add( "&Mixer/Add &N Strips" ); | o->add( "&Mixer/Add &N Strips" ); | ||||
o->add( "&Mixer/&Import Strip" ); | o->add( "&Mixer/&Import Strip" ); | ||||
o->add( "&Mixer/Paste", FL_CTRL + 'v', 0, 0 ); | |||||
o->add( "&View/&Theme", 0, 0, 0 ); | o->add( "&View/&Theme", 0, 0, 0 ); | ||||
o->add( "&Help/&Manual" ); | o->add( "&Help/&Manual" ); | ||||
o->add( "&Help/&About" ); | 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 */ | /* Commands */ | ||||
/************/ | /************/ | ||||
@@ -74,6 +74,8 @@ private: | |||||
static int osc_non_hello ( const char *, const char *, lo_arg **, int , lo_message msg, void * ); | static int osc_non_hello ( const char *, const char *, lo_arg **, int , lo_message msg, void * ); | ||||
public: | public: | ||||
virtual int handle ( int m ); | |||||
char * get_unique_track_name ( const char *name ); | char * get_unique_track_name ( const char *name ); | ||||
@@ -32,6 +32,7 @@ | |||||
*/ | */ | ||||
/* Each mixer strip comprises a fader and a panner */ | /* Each mixer strip comprises a fader and a panner */ | ||||
#include "Project.H" | |||||
#include "Mixer_Strip.H" | #include "Mixer_Strip.H" | ||||
#include "Engine/Engine.H" | #include "Engine/Engine.H" | ||||
#include <dsp.h> | #include <dsp.h> | ||||
@@ -597,6 +598,17 @@ Mixer_Strip::menu_cb ( const Fl_Menu_ *m ) | |||||
{ | { | ||||
((Fl_Sometimes_Input*)name_field)->take_focus(); | ((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" ) ) | else if ( ! strcmp( picked, "/Color" ) ) | ||||
{ | { | ||||
unsigned char r, g, b; | unsigned char r, g, b; | ||||
@@ -661,6 +673,7 @@ Mixer_Strip::menu ( void ) const | |||||
{ "Move Left", '[', 0, 0 }, | { "Move Left", '[', 0, 0 }, | ||||
{ "Move Right", ']', 0, 0 }, | { "Move Right", ']', 0, 0 }, | ||||
{ "Color", 0, 0, 0 }, | { "Color", 0, 0, 0 }, | ||||
{ "Copy", FL_CTRL + 'c', 0, 0 }, | |||||
{ "Export Strip", 0, 0, 0 }, | { "Export Strip", 0, 0, 0 }, | ||||
{ "Rename", FL_CTRL + 'n', 0, 0 }, | { "Rename", FL_CTRL + 'n', 0, 0 }, | ||||
{ "Remove", FL_Delete, 0, 0 }, | { "Remove", FL_Delete, 0, 0 }, | ||||
@@ -58,6 +58,7 @@ public: | |||||
static int open ( const char *name ); | static int open ( const char *name ); | ||||
static bool open ( void ) { return _is_open; } | static bool open ( void ) { return _is_open; } | ||||
static bool create ( const char *name, const char *template_name ); | 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; } | static const char *created_on ( void ) { return _created_on; } | ||||
}; | }; |