Loopp/src/gui.cxx
2013-07-31 01:05:14 +01:00

95 lines
1.9 KiB
C++

#include "gui.hxx"
#include "avtk/avtk_image.h"
#include <sstream>
#include "jack.hxx"
#include "audiobuffer.hxx"
// include the header.c file in the planning dir:
// its the GIMP .c export of the LUPPP header image
#include "../planning/header.c"
// Hack, move to gtrack.cpp
int GTrack::privateID = 0;
int GMasterTrack::privateID = 0;
int AudioBuffer::privateID = 0;
using namespace std;
extern Gui* gui;
void luppp_tooltip(std::string s)
{
return;
//gui->setTooltip(s);
}
void Gui::setTooltip( std::string s )
{
tooltip = s;
tooltipLabel->label( tooltip.c_str() );
}
void close_cb(Fl_Widget*o, void*) {
if ((Fl::event() == FL_KEYDOWN || Fl::event() == FL_SHORTCUT)
&& Fl::event_key() == FL_Escape)
return; // ignore ESC
else o->hide();
}
static void gui_static_read_rb(void* inst)
{
//cout << "read gui" << endl;
handleGuiEvents();
Fl::repeat_timeout( 1 / 30.f, &gui_static_read_rb, inst);
}
Gui::Gui() :
window(1110,650)
{
window.color(FL_BLACK);
window.label("Luppp");
//window.callback( close_cb, 0 );
Avtk::Image* headerImage = new Avtk::Image(0,0,1110,36,"header.png");
headerImage->setPixbuf( header.pixel_data, 4 );
tooltipLabel = new Fl_Box(130, 25, 500, 20, "");
tooltipLabel->labelcolor( FL_LIGHT2 );
tooltipLabel->color( FL_DARK2 );
tooltipLabel->hide();
//tooltipLabel->align( FL_ALIGN_TOP_LEFT );
window.resizable( headerImage );
int i = 0;
for (; i < NTRACKS; i++ )
{
stringstream s;
s << "Track " << i+1;
//printf("track name %s\n", s.str().c_str() );
tracks.push_back( new GTrack(8 + i * 118, 40, 110, 600, s.str().c_str() ) );
}
master = new GMasterTrack(8 + i * 118, 40, 150, 600, "Master");
window.end();
}
GTrack* Gui::getTrack(int id)
{
return tracks.at(id);
}
int Gui::show()
{
window.show();
gui_static_read_rb( this );
return Fl::run();
}