-GUI now handles click in Luppp title bar, popup menu appears, save / load functionality exists.

main
Harry van Haaren 2013-09-04 23:55:44 +01:00
parent 4d2795af85
commit e436154bc3
3 changed files with 53 additions and 9 deletions

View File

@ -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 )

View File

@ -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

View File

@ -8,6 +8,8 @@
#include "audiobuffer.hxx"
#include "worker.hxx"
#include <FL/fl_ask.H>
// 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 );