diff --git a/src/diskreader.cxx b/src/diskreader.cxx index 892ff50..62c8d3f 100644 --- a/src/diskreader.cxx +++ b/src/diskreader.cxx @@ -16,11 +16,6 @@ using namespace std; DiskReader::DiskReader() { - // TODO : get from user input - - stringstream s; - s << getenv("HOME") << "/" << "sessionName"; - readSession( s.str() ); }; void DiskReader::readSession( std::string path ) diff --git a/src/gmastertrack.hxx b/src/gmastertrack.hxx index afd3af0..2157b80 100644 --- a/src/gmastertrack.hxx +++ b/src/gmastertrack.hxx @@ -48,10 +48,7 @@ static void gmastertrack_button_callback(Fl_Widget *w, void *data) { } else if ( strcmp( w->label(), "Tap" ) == 0 ) { - //Avtk::Button* b = (Avtk::Button*)w; - //EventTimeTempoTap e; - //writeToDspRingbuffer( &e ); - EventSave e; + EventTimeTempoTap e; writeToDspRingbuffer( &e ); } else diff --git a/src/gui.cxx b/src/gui.cxx index e4d9003..0aacd00 100644 --- a/src/gui.cxx +++ b/src/gui.cxx @@ -8,6 +8,8 @@ #include "audiobuffer.hxx" #include "worker.hxx" +#include + // include the header.c file in the planning dir: // its the GIMP .c export of the LUPPP header image #include "../planning/header.c" @@ -48,6 +50,55 @@ static void gui_static_read_rb(void* inst) Fl::repeat_timeout( 1 / 30.f, &gui_static_read_rb, inst); } +static void gui_header_callback(Fl_Widget *w, void *data) +{ + if ( Fl::event_x() > 130 ) + { + return; + } + + Fl_Menu_Item rclick_menu[] = + { + { "Load" }, + { "Save " }, + { 0 } + }; + + Fl_Menu_Item *m = (Fl_Menu_Item*) rclick_menu->popup( 10, 38, 0, 0, 0); + + if ( !m ) + { + return; + } + else if ( strcmp(m->label(), "Load") == 0 ) + { + cout << "Load clicked" << endl; + Fl_Native_File_Chooser fnfc; + fnfc.title("Load Session"); + fnfc.type(Fl_Native_File_Chooser::BROWSE_DIRECTORY); + fnfc.directory( getenv("HOME") ); + + switch ( fnfc.show() ) + { + case -1: //printf("ERROR: %s\\n", fnfc.errmsg()); + break; // ERROR + case 1: //printf("CANCEL\\n"); + break; // CANCEL + default: printf("Loading session directory %s\n", fnfc.filename()); + gui->getDiskReader()->readSession( fnfc.filename() ); + break; + } + } + else if ( strcmp(m->label(), "Save ") == 0 ) { + + const char* name = fl_input( "Save session as", "lupppSession" ); + cout << "Save clicked, name = " << name << endl; + + EventSave e; + //writeToDspRingbuffer( &e ); + } +} + Gui::Gui() : window(1110,650), diskReader( new DiskReader ), @@ -59,6 +110,7 @@ Gui::Gui() : Avtk::Image* headerImage = new Avtk::Image(0,0,1110,36,"header.png"); headerImage->setPixbuf( header.pixel_data, 4 ); + headerImage->callback( gui_header_callback, this ); tooltipLabel = new Fl_Box(130, 25, 500, 20, ""); tooltipLabel->labelcolor( FL_LIGHT2 );