2013-04-20 12:50:30 +02:00
|
|
|
|
|
|
|
#include "gui.hxx"
|
2013-05-13 03:43:44 +02:00
|
|
|
#include "avtk/avtk_image.h"
|
|
|
|
|
|
|
|
#include <sstream>
|
|
|
|
|
2013-07-24 20:09:35 +02:00
|
|
|
#include <FL/Fl_Tooltip.H>
|
|
|
|
|
2013-05-20 00:57:12 +02:00
|
|
|
#include "audiobuffer.hxx"
|
|
|
|
|
2013-07-22 10:13:18 +02:00
|
|
|
// include the header.c file in the planning dir:
|
|
|
|
// its the GIMP .c export of the LUPPP header image
|
|
|
|
#include "../planning/header.c"
|
|
|
|
|
2013-05-13 03:43:44 +02:00
|
|
|
// Hack, move to gtrack.cpp
|
2013-07-24 20:09:35 +02:00
|
|
|
Fl_Box* Gui::tooltipLabel = 0;
|
2013-05-13 03:43:44 +02:00
|
|
|
int GTrack::privateID = 0;
|
2013-05-16 02:38:11 +02:00
|
|
|
int GMasterTrack::privateID = 0;
|
2013-05-20 00:57:12 +02:00
|
|
|
int AudioBuffer::privateID = 0;
|
2013-05-13 03:43:44 +02:00
|
|
|
|
|
|
|
using namespace std;
|
2013-04-20 12:50:30 +02:00
|
|
|
|
2013-07-24 20:09:35 +02:00
|
|
|
|
2013-05-16 19:03:58 +02:00
|
|
|
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();
|
|
|
|
}
|
2013-05-16 14:38:46 +02:00
|
|
|
|
|
|
|
static void gui_static_read_rb(void* inst)
|
|
|
|
{
|
|
|
|
//cout << "read gui" << endl;
|
|
|
|
handleGuiEvents();
|
|
|
|
Fl::repeat_timeout( 1 / 30.f, &gui_static_read_rb, inst);
|
|
|
|
}
|
|
|
|
|
2013-05-16 00:27:31 +02:00
|
|
|
Gui::Gui() :
|
2013-07-22 12:53:08 +02:00
|
|
|
window(1272,750)
|
2013-05-16 00:27:31 +02:00
|
|
|
{
|
2013-07-24 20:09:35 +02:00
|
|
|
fl_show_tooltip = &Gui::show_tooltip;
|
|
|
|
|
2013-05-16 00:27:31 +02:00
|
|
|
window.color(FL_BLACK);
|
|
|
|
window.label("Luppp 5");
|
2013-05-17 12:01:56 +02:00
|
|
|
//window.callback( close_cb, 0 );
|
2013-05-13 03:43:44 +02:00
|
|
|
|
2013-07-24 03:18:15 +02:00
|
|
|
|
2013-07-22 12:53:08 +02:00
|
|
|
Avtk::Image* headerImage = new Avtk::Image(0,0,1272,36,"header.png");
|
2013-07-22 10:13:18 +02:00
|
|
|
headerImage->setPixbuf( header.pixel_data, 4 );
|
2013-05-13 03:43:44 +02:00
|
|
|
|
2013-07-24 20:09:35 +02:00
|
|
|
Gui::tooltipLabel = new Fl_Box(100, 20, 200, 20, "tooltips go here");
|
|
|
|
|
2013-07-24 03:18:15 +02:00
|
|
|
//window.resizable( headerImage );
|
|
|
|
|
2013-05-16 02:38:11 +02:00
|
|
|
int i = 0;
|
|
|
|
for (; i < NTRACKS; i++ )
|
2013-05-13 03:43:44 +02:00
|
|
|
{
|
|
|
|
stringstream s;
|
|
|
|
s << "Track " << i+1;
|
2013-07-24 03:18:15 +02:00
|
|
|
tracks.push_back( new GTrack(8 + i * 118, 40, 110, 700, s.str().c_str() ) );
|
2013-05-13 03:43:44 +02:00
|
|
|
}
|
2013-04-20 13:20:46 +02:00
|
|
|
|
2013-07-24 03:18:15 +02:00
|
|
|
master = new GMasterTrack(8 + i * 118, 40, 150, 700, "Master");
|
2013-07-22 12:53:08 +02:00
|
|
|
|
2013-07-24 03:18:15 +02:00
|
|
|
unit = new GUnitTrack(9 + i * 118 + 158, 40, 150, 700, "Units");
|
2013-07-21 16:47:35 +02:00
|
|
|
|
2013-05-16 00:27:31 +02:00
|
|
|
|
2013-05-16 02:38:11 +02:00
|
|
|
/*
|
2013-05-15 03:55:51 +02:00
|
|
|
box = new Fl_Box(655, 5, 200, 60, "BPM = 120");
|
|
|
|
box->box(FL_UP_BOX);
|
|
|
|
box->labelsize(36);
|
|
|
|
box->labeltype(FL_SHADOW_LABEL);
|
2013-05-16 02:38:11 +02:00
|
|
|
*/
|
2013-05-16 00:27:31 +02:00
|
|
|
window.end();
|
2013-04-20 12:50:30 +02:00
|
|
|
}
|
|
|
|
|
2013-05-16 14:38:46 +02:00
|
|
|
GTrack* Gui::getTrack(int id)
|
|
|
|
{
|
|
|
|
return tracks.at(id);
|
|
|
|
}
|
|
|
|
|
2013-04-20 12:50:30 +02:00
|
|
|
int Gui::show()
|
|
|
|
{
|
2013-05-16 00:27:31 +02:00
|
|
|
window.show();
|
2013-05-16 14:38:46 +02:00
|
|
|
|
|
|
|
gui_static_read_rb( this);
|
|
|
|
|
2013-04-20 12:50:30 +02:00
|
|
|
return Fl::run();
|
|
|
|
}
|
2013-07-24 20:09:35 +02:00
|
|
|
|
|
|
|
void Gui::show_tooltip( const char* c )
|
|
|
|
{
|
|
|
|
tooltipLabel->label( c );
|
|
|
|
}
|